- Restructure HAL bus routines a bit.
authorStefan Ginsberg <stefanginsberg@gmail.com>
Fri, 30 Oct 2009 22:07:26 +0000 (22:07 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Fri, 30 Oct 2009 22:07:26 +0000 (22:07 +0000)
- Fix some incorrect HAL types and add some that were missing.

svn path=/trunk/; revision=43855

reactos/hal/halx86/generic/bus/bushndlr.c [new file with mode: 0644]
reactos/hal/halx86/generic/bus/halbus.c [moved from reactos/hal/halx86/generic/bus.c with 99% similarity]
reactos/hal/halx86/generic/bus/isabus.c [new file with mode: 0644]
reactos/hal/halx86/generic/bus/pcibus.c [moved from reactos/hal/halx86/generic/pci.c with 98% similarity]
reactos/hal/halx86/generic/bus/sysbus.c [new file with mode: 0644]
reactos/hal/halx86/hal_generic.rbuild
reactos/hal/halx86/hal_generic_amd64.rbuild
reactos/hal/halx86/hal_generic_pc.rbuild
reactos/hal/halx86/halxbox.rbuild
reactos/include/ndk/haltypes.h

diff --git a/reactos/hal/halx86/generic/bus/bushndlr.c b/reactos/hal/halx86/generic/bus/bushndlr.c
new file mode 100644 (file)
index 0000000..1df180e
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            hal/halx86/generic/bus/bushndlr.c
+ * PURPOSE:
+ * PROGRAMMERS:     Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
similarity index 99%
rename from reactos/hal/halx86/generic/bus.c
rename to reactos/hal/halx86/generic/bus/halbus.c
index 9b708a2..392c69f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * PROJECT:         ReactOS HAL
  * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            hal/halx86/generic/bus.c
+ * FILE:            hal/halx86/generic/bus/halbus.c
  * PURPOSE:         Bus Support Routines
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
  */
diff --git a/reactos/hal/halx86/generic/bus/isabus.c b/reactos/hal/halx86/generic/bus/isabus.c
new file mode 100644 (file)
index 0000000..7e9631f
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            hal/halx86/generic/bus/isabus.c
+ * PURPOSE:
+ * PROGRAMMERS:     Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
similarity index 98%
rename from reactos/hal/halx86/generic/pci.c
rename to reactos/hal/halx86/generic/bus/pcibus.c
index 413b873..387f837 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * PROJECT:         ReactOS HAL
  * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            hal/halx86/generic/pci.c
+ * FILE:            hal/halx86/generic/bus/pcibus.c
  * PURPOSE:         PCI Bus Support (Configuration Space, Resource Allocation)
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
  */
@@ -98,9 +98,10 @@ BUS_HANDLER HalpFakePciBusHandler =
     NULL,
     &HalpFakePciBusData,
     0,
+    NULL,
     {0, 0, 0, 0},
-    HalpGetPCIData,
-    HalpSetPCIData,
+    (PGETSETBUSDATA)HalpGetPCIData,
+    (PGETSETBUSDATA)HalpSetPCIData,
     NULL,
     HalpAssignPCISlotResources,
     NULL,
@@ -338,7 +339,7 @@ NTAPI
 HalpGetPCIData(IN PBUS_HANDLER BusHandler,
                IN PBUS_HANDLER RootHandler,
                IN PCI_SLOT_NUMBER Slot,
-               IN PUCHAR Buffer,
+               IN PVOID Buffer,
                IN ULONG Offset,
                IN ULONG Length)
 {
@@ -404,7 +405,7 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler,
 
         /* Update buffer and offset, decrement total length */
         Offset += Len;
-        Buffer += Len;
+        Buffer = (PVOID)((ULONG_PTR)Buffer + Len);
         Length -= Len;
     }
 
@@ -429,7 +430,7 @@ NTAPI
 HalpSetPCIData(IN PBUS_HANDLER BusHandler,
                IN PBUS_HANDLER RootHandler,
                IN PCI_SLOT_NUMBER Slot,
-               IN PUCHAR Buffer,
+               IN PVOID Buffer,
                IN ULONG Offset,
                IN ULONG Length)
 {
@@ -483,7 +484,7 @@ HalpSetPCIData(IN PBUS_HANDLER BusHandler,
 
         /* Update buffer and offset, decrement total length */
         Offset += Len;
-        Buffer += Len;
+        Buffer = (PVOID)((ULONG_PTR)Buffer + Len);
         Length -= Len;
     }
 
diff --git a/reactos/hal/halx86/generic/bus/sysbus.c b/reactos/hal/halx86/generic/bus/sysbus.c
new file mode 100644 (file)
index 0000000..d011cb5
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            hal/halx86/generic/bus/sysbus.c
+ * PURPOSE:
+ * PROGRAMMERS:     Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
index ce26242..30b2602 100644 (file)
@@ -6,9 +6,14 @@
                <include base="ntoskrnl">include</include>
                <define name="_NTHAL_" />
                <directory name="generic">
+                       <directory name="bus">
+                               <file>bushndlr.c</file>
+                               <file>isabus.c</file>
+                               <file>halbus.c</file>
+                               <file>sysbus.c</file>
+                       </directory>
                        <file>beep.c</file>
                        <file>bios.c</file>
-                       <file>bus.c</file>
                        <file>cmos.c</file>
                        <file>dma.c</file>
                        <file>drive.c</file>
index 1eb9ffe..ac8e7c8 100644 (file)
@@ -6,8 +6,13 @@
                <include base="ntoskrnl">include</include>
                <define name="_NTHAL_" />
                <directory name="generic">
+                       <directory name="bus">
+                               <file>bushndlr.c</file>
+                               <file>isabus.c</file>
+                               <file>halbus.c</file>
+                               <file>sysbus.c</file>
+                       </directory>
                        <file>beep.c</file>
-                       <file>bus.c</file>
                        <file>cmos.c</file>
                        <file>dma.c</file>
                        <file>drive.c</file>
index 576aa28..5aac0c9 100644 (file)
@@ -6,7 +6,9 @@
                <include base="ntoskrnl">include</include>
                <define name="_NTHAL_" />
                <directory name="generic">
-                       <file>pci.c</file>
+                       <directory name="bus">
+                               <file>pcibus.c</file>
+                       </directory>
                </directory>
        </module>
 </group>
index c842c31..2b5f0de 100644 (file)
@@ -11,7 +11,9 @@
                <library>hal_generic_up</library>
                <library>ntoskrnl</library>
                <directory name="generic">
-                       <file>pci.c</file>
+                       <directory name="bus">
+                               <file>pcibus.c</file>
+                       </directory>
                </directory>
                <directory name="xbox">
                        <file>halinit_xbox.c</file>
index b1ba9d3..4687378 100644 (file)
@@ -44,7 +44,7 @@ typedef enum _FIRMWARE_REENTRY
 //
 typedef
 PBUS_HANDLER
-(NTAPI *pHalHandlerForConfigSpace)(
+(FASTCALL *pHalHandlerForConfigSpace)(
     IN BUS_DATA_TYPE ConfigSpace,
     IN ULONG BusNumber
 );
@@ -101,15 +101,15 @@ BOOLEAN
 //
 typedef
 NTSTATUS
-(NTAPI *pAdjustResourceList)(
+(NTAPI *PADJUSTRESOURCELIST)(
     IN PBUS_HANDLER BusHandler,
-    IN ULONG BusNumber,
-    IN OUT PCM_RESOURCE_LIST Resources
+    IN PBUS_HANDLER RootHandler,
+    IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *Resources
 );
 
 typedef
 NTSTATUS
-(NTAPI *pAssignSlotResources)(
+(NTAPI *PASSIGNSLOTRESOURCES)(
     IN PBUS_HANDLER BusHandler,
     IN PBUS_HANDLER RootHandler,
     IN PUNICODE_STRING RegistryPath,
@@ -122,20 +122,20 @@ NTSTATUS
 
 typedef
 ULONG
-(NTAPI *pGetSetBusData)(
+(NTAPI *PGETSETBUSDATA)(
     IN PBUS_HANDLER BusHandler,
     IN PBUS_HANDLER RootHandler,
-    IN PCI_SLOT_NUMBER SlotNumber,
-    OUT PUCHAR Buffer,
+    IN ULONG SlotNumber,
+    OUT PVOID Buffer,
     IN ULONG Offset,
     IN ULONG Length
 );
 
 typedef
 ULONG
-(NTAPI *pGetInterruptVector)(
+(NTAPI *PGETINTERRUPTVECTOR)(
     IN PBUS_HANDLER BusHandler,
-    IN ULONG BusNumber,
+    IN PBUS_HANDLER RootHandler,
     IN ULONG BusInterruptLevel,
     IN ULONG BusInterruptVector,
     OUT PKIRQL Irql,
@@ -143,10 +143,10 @@ ULONG
 );
 
 typedef
-ULONG
-(NTAPI *pTranslateBusAddress)(
+BOOLEAN
+(NTAPI *PTRANSLATEBUSADDRESS)(
     IN PBUS_HANDLER BusHandler,
-    IN ULONG BusNumber,
+    IN PBUS_HANDLER RootHandler,
     IN PHYSICAL_ADDRESS BusAddress,
     IN OUT PULONG AddressSpace,
     OUT PPHYSICAL_ADDRESS TranslatedAddress
@@ -186,9 +186,38 @@ typedef struct _HAL_PRIVATE_DISPATCH
 #endif
 } HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
 
+//
+// HAL Supported Range
+//
+#define HAL_SUPPORTED_RANGE_VERSION 1
+typedef struct _SUPPORTED_RANGE
+{
+    struct _SUPPORTED_RANGE *Next;
+    ULONG SystemAddressSpace;
+    LONGLONG SystemBase;
+    LONGLONG Base;
+    LONGLONG Limit;
+} SUPPORTED_RANGE, *PSUPPORTED_RANGE;
+
+typedef struct _SUPPORTED_RANGES 
+{
+    USHORT Version;
+    BOOLEAN Sorted;
+    UCHAR Reserved;
+    ULONG NoIO;
+    SUPPORTED_RANGE IO;
+    ULONG NoMemory;
+    SUPPORTED_RANGE Memory;
+    ULONG NoPrefetchMemory;
+    SUPPORTED_RANGE PrefetchMemory;
+    ULONG NoDma;
+    SUPPORTED_RANGE Dma;
+} SUPPORTED_RANGES, *PSUPPORTED_RANGES;
+
 //
 // HAL Bus Handler
 //
+#define HAL_BUS_HANDLER_VERSION 1
 typedef struct _BUS_HANDLER
 {
     ULONG Version;
@@ -199,16 +228,30 @@ typedef struct _BUS_HANDLER
     struct _BUS_HANDLER *ParentHandler;
     PVOID BusData;
     ULONG DeviceControlExtensionSize;
-    //PSUPPORTED_RANGES BusAddresses;
+    PSUPPORTED_RANGES BusAddresses;
     ULONG Reserved[4];
-    pGetSetBusData GetBusData;
-    pGetSetBusData SetBusData;
-    pAdjustResourceList AdjustResourceList;
-    pAssignSlotResources AssignSlotResources;
-    pGetInterruptVector GetInterruptVector;
-    pTranslateBusAddress TranslateBusAddress;
+    PGETSETBUSDATA GetBusData;
+    PGETSETBUSDATA SetBusData;
+    PADJUSTRESOURCELIST AdjustResourceList;
+    PASSIGNSLOTRESOURCES AssignSlotResources;
+    PGETINTERRUPTVECTOR GetInterruptVector;
+    PTRANSLATEBUSADDRESS TranslateBusAddress;
+    PVOID Spare1;
+    PVOID Spare2;
+    PVOID Spare3;
+    PVOID Spare4;
+    PVOID Spare5;
+    PVOID Spare6;
+    PVOID Spare7;
+    PVOID Spare8;
 } BUS_HANDLER;
 
+//
+// HAL Chip Hacks
+//
+#define HAL_PCI_CHIP_HACK_DISABLE_HIBERNATE 0x02
+#define HAL_PCI_CHIP_HACK_USB_SMI_DISABLE   0x08
+
 //
 // Kernel Exports
 //