Author: apriyadarshi
Date: Sun Jun 5 12:40:49 2016
New Revision: 71530
URL:
http://svn.reactos.org/svn/reactos?rev=71530&view=rev
Log:
Added INF File for driver installation with minimal configuration.
Device Detection and Initialization working -- tested on VMware.
StorPortAllocatePool not working, so asked Storport to allocate all memory just after
loading up the driver -- Bad idea (will change it later).
Added:
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.inf
Modified:
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h
Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
==============================================================================
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] (original)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Sun Jun 5
12:40:49 2016
@@ -99,6 +99,7 @@
portCount++;
portImplemented &= (portImplemented-1);
}
+ StorPortDebugPrint(0, "\tPort Count: %d\n", portCount);
nonCachedExtensionSize = sizeof(AHCI_COMMAND_HEADER) * AlignedNCS + //should be 1K
aligned
sizeof(AHCI_RECEIVED_FIS);
@@ -118,6 +119,8 @@
// allocate memory for port extension
+ /* --> Allocate memory for port extension, but right now it is returning
STOR_STATUS_NOT_IMPLEMENTED
+ so, for testing purpose, I allocated during driver entry itself.
status = StorPortAllocatePool(
adapterExtension,
portCount * sizeof(AHCI_PORT_EXTENSION),
@@ -125,24 +128,24 @@
(PVOID*)&portsExtension);
if (status != STOR_STATUS_SUCCESS){
- StorPortDebugPrint(0, "\tstatus != STOR_STATUS_SUCCESS\n");
+ StorPortDebugPrint(0, "\tstatus : %x\n", status);
return FALSE;
}
AhciZeroMemory((PCHAR)portsExtension, portCount * sizeof(AHCI_PORT_EXTENSION));
-
+ */
nonCachedExtensionSize /= portCount;
currentCount = 0;
for (index = 0; index < 32; index++)
{
if ((adapterExtension->PortImplemented & (1<<index)) != 0)
{
- adapterExtension->PortExtension[index] =
(PAHCI_PORT_EXTENSION)((PCHAR)portsExtension + sizeof(AHCI_PORT_EXTENSION) *
currentCount);
-
- adapterExtension->PortExtension[index]->PortNumber = index;
- adapterExtension->PortExtension[index]->AdapterExtension =
adapterExtension;
- adapterExtension->PortExtension[index]->CommandList =
(PAHCI_COMMAND_HEADER)(nonCachedExtension + (currentCount*nonCachedExtensionSize));
- adapterExtension->PortExtension[index]->ReceivedFIS =
(PAHCI_RECEIVED_FIS)((PCHAR)adapterExtension->PortExtension[index]->CommandList +
sizeof(AHCI_COMMAND_HEADER) * AlignedNCS);
+ //adapterExtension->PortExtension[index] =
(PAHCI_PORT_EXTENSION)((PCHAR)portsExtension + sizeof(AHCI_PORT_EXTENSION) *
currentCount);
+
+ adapterExtension->PortExtension[index].PortNumber = index;
+ adapterExtension->PortExtension[index].AdapterExtension =
adapterExtension;
+ adapterExtension->PortExtension[index].CommandList =
(PAHCI_COMMAND_HEADER)(nonCachedExtension + (currentCount*nonCachedExtensionSize));
+ adapterExtension->PortExtension[index].ReceivedFIS =
(PAHCI_RECEIVED_FIS)((PCHAR)adapterExtension->PortExtension[index].CommandList +
sizeof(AHCI_COMMAND_HEADER) * AlignedNCS);
currentCount++;
}
}
@@ -401,6 +404,10 @@
ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex;
ConfigInfo->ScatterGather = TRUE;
+ // Turn IE -- Interrupt Enabled
+ ghc |= 0x2;
+ StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc);
+
// allocate necessary resource for each port
if (!AhciAllocateResourceForAdapter(adapterExtension, ConfigInfo)){
StorPortDebugPrint(0, "\tAhciAllocateResourceForAdapter() ==
FALSE\n");
@@ -410,12 +417,8 @@
for (index = 0; index < 32; index++)
{
if ((adapterExtension->PortImplemented & (1<<index)) != 0)
- AhciPortInitialize(adapterExtension->PortExtension[index]);
- }
-
- // Turn IE -- Interrupt Enabled
- ghc |= 0x2;
- StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc);
+ AhciPortInitialize(&adapterExtension->PortExtension[index]);
+ }
return SP_RETURN_FOUND;
}// -- AhciHwFindAdapter();
@@ -475,7 +478,7 @@
RegistryPath,
&hwInitializationData,
NULL);
- StorPortDebugPrint(0, "\tstatus:%d\n", status);
+ StorPortDebugPrint(0, "\tstatus:%x\n", status);
return status;
}// -- DriverEntry();
Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
==============================================================================
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] (original)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Sun Jun 5
12:40:49 2016
@@ -205,7 +205,7 @@
PVOID NonCachedExtension;
PAHCI_MEMORY_REGISTERS ABAR_Address;
- PAHCI_PORT_EXTENSION PortExtension[32];
+ AHCI_PORT_EXTENSION PortExtension[32];
} AHCI_ADAPTER_EXTENSION, *PAHCI_ADAPTER_EXTENSION;
typedef struct _AHCI_SRB_EXTENSION
Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.inf
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
==============================================================================
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.inf (added)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.inf [iso-8859-1] Sun Jun 5
12:40:49 2016
@@ -0,0 +1,77 @@
+/*
+ * PROJECT: ROS Kernel
+ * LICENSE: GNU GPLv2 only as published by the Free Software Foundation
+ * PURPOSE: Storahci Driver INF
+ * PROGRAMMERS: Aman Priyadarshi (aman.eureka(a)gmail.com)
+ */
+
+[version]
+signature="$Windows NT$"
+Class=hdc
+ClassGuid={4D36E96A-E325-11CE-BFC1-08002BE10318}
+Provider=%ROS%
+
+[SourceDisksNames]
+1 = %DeviceDesc%,,,
+
+[SourceDisksFiles]
+storahci.sys = 1
+
+[DestinationDirs]
+DefaultDestDir = 12 ; DIRID_DRIVERS
+
+[Manufacturer]
+%STORAHCI%=STORAHCI,NTx86
+
+[STORAHCI]
+
+[STORAHCI.NTx86]
+%SATA_AHCI.DeviceDesc%=storahci_Inst, PCI\CC_010601; Standard SATA AHCI Controller
+
+[ControlFlags]
+ExcludeFromSelect = *
+
+[storahci_Inst]
+CopyFiles = storahci_CopyFiles
+
+[storahci_Inst.HW]
+; Enables Storport IPM for this adapter
+HKR, "StorPort", "EnableIdlePowerManagement", %REG_DWORD%, 0x01
+
+[storahci_Inst.Services]
+AddService = storahci, %SPSVCINST_ASSOCSERVICE%, storahci_Service_Inst,
Miniport_EventLog_Inst
+
+[storahci_Service_Inst]
+DisplayName = %DeviceDesc%
+ServiceType = %SERVICE_KERNEL_DRIVER%
+StartType = %SERVICE_BOOT_START%
+ErrorControl = %SERVICE_ERROR_CRITICAL%
+ServiceBinary = %12%\storahci.sys
+LoadOrderGroup = SCSI Miniport
+AddReg = ahci_addreg
+
+[storahci_CopyFiles]
+storahci.sys,,,1
+
+[ahci_addreg]
+HKR, "Parameters\PnpInterface", "5", %REG_DWORD%, 0x00000001
+HKR, "Parameters", "BusType", %REG_DWORD%, 0x0000000B
+
+[Miniport_EventLog_Inst]
+AddReg = Miniport_EventLog_AddReg
+
+[Miniport_EventLog_AddReg]
+HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\IoLogMsg.dll"
+HKR,,TypesSupported,%REG_DWORD%,7
+
+[Strings]
+ROS = "React OS"
+DeviceDesc = "AHCI SATA Driver"
+SATA_AHCI.DeviceDesc = "Standard SATA AHCI Controller"
+
+SPSVCINST_ASSOCSERVICE = 0x00000002
+SERVICE_KERNEL_DRIVER = 1
+SERVICE_BOOT_START = 0
+SERVICE_ERROR_CRITICAL = 3
+REG_EXPAND_SZ = 0x00020000
+REG_DWORD = 0x00010001