projects
/
reactos.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1128447
)
[STORAHCI] Make the storahci driver build on gcc and add it to the build.
author
Eric Kohl
<eric.kohl@reactos.org>
Fri, 13 Oct 2017 19:52:38 +0000
(21:52 +0200)
committer
Eric Kohl
<eric.kohl@reactos.org>
Fri, 13 Oct 2017 19:52:38 +0000
(21:52 +0200)
drivers/storage/CMakeLists.txt
patch
|
blob
|
history
drivers/storage/storahci/storahci.c
patch
|
blob
|
history
drivers/storage/storahci/storahci.h
patch
|
blob
|
history
drivers/storage/storahci/storahci.rc
patch
|
blob
|
history
diff --git
a/drivers/storage/CMakeLists.txt
b/drivers/storage/CMakeLists.txt
index
44cd868
..
610df52
100644
(file)
--- a/
drivers/storage/CMakeLists.txt
+++ b/
drivers/storage/CMakeLists.txt
@@
-6,4
+6,4
@@
add_subdirectory(floppy)
add_subdirectory(ide)
add_subdirectory(port)
add_subdirectory(scsiport)
add_subdirectory(ide)
add_subdirectory(port)
add_subdirectory(scsiport)
-
#
add_subdirectory(storahci)
+add_subdirectory(storahci)
diff --git
a/drivers/storage/storahci/storahci.c
b/drivers/storage/storahci/storahci.c
index
97138a6
..
54931ac
100644
(file)
--- a/
drivers/storage/storahci/storahci.c
+++ b/
drivers/storage/storahci/storahci.c
@@
-19,10
+19,12
@@
* Return true if intialization was successful
*/
BOOLEAN
* Return true if intialization was successful
*/
BOOLEAN
+NTAPI
AhciPortInitialize (
AhciPortInitialize (
- __in P
AHCI_PORT_EXTENSION Port
Extension
+ __in P
VOID Device
Extension
)
{
)
{
+ PAHCI_PORT_EXTENSION PortExtension;
AHCI_PORT_CMD cmd;
PAHCI_MEMORY_REGISTERS abar;
ULONG mappedLength, portNumber, ticks;
AHCI_PORT_CMD cmd;
PAHCI_MEMORY_REGISTERS abar;
ULONG mappedLength, portNumber, ticks;
@@
-31,6
+33,7
@@
AhciPortInitialize (
AhciDebugPrint("AhciPortInitialize()\n");
AhciDebugPrint("AhciPortInitialize()\n");
+ PortExtension = (PAHCI_PORT_EXTENSION)DeviceExtension;
adapterExtension = PortExtension->AdapterExtension;
abar = adapterExtension->ABAR_Address;
portNumber = PortExtension->PortNumber;
adapterExtension = PortExtension->AdapterExtension;
abar = adapterExtension->ABAR_Address;
portNumber = PortExtension->PortNumber;
@@
-95,8
+98,8
@@
AhciPortInitialize (
}
// 10.1.2 For each implemented port, system software shall allocate memory for and program:
}
// 10.1.2 For each implemented port, system software shall allocate memory for and program:
- //
PxCLB and PxCLBU (if CAP.S64A is set to ‘1’)
- //
PxFB and PxFBU (if CAP.S64A is set to ‘1’)
+ //
?
PxCLB and PxCLBU (if CAP.S64A is set to ‘1’)
+ //
?
PxFB and PxFBU (if CAP.S64A is set to ‘1’)
// Note: Assuming 32bit support only
StorPortWriteRegisterUlong(adapterExtension, &PortExtension->Port->CLB, commandListPhysical.LowPart);
if (IsAdapterCAPS64(adapterExtension->CAP))
// Note: Assuming 32bit support only
StorPortWriteRegisterUlong(adapterExtension, &PortExtension->Port->CLB, commandListPhysical.LowPart);
if (IsAdapterCAPS64(adapterExtension->CAP))
@@
-417,8
+420,8
@@
AhciStartPort (
VOID
AhciCommandCompletionDpcRoutine (
__in PSTOR_DPC Dpc,
VOID
AhciCommandCompletionDpcRoutine (
__in PSTOR_DPC Dpc,
- __in P
AHCI_ADAPTER_EXTENSION Adapter
Extension,
- __in P
AHCI_PORT_EXTENSION PortExtension
,
+ __in P
VOID HwDevice
Extension,
+ __in P
VOID SystemArgument1
,
__in PVOID SystemArgument2
)
{
__in PVOID SystemArgument2
)
{
@@
-426,12
+429,17
@@
AhciCommandCompletionDpcRoutine (
PAHCI_SRB_EXTENSION SrbExtension;
STOR_LOCK_HANDLE lockhandle = {0};
PAHCI_COMPLETION_ROUTINE CompletionRoutine;
PAHCI_SRB_EXTENSION SrbExtension;
STOR_LOCK_HANDLE lockhandle = {0};
PAHCI_COMPLETION_ROUTINE CompletionRoutine;
+ PAHCI_ADAPTER_EXTENSION AdapterExtension;
+ PAHCI_PORT_EXTENSION PortExtension;
UNREFERENCED_PARAMETER(Dpc);
UNREFERENCED_PARAMETER(SystemArgument2);
AhciDebugPrint("AhciCommandCompletionDpcRoutine()\n");
UNREFERENCED_PARAMETER(Dpc);
UNREFERENCED_PARAMETER(SystemArgument2);
AhciDebugPrint("AhciCommandCompletionDpcRoutine()\n");
+ AdapterExtension = (PAHCI_ADAPTER_EXTENSION)HwDeviceExtension;
+ PortExtension = (PAHCI_PORT_EXTENSION)SystemArgument1;
+
StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle);
Srb = RemoveQueue(&PortExtension->CompletionQueue);
StorPortReleaseSpinLock(AdapterExtension, &lockhandle);
StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle);
Srb = RemoveQueue(&PortExtension->CompletionQueue);
StorPortReleaseSpinLock(AdapterExtension, &lockhandle);
@@
-473,14
+481,17
@@
AhciCommandCompletionDpcRoutine (
*/
BOOLEAN
AhciHwPassiveInitialize (
*/
BOOLEAN
AhciHwPassiveInitialize (
- __in P
AHCI_ADAPTER_EXTENSION Adapter
Extension
+ __in P
VOID Device
Extension
)
{
ULONG index;
)
{
ULONG index;
+ PAHCI_ADAPTER_EXTENSION AdapterExtension;
PAHCI_PORT_EXTENSION PortExtension;
AhciDebugPrint("AhciHwPassiveInitialize()\n");
PAHCI_PORT_EXTENSION PortExtension;
AhciDebugPrint("AhciHwPassiveInitialize()\n");
+ AdapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension;
+
for (index = 0; index < AdapterExtension->PortCount; index++)
{
if ((AdapterExtension->PortImplemented & (0x1 << index)) != 0)
for (index = 0; index < AdapterExtension->PortCount; index++)
{
if ((AdapterExtension->PortImplemented & (0x1 << index)) != 0)
@@
-506,14
+517,17
@@
AhciHwPassiveInitialize (
* return TRUE if intialization was successful
*/
BOOLEAN
* return TRUE if intialization was successful
*/
BOOLEAN
+NTAPI
AhciHwInitialize (
AhciHwInitialize (
- __in P
AHCI_ADAPTER_EXTENSION Adapter
Extension
+ __in P
VOID Device
Extension
)
{
)
{
+ PAHCI_ADAPTER_EXTENSION AdapterExtension;
AHCI_GHC ghc;
AhciDebugPrint("AhciHwInitialize()\n");
AHCI_GHC ghc;
AhciDebugPrint("AhciHwInitialize()\n");
+ AdapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension;
AdapterExtension->StateFlags.MessagePerPort = FALSE;
// First check what type of interrupt/synchronization device is using
AdapterExtension->StateFlags.MessagePerPort = FALSE;
// First check what type of interrupt/synchronization device is using
@@
-701,12
+715,16
@@
AhciInterruptHandler (
* return FALSE Indicates the interrupt was not ours.
*/
BOOLEAN
* return FALSE Indicates the interrupt was not ours.
*/
BOOLEAN
+NTAPI
AhciHwInterrupt (
AhciHwInterrupt (
- __in P
AHCI_ADAPTER_EXTENSION Adapter
Extension
+ __in P
VOID Device
Extension
)
{
)
{
+ PAHCI_ADAPTER_EXTENSION AdapterExtension;
ULONG portPending, nextPort, i, portCount;
ULONG portPending, nextPort, i, portCount;
+ AdapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension;
+
if (AdapterExtension->StateFlags.Removed)
{
return FALSE;
if (AdapterExtension->StateFlags.Removed)
{
return FALSE;
@@
-765,13
+783,18
@@
AhciHwInterrupt (
* return FALSE if the request must be submitted later
*/
BOOLEAN
* return FALSE if the request must be submitted later
*/
BOOLEAN
+NTAPI
AhciHwStartIo (
AhciHwStartIo (
- __in P
AHCI_ADAPTER_EXTENSION Adapter
Extension,
+ __in P
VOID Device
Extension,
__in PSCSI_REQUEST_BLOCK Srb
)
{
__in PSCSI_REQUEST_BLOCK Srb
)
{
+ PAHCI_ADAPTER_EXTENSION AdapterExtension;
+
AhciDebugPrint("AhciHwStartIo()\n");
AhciDebugPrint("AhciHwStartIo()\n");
+ AdapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension;
+
if (!IsPortValid(AdapterExtension, Srb->PathId))
{
Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
if (!IsPortValid(AdapterExtension, Srb->PathId))
{
Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
@@
-903,17
+926,18
@@
AhciHwStartIo (
* return TRUE if bus was successfully reset
*/
BOOLEAN
* return TRUE if bus was successfully reset
*/
BOOLEAN
+NTAPI
AhciHwResetBus (
__in PVOID AdapterExtension,
__in ULONG PathId
)
{
STOR_LOCK_HANDLE lockhandle = {0};
AhciHwResetBus (
__in PVOID AdapterExtension,
__in ULONG PathId
)
{
STOR_LOCK_HANDLE lockhandle = {0};
- PAHCI_ADAPTER_EXTENSION adapterExtension;
+
//
PAHCI_ADAPTER_EXTENSION adapterExtension;
AhciDebugPrint("AhciHwResetBus()\n");
AhciDebugPrint("AhciHwResetBus()\n");
- adapterExtension = AdapterExtension;
+
//
adapterExtension = AdapterExtension;
if (IsPortValid(AdapterExtension, PathId))
{
if (IsPortValid(AdapterExtension, PathId))
{
@@
-962,11
+986,12
@@
AhciHwResetBus (
* @remarks Called by Storport.
*/
ULONG
* @remarks Called by Storport.
*/
ULONG
+NTAPI
AhciHwFindAdapter (
AhciHwFindAdapter (
- __in PVOID
Adapter
Extension,
+ __in PVOID
Device
Extension,
__in PVOID HwContext,
__in PVOID BusInformation,
__in PVOID HwContext,
__in PVOID BusInformation,
- __in P
VOID
ArgumentString,
+ __in P
CHAR
ArgumentString,
__inout PPORT_CONFIGURATION_INFORMATION ConfigInfo,
__in PBOOLEAN Reserved3
)
__inout PPORT_CONFIGURATION_INFORMATION ConfigInfo,
__in PBOOLEAN Reserved3
)
@@
-987,7
+1012,7
@@
AhciHwFindAdapter (
UNREFERENCED_PARAMETER(ArgumentString);
UNREFERENCED_PARAMETER(Reserved3);
UNREFERENCED_PARAMETER(ArgumentString);
UNREFERENCED_PARAMETER(Reserved3);
- adapterExtension =
Adapter
Extension;
+ adapterExtension =
Device
Extension;
adapterExtension->SlotNumber = ConfigInfo->SlotNumber;
adapterExtension->SystemIoBusNumber = ConfigInfo->SystemIoBusNumber;
adapterExtension->SlotNumber = ConfigInfo->SlotNumber;
adapterExtension->SystemIoBusNumber = ConfigInfo->SystemIoBusNumber;
@@
-1013,9
+1038,10
@@
AhciHwFindAdapter (
// The last PCI base address register (BAR[5], header offset 0x24) points to the AHCI base memory, it’s called ABAR (AHCI Base Memory Register).
adapterExtension->AhciBaseAddress = pciConfigData->u.type0.BaseAddresses[5] & (0xFFFFFFF0);
// The last PCI base address register (BAR[5], header offset 0x24) points to the AHCI base memory, it’s called ABAR (AHCI Base Memory Register).
adapterExtension->AhciBaseAddress = pciConfigData->u.type0.BaseAddresses[5] & (0xFFFFFFF0);
- AhciDebugPrint("\tVendorID:%d DeviceID:%d RevisionID:%d\n", adapterExtension->VendorID,
- adapterExtension->DeviceID,
- adapterExtension->RevisionID);
+ AhciDebugPrint("\tVendorID: %04x DeviceID: %04x RevisionID: %02x\n",
+ adapterExtension->VendorID,
+ adapterExtension->DeviceID,
+ adapterExtension->RevisionID);
// 2.1.11
abar = NULL;
// 2.1.11
abar = NULL;
@@
-1133,6
+1159,7
@@
AhciHwFindAdapter (
* NT_STATUS in case of driver loaded successfully.
*/
ULONG
* NT_STATUS in case of driver loaded successfully.
*/
ULONG
+NTAPI
DriverEntry (
__in PVOID DriverObject,
__in PVOID RegistryPath
DriverEntry (
__in PVOID DriverObject,
__in PVOID RegistryPath
@@
-1599,15
+1626,20
@@
AhciProcessIO (
*/
VOID
AtapiInquiryCompletion (
*/
VOID
AtapiInquiryCompletion (
- __in P
AHCI_PORT_EXTENSION Port
Extension,
- __in P
SCSI_REQUEST_BLOCK
Srb
+ __in P
VOID _
Extension,
+ __in P
VOID _
Srb
)
{
)
{
-
BOOLEAN status
;
+
PAHCI_PORT_EXTENSION PortExtension
;
PAHCI_ADAPTER_EXTENSION AdapterExtension;
PAHCI_ADAPTER_EXTENSION AdapterExtension;
+ PSCSI_REQUEST_BLOCK Srb;
+ BOOLEAN status;
AhciDebugPrint("AtapiInquiryCompletion()\n");
AhciDebugPrint("AtapiInquiryCompletion()\n");
+ PortExtension = (PAHCI_PORT_EXTENSION)_Extension;
+ Srb = (PSCSI_REQUEST_BLOCK)_Srb;
+
NT_ASSERT(Srb != NULL);
NT_ASSERT(PortExtension != NULL);
NT_ASSERT(Srb != NULL);
NT_ASSERT(PortExtension != NULL);
@@
-1637,11
+1669,14
@@
AtapiInquiryCompletion (
*/
VOID
InquiryCompletion (
*/
VOID
InquiryCompletion (
- __in P
AHCI_PORT_EXTENSION Port
Extension,
- __in P
SCSI_REQUEST_BLOCK
Srb
+ __in P
VOID _
Extension,
+ __in P
VOID _
Srb
)
{
)
{
- PCDB cdb;
+ PAHCI_PORT_EXTENSION PortExtension;
+ PSCSI_REQUEST_BLOCK Srb;
+
+// PCDB cdb;
BOOLEAN status;
PINQUIRYDATA InquiryData;
PAHCI_SRB_EXTENSION SrbExtension;
BOOLEAN status;
PINQUIRYDATA InquiryData;
PAHCI_SRB_EXTENSION SrbExtension;
@@
-1650,10
+1685,13
@@
InquiryCompletion (
AhciDebugPrint("InquiryCompletion()\n");
AhciDebugPrint("InquiryCompletion()\n");
+ PortExtension = (PAHCI_PORT_EXTENSION)_Extension;
+ Srb = (PSCSI_REQUEST_BLOCK)_Srb;
+
NT_ASSERT(Srb != NULL);
NT_ASSERT(PortExtension != NULL);
NT_ASSERT(Srb != NULL);
NT_ASSERT(PortExtension != NULL);
- cdb = (PCDB)&Srb->Cdb;
+
//
cdb = (PCDB)&Srb->Cdb;
InquiryData = Srb->DataBuffer;
SrbExtension = GetSrbExtension(Srb);
AdapterExtension = PortExtension->AdapterExtension;
InquiryData = Srb->DataBuffer;
SrbExtension = GetSrbExtension(Srb);
AdapterExtension = PortExtension->AdapterExtension;
diff --git
a/drivers/storage/storahci/storahci.h
b/drivers/storage/storahci/storahci.h
index
6adcc50
..
8c5277d
100644
(file)
--- a/
drivers/storage/storahci/storahci.h
+++ b/
drivers/storage/storahci/storahci.h
@@
-9,9
+9,14
@@
#include <ata.h>
#include <storport.h>
#include <ata.h>
#include <storport.h>
+#define NDEBUG
+#include <debug.h>
+
#define DEBUG 1
#define DEBUG 1
+#if defined(_MSC_VER)
#pragma warning(disable:4214) // bit field types other than int
#pragma warning(disable:4201) // nameless struct/union
#pragma warning(disable:4214) // bit field types other than int
#pragma warning(disable:4201) // nameless struct/union
+#endif
#define MAXIMUM_AHCI_PORT_COUNT 32
#define MAXIMUM_AHCI_PRDT_ENTRIES 32
#define MAXIMUM_AHCI_PORT_COUNT 32
#define MAXIMUM_AHCI_PRDT_ENTRIES 32
@@
-76,7
+81,8
@@
#define AHCI_Global_Port_CAP_NCS(x) (((x) & 0xF00) >> 8)
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
#define AHCI_Global_Port_CAP_NCS(x) (((x) & 0xF00) >> 8)
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
-#define AhciDebugPrint(format, ...) StorPortDebugPrint(0, format, __VA_ARGS__)
+//#define AhciDebugPrint(format, ...) StorPortDebugPrint(0, format, __VA_ARGS__)
+#define AhciDebugPrint(format, ...) DbgPrint("(%s:%d) " format, __RELFILE__, __LINE__, ##__VA_ARGS__)
typedef
VOID
typedef
VOID
diff --git
a/drivers/storage/storahci/storahci.rc
b/drivers/storage/storahci/storahci.rc
index
5950ce2
..
b6f7645
100644
(file)
--- a/
drivers/storage/storahci/storahci.rc
+++ b/
drivers/storage/storahci/storahci.rc
@@
-4,19
+4,8
@@
// PURPOSE: To Implement AHCI Miniport driver targeting storport NT 5.2
// PROGRAMMERS: Aman Priyadarshi (aman.eureka@gmail.com)
//
// PURPOSE: To Implement AHCI Miniport driver targeting storport NT 5.2
// PROGRAMMERS: Aman Priyadarshi (aman.eureka@gmail.com)
//
-
-#define VERSION 1
-#define VERSION_STR "1.0"
-
-#define REACTOS_FILETYPE VFT_DRV
-#define REACTOS_FILESUBTYPE VFT2_DRV_SYSTEM
-#define REACTOS_FILEVERSION VERSION
-#define REACTOS_PRODUCTVERSION VERSION
-#define REACTOS_STR_COMPANY_NAME "ReactOS Development Team"
+#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "AHCI Storport Miniport Driver"
#define REACTOS_STR_FILE_DESCRIPTION "AHCI Storport Miniport Driver"
-#define REACTOS_STR_FILE_VERSION VERSION_STR
-#define REACTOS_STR_INTERNAL_NAME "storahci.sys"
+#define REACTOS_STR_INTERNAL_NAME "storahci"
#define REACTOS_STR_ORIGINAL_FILENAME "storahci.sys"
#define REACTOS_STR_ORIGINAL_FILENAME "storahci.sys"
-#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright 2016 ReactOS Team"
-#define REACTOS_STR_PRODUCT_NAME "AHCI Driver for ReactOS"
-#define REACTOS_STR_PRODUCT_VERSION VERSION_STR
+#include <reactos/version.rc>