Author: sir_richard
Date: Mon Jun 7 22:34:41 2010
New Revision: 47672
URL:
http://svn.reactos.org/svn/reactos?rev=47672&view=rev
Log:
[HAL]: Implement system bus (and ISA) vector/interrupt translation.
Modified:
trunk/reactos/hal/halx86/generic/legacy/bus/sysbus.c
Modified: trunk/reactos/hal/halx86/generic/legacy/bus/sysbus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bus/sysbus.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bus/sysbus.c [iso-8859-1] Mon Jun 7 22:34:41
2010
@@ -31,6 +31,35 @@
ULONG
NTAPI
+HalpGetRootInterruptVector(IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
+{
+ ULONG SystemVector;
+
+ /* Get the system vector */
+ SystemVector = PRIMARY_VECTOR_BASE + BusInterruptLevel;
+
+ /* Validate it */
+ if ((SystemVector < PRIMARY_VECTOR_BASE) || (SystemVector > PRIMARY_VECTOR_BASE
+ 27))
+ {
+ /* Invalid vector */
+ DPRINT1("Vector %lx is too low or too high!\n", SystemVector);
+ return 0;
+ }
+
+ /* Return the IRQL and affinity */
+ *Irql = (PRIMARY_VECTOR_BASE + 27) - SystemVector;
+ *Affinity = HalpDefaultInterruptAffinity;
+ ASSERT(HalpDefaultInterruptAffinity);
+
+ /* Return the vector */
+ return SystemVector;
+}
+
+ULONG
+NTAPI
HalpGetSystemInterruptVector(IN PBUS_HANDLER BusHandler,
IN PBUS_HANDLER RootHandler,
IN ULONG BusInterruptLevel,
@@ -38,10 +67,17 @@
OUT PKIRQL Irql,
OUT PKAFFINITY Affinity)
{
+ ULONG Vector;
+
/* Get the root vector */
- DPRINT1("SYSTEM GetVector\n");
- while (TRUE);
- return 0;
+ Vector = HalpGetRootInterruptVector(BusInterruptLevel,
+ BusInterruptVector,
+ Irql,
+ Affinity);
+
+ /* Check if the vector is owned by the HAL and fail if it is */
+ if (HalpIDTUsageFlags[Vector].Flags & IDT_REGISTERED) DPRINT1("Vector %lx is
ALREADY IN USE!\n", Vector);
+ return (HalpIDTUsageFlags[Vector].Flags & IDT_REGISTERED) ? 0 : Vector;
}
/* EOF */