Added system and isa bus handler
authorEric Kohl <eric.kohl@reactos.org>
Sun, 9 Apr 2000 15:58:13 +0000 (15:58 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 9 Apr 2000 15:58:13 +0000 (15:58 +0000)
svn path=/trunk/; revision=1115

reactos/include/internal/i386/hal.h
reactos/include/internal/ke.h
reactos/ntoskrnl/hal/x86/bios32.c
reactos/ntoskrnl/hal/x86/bus.c
reactos/ntoskrnl/hal/x86/halinit.c
reactos/ntoskrnl/hal/x86/irq.c
reactos/ntoskrnl/hal/x86/isa.c
reactos/ntoskrnl/hal/x86/misc.c
reactos/ntoskrnl/hal/x86/sources
reactos/ntoskrnl/hal/x86/sysbus.c [new file with mode: 0644]
reactos/ntoskrnl/hal/x86/time.c

index 82b8473..a7b2d54 100644 (file)
@@ -80,17 +80,11 @@ VOID HalResetDisplay (VOID);
 VOID
 HalpInitBusHandlers (VOID);
 
-ULONG
-STDCALL
-HalpGetSystemInterruptVector (
-       PVOID BusHandler,
-       ULONG BusNumber,
-       ULONG BusInterruptLevel,
-       ULONG BusInterruptVector,
-       PKIRQL Irql,
-       PKAFFINITY Affinity
-       );
-
+/* udelay.c */
 VOID HalpCalibrateStallExecution(VOID);
 
+/* irq.c */
+VOID HalpInitIRQs (VOID);
+
+
 #endif /* __INTERNAL_HAL_HAL_H */
index 6cda198..9c7e6a5 100644 (file)
@@ -38,11 +38,9 @@ VOID KeRemoveAllWaitsThread(PETHREAD Thread, NTSTATUS WaitStatus);
 /* INITIALIZATION FUNCTIONS *************************************************/
 
 VOID KeInitExceptions(VOID);
-VOID KeInitIRQ(VOID);
 VOID KeInitTimer(VOID);
 VOID KeInitDpc(VOID);
 VOID KeInitDispatcher(VOID);
-VOID KeCalibrateTimerLoop(VOID);
 VOID KeInitializeDispatcher(VOID);
 VOID KeInitializeTimerImpl(VOID);
 VOID KeInitializeBugCheck(VOID);
index ee0f561..a449ed3 100644 (file)
@@ -120,18 +120,20 @@ VOID Hal_bios32_probe()
  * RETURNS: True if detected
  */
 {
+   DbgPrint ("Hal_bios32_probe()\n");
+
    return;
 #if 0
    int i;
    
    for (i=0xe0000;i<=0xffff0;i++)
      {
-///    bios32* service_entry = (bios32 *)physical_to_linear(i);
+       bios32* service_entry = (bios32 *)physical_to_linear(i);
        if ( service_entry->signature != BIOS32_SIGNATURE )
          {
             continue;
          }
-//        DbgPrint("Signature detected at %x\n",i);
+        DbgPrint("Signature detected at %x\n",i);
        if (!checksum(service_entry))
          {
             continue;
index 4625b81..c3a3c6b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: bus.c,v 1.4 2000/03/20 17:59:41 ekohl Exp $
+/* $Id: bus.c,v 1.5 2000/04/09 15:58:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -24,6 +24,7 @@
 
 /* TYPE DEFINITIONS *********************************************************/
 
+
 struct _BUS_HANDLER;
 
 typedef NTSTATUS (STDCALL *pAdjustResourceList) (
@@ -87,6 +88,40 @@ typedef struct _BUS_HANDLER
 } BUS_HANDLER, *PBUS_HANDLER;
 
 
+/* sysbus.h */
+ULONG
+STDCALL
+HalpGetSystemInterruptVector (
+       PVOID BusHandler,
+       ULONG BusNumber,
+       ULONG BusInterruptLevel,
+       ULONG BusInterruptVector,
+       PKIRQL Irql,
+       PKAFFINITY Affinity
+       );
+
+BOOLEAN
+STDCALL
+HalpTranslateSystemBusAddress (
+       PBUS_HANDLER            BusHandler,
+       ULONG                   BusNumber,
+       PHYSICAL_ADDRESS        BusAddress,
+       PULONG                  AddressSpace,
+       PPHYSICAL_ADDRESS       TranslatedAddress
+       );
+
+/* isa.c */
+BOOLEAN
+STDCALL
+HalpTranslateIsaBusAddress (
+       PBUS_HANDLER            BusHandler,
+       ULONG                   BusNumber,
+       PHYSICAL_ADDRESS        BusAddress,
+       PULONG                  AddressSpace,
+       PPHYSICAL_ADDRESS       TranslatedAddress
+       );
+
+
 /* GLOBAL VARIABLES **********************************************************/
 
 KSPIN_LOCK HalpBusHandlerSpinLock = {0,};
@@ -235,8 +270,8 @@ HalpInitBusHandlers (VOID)
                                             0);
        BusHandler->GetInterruptVector =
                (pGetInterruptVector)HalpGetSystemInterruptVector;
-//     BusHandler->TranslateBusAddress =
-//             (pTranslateBusAddress)HalpTranslateSystemBusAddress;
+       BusHandler->TranslateBusAddress =
+               (pTranslateBusAddress)HalpTranslateSystemBusAddress;
 
        /* cmos bus handler */
        BusHandler = HalpAllocateBusHandler (InterfaceTypeUndefined,
@@ -247,6 +282,14 @@ HalpInitBusHandlers (VOID)
 //     BusHandler->SetBusData =
 //             (pGetSetBusData)HalpSetCmosData;
 
+       /* isa bus handler */
+       BusHandler = HalpAllocateBusHandler (Isa,
+                                            ConfigurationSpaceUndefined,
+                                            0);
+       BusHandler->TranslateBusAddress =
+               (pTranslateBusAddress)HalpTranslateIsaBusAddress;
+
+#if 0
        /* pci bus handler */
        BusHandler = HalpAllocateBusHandler (PCIBus,
                                             PCIConfiguration,
@@ -261,13 +304,7 @@ HalpInitBusHandlers (VOID)
 //             (pGetSetBusData)HalpAdjustPciResourceList;
 //     BusHandler->AssignSlotResources =
 //             (pGetSetBusData)HalpAssignPciSlotResources;
-
-       /* isa bus handler */
-       BusHandler = HalpAllocateBusHandler (Isa,
-                                            ConfigurationSpaceUndefined,
-                                            0);
-//     BusHandler->TranslateBusAddress =
-//             (pTranslateBusAddress)HalpTranslateIsaBusAddress;
+#endif
 }
 
 
index b911670..bd60ef6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: halinit.c,v 1.10 2000/04/08 19:08:50 ekohl Exp $
+/* $Id: halinit.c,v 1.11 2000/04/09 15:58:13 ekohl Exp $
  *
  * COPYRIGHT:     See COPYING in the top level directory
  * PROJECT:       ReactOS kernel
@@ -32,30 +32,14 @@ HalInitSystem (
    {
       HalInitializeDisplay (bp);
       HalpCalibrateStallExecution ();
-      KeInitExceptions();
-      KeInitIRQ();
+      KeInitExceptions ();
+      HalpInitIRQs ();
       KeLowerIrql(DISPATCH_LEVEL);
    }
    else
    {
       HalpInitBusHandlers ();
 
-      /*
-       * Probe for a BIOS32 extension
-       */
-      Hal_bios32_probe();
-   
-      /*
-       * Probe for buses attached to the computer
-       * NOTE: Order is important here because ISA is the default
-       */
-#if 0
-      if (HalPciProbe())
-      {
-           return TRUE;
-      }
-      HalIsaProbe();
-#endif
    }
 
    return TRUE;
index 7fa616d..aeb1808 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.10 2000/03/26 19:38:18 ea Exp $
+/* $Id: irq.c,v 1.11 2000/04/09 15:58:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -6,7 +6,7 @@
  * PURPOSE:         IRQ handling
  * PROGRAMMER:      David Welch (welch@mcmail.com)
  * UPDATE HISTORY:
- *             29/05/98: Created                  
+ *             29/05/98: Created
  */
 
 /*
@@ -187,11 +187,11 @@ asmlinkage VOID KiInterruptDispatch(ULONG irq)
 //   DbgPrint("}");
 }
 
-void KeInitIRQ(void)
+VOID HalpInitIRQs (VOID)
 {
    int i;
    
-   DPRINT("KeInitIrq()\n",0);
+   DPRINT("HalpInitIRQs ()\n",0);
    
    /*
     * First mask off all interrupts from pic
@@ -370,50 +370,27 @@ IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
    KeLowerIrql(oldlvl);
 }
 
+#if 0
 ULONG
 STDCALL
-HalpGetSystemInterruptVector(PVOID BusHandler,
-                           ULONG BusNumber,
-                           ULONG BusInterruptLevel,
-                           ULONG BusInterruptVector,
-                           PKIRQL Irql,
-                           PKAFFINITY Affinity)
-/*
- * FUNCTION: Returns a mapped system interrupt vector for passing to
- * IoConnectInterrupt
- * ARGUMENTS:
- *          InterfaceType = Type bus the device is on
- *          BusNumber = Zero based number of the bus
- *          BusInterruptLevel = Bus specific interrupt level
- *          BusInterruptVector = Bus specific interrupt vector
- *          Irql (IN/OUT) = On entry the bus relative IRQL
- *                          On exit the DIRQL
- *          Affinity (OUT) = Caller supplied storage for the interrupt 
- *                           affinity mask
- * RETURNS: The mapped vector
- */
+HalDisableSystemInterrupt (
+       ULONG   Unknown0,
+       ULONG   Unknown1
+       )
 {
-   ULONG ret;
-   
-//   ASSERT_IRQL(PASSIVE_LEVEL);
-   
-#if 0
-   switch (InterfaceType)
-     {
-      case Internal:
-#endif
-       *Irql = HIGH_LEVEL -  BusInterruptVector;
-       ret = BusInterruptVector;
-#if 0
-       break;
-       
-      default:
-       ret = -1;
-       DbgPrint("(%s:%d) Don't know that bus type\n",__FILE__,__LINE__);
-       break;
-     }
-#endif
-   return(ret);
+
+}
+
+ULONG
+STDCALL
+HalEnableSystemInterrupt (
+       ULONG   Unknown0,
+       ULONG   Unknown1,
+       ULONG   Unknown2
+       )
+{
+
 }
+#endif
 
 /* EOF */
index 8428f6e..bdba175 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: isa.c,v 1.5 2000/03/20 17:59:42 ekohl Exp $
+/* $Id: isa.c,v 1.6 2000/04/09 15:58:13 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 #include <ddk/ntddk.h>
 
+
+typedef struct _BUS_HANDLER *PBUS_HANDLER;
+
+
 /* FUNCTIONS *****************************************************************/
 
 BOOL HalIsaProbe(VOID)
@@ -31,7 +35,7 @@ BOOL HalIsaProbe(VOID)
    return(TRUE);
 }
 
-#if 0
+
 BOOLEAN
 STDCALL
 HalpTranslateIsaBusAddress (
@@ -44,19 +48,16 @@ HalpTranslateIsaBusAddress (
 {
        BOOLEAN Result;
 
-       Result = HalpTranslateSystemBusAddress (BusHandler,
-                                               BusNumber,
-                                               BusAddress,
-                                               AddressSpace,
-                                               TranslatedAddress);
-       if (Result != FALSE)
-               return Result;
+       Result = HalTranslateBusAddress (PCIBus,
+                                        BusNumber,
+                                        BusAddress,
+                                        AddressSpace,
+                                        TranslatedAddress);
 
-       /* PCI does not provide memory address space */
-       if (*AddressSpace == 0)
+       if (Result != FALSE)
                return Result;
 
-       Result = HalTranslateBusAddress (PCIBus,
+       Result = HalTranslateBusAddress (Internal,
                                         BusNumber,
                                         BusAddress,
                                         AddressSpace,
@@ -64,6 +65,5 @@ HalpTranslateIsaBusAddress (
 
        return Result;
 }
-#endif
 
 /* EOF */
index 318a81d..c8c6679 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.3 2000/04/08 19:08:50 ekohl Exp $
+/* $Id: misc.c,v 1.4 2000/04/09 15:58:13 ekohl Exp $
  *
  * COPYRIGHT:             See COPYING in the top level directory
  * PROJECT:               ReactOS kernel
@@ -71,9 +71,26 @@ HalReportResourceUsage (
 {
        /*
         * FIXME: Report all resources used by hal.
-                 Calls IoReportHalResourceUsage()
+        *        Calls IoReportHalResourceUsage()
         */
 
+       /*
+        * Initialize PCI, IsaPnP and other busses.
+        */
+
+#if 0
+      /*
+       * Probe for a BIOS32 extension
+       */
+      Hal_bios32_probe();
+   
+      /*
+       * Probe for buses attached to the computer
+       */
+
+      HalPciProbe();
+#endif
+
        return;
 }
 
index abb46bf..998d4ab 100644 (file)
@@ -5,4 +5,5 @@ HAL_OBJECTS = hal/x86/irq.o hal/x86/isa.o \
   hal/x86/sysinfo.o hal/x86/time.o hal/x86/beep.o \
   hal/x86/display.o hal/x86/reboot.o hal/x86/kdbg.o \
   hal/x86/portio.o hal/x86/misc.o hal/x86/parttab.o \
-  hal/x86/adapter.o hal/x86/drive.o hal/x86/udelay.o
+  hal/x86/adapter.o hal/x86/drive.o hal/x86/udelay.o \
+  hal/x86/sysbus.o
diff --git a/reactos/ntoskrnl/hal/x86/sysbus.c b/reactos/ntoskrnl/hal/x86/sysbus.c
new file mode 100644 (file)
index 0000000..38290b4
--- /dev/null
@@ -0,0 +1,71 @@
+/* $Id: sysbus.c,v 1.1 2000/04/09 15:58:13 ekohl Exp $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/hal/sysbus.c
+ * PURPOSE:         System bus handler functions
+ * PROGRAMMER:      Eric Kohl (ekohl@rz-online.de)
+ * UPDATE HISTORY:
+ *                  09/04/2000 Created
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ddk/ntddk.h>
+
+
+typedef struct _BUS_HANDLER *PBUS_HANDLER;
+
+
+/* FUNCTIONS ****************************************************************/
+
+ULONG
+STDCALL
+HalpGetSystemInterruptVector (
+       PVOID           BusHandler,
+       ULONG           BusNumber,
+       ULONG           BusInterruptLevel,
+       ULONG           BusInterruptVector,
+       PKIRQL          Irql,
+       PKAFFINITY      Affinity
+       )
+{
+       *Irql = HIGH_LEVEL - BusInterruptVector;
+       return BusInterruptVector;
+}
+
+
+BOOLEAN
+STDCALL
+HalpTranslateSystemBusAddress (
+       PBUS_HANDLER            BusHandler,
+       ULONG                   BusNumber,
+       PHYSICAL_ADDRESS        BusAddress,
+       PULONG                  AddressSpace,
+       PPHYSICAL_ADDRESS       TranslatedAddress
+       )
+{
+       ULONG BaseAddress = 0;
+
+       if (*AddressSpace == 0)
+       {
+               /* memory space */
+
+       }
+       else if (*AddressSpace == 1)
+       {
+               /* io space */
+
+       }
+       else
+       {
+               /* other */
+               return FALSE;
+       }
+
+       TranslatedAddress->QuadPart = BusAddress.QuadPart + BaseAddress;
+
+       return TRUE;
+}
+
+/* EOF */
index 4262b52..f7707e7 100644 (file)
@@ -1,4 +1,6 @@
-/* * COPYRIGHT:       See COPYING in the top level directory * PROJECT:         ReactOS kernel
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/hal/x86/time.c
  * PURPOSE:         Getting time information
  * UPDATE HISTORY: