Author: akhaldi
Date: Mon Jun 7 23:19:24 2010
New Revision: 47682
URL: http://svn.reactos.org/svn/reactos?rev=47682&view=rev
Log:
[PSDK]
- Update/improve some usb related headers' headers.
Modified:
branches/header-work/include/psdk/usb.h
branches/header-work/include/psdk/usb100.h
branches/header-work/include/psdk/usb200.h
branches/header-work/include/psdk/usbcamdi.h
branches/header-work/include/psdk/usbdi.h
branches/header-work/include/psdk/usbioctl.h
branches/header-work/include/psdk/usbiodef.h
branches/header-work/include/psdk/usbrpmif.h
branches/header-work/include/psdk/usbuser.h
Modified: branches/header-work/include/psdk/usb.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usb.h?…
==============================================================================
--- branches/header-work/include/psdk/usb.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usb.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -1,6 +1,26 @@
+/*
+ * usb.h
+ *
+ * This file is part of the ReactOS PSDK package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
#pragma once
-/* Helper macro to enable gcc's extension. */
+/* Helper macro to enable gcc's extension. */
#ifndef __GNU_EXTENSION
#ifdef __GNUC__
#define __GNU_EXTENSION __extension__
Modified: branches/header-work/include/psdk/usb100.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usb100…
==============================================================================
--- branches/header-work/include/psdk/usb100.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usb100.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -3,7 +3,7 @@
*
* USB 1.0 support
*
- * This file is part of the w32api package.
+ * This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
Modified: branches/header-work/include/psdk/usb200.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usb200…
==============================================================================
--- branches/header-work/include/psdk/usb200.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usb200.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -1,6 +1,26 @@
+/*
+ * usb200.h
+ *
+ * This file is part of the ReactOS PSDK package.
+ *
+ * Contributors:
+ * Magnus Olsen.
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
#pragma once
-/* Helper macro to enable gcc's extension. */
+/* Helper macro to enable gcc's extension. */
#ifndef __GNU_EXTENSION
#ifdef __GNUC__
#define __GNU_EXTENSION __extension__
Modified: branches/header-work/include/psdk/usbcamdi.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbcam…
==============================================================================
--- branches/header-work/include/psdk/usbcamdi.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbcamdi.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -3,7 +3,7 @@
*
* USB Camera driver interface.
*
- * This file is part of the w32api package.
+ * This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
Modified: branches/header-work/include/psdk/usbdi.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbdi.…
==============================================================================
--- branches/header-work/include/psdk/usbdi.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbdi.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -5,7 +5,7 @@
*
* FIXME : Obsolete header.. Use usb.h instead.
*
- * This file is part of the w32api package.
+ * This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
Modified: branches/header-work/include/psdk/usbioctl.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbioc…
==============================================================================
--- branches/header-work/include/psdk/usbioctl.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbioctl.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -3,7 +3,7 @@
*
* USB IOCTL interface.
*
- * This file is part of the w32api package.
+ * This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
Modified: branches/header-work/include/psdk/usbiodef.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbiod…
==============================================================================
--- branches/header-work/include/psdk/usbiodef.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbiodef.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -1,3 +1,23 @@
+/*
+ * usbiodef.h
+ *
+ * This file is part of the ReactOS PSDK package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
#pragma once
#define USB_SUBMIT_URB 0
Modified: branches/header-work/include/psdk/usbrpmif.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbrpm…
==============================================================================
--- branches/header-work/include/psdk/usbrpmif.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbrpmif.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -1,3 +1,23 @@
+/*
+ * usbrpmif.h
+ *
+ * This file is part of the ReactOS PSDK package.
+ *
+ * Contributors:
+ * Created by Amine Khaldi <amine.khaldi(a)reactos.org>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
#pragma once
#include "windef.h"
Modified: branches/header-work/include/psdk/usbuser.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/psdk/usbuse…
==============================================================================
--- branches/header-work/include/psdk/usbuser.h [iso-8859-1] (original)
+++ branches/header-work/include/psdk/usbuser.h [iso-8859-1] Mon Jun 7 23:19:24 2010
@@ -3,7 +3,7 @@
*
* USB user mode IOCTL interface
*
- * This file is part of the w32api package.
+ * This file is part of the ReactOS PSDK package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns(a)users.sourceforge.net>
Author: sir_richard
Date: Mon Jun 7 23:01:53 2010
New Revision: 47679
URL: http://svn.reactos.org/svn/reactos?rev=47679&view=rev
Log:
[HAL]: Implement HalTranslateBusAddress using Bus Handler support. The old HAL would just return whatever the caller gave (no translation was done). For example, with the new HAL, this now results in the translation of 0xCF800 in I/O space to fail (not sure which driver requests this), because this is not a valid I/O address on PC/AT systems (highest is 0xFFFF).
This change also allows for the PCI driver to override the translation mechanism (which will piggy-back to the system bus translator) with its own. Please test.
Modified:
trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c
trunk/reactos/hal/halx86/generic/legacy/bussupp.c
trunk/reactos/hal/halx86/include/bus.h
Modified: trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c [iso-8859-1] Mon Jun 7 23:01:53 2010
@@ -407,13 +407,12 @@
HalDereferenceBusHandler = HaliDereferenceBusHandler;
#endif
HalPciAssignSlotResources = HalpAssignSlotResources;
+ HalPciTranslateBusAddress = HaliTranslateBusAddress; /* PCI Driver can override */
/* FIXME: Fix later */
#if 0
- HalPciTranslateBusAddress = HaliTranslateBusAddress;
if (!HalFindBusAddressTranslation) HalFindBusAddressTranslation = HaliFindBusAddressTranslation;
#else
/* These should be written by the PCI driver later, but we give defaults */
- HalPciTranslateBusAddress = HalpTranslateBusAddress;
HalFindBusAddressTranslation = HalpFindBusAddressTranslation;
#endif
}
Modified: trunk/reactos/hal/halx86/generic/legacy/bussupp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] Mon Jun 7 23:01:53 2010
@@ -1196,6 +1196,37 @@
return TRUE;
}
+BOOLEAN
+NTAPI
+HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ PBUS_HANDLER Handler;
+ BOOLEAN Status;
+
+ /* Find the handler */
+ Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber);
+ if (!(Handler) || !(Handler->TranslateBusAddress))
+ {
+ DPRINT1("No translator!\n");
+ return FALSE;
+ }
+
+ /* Do the assignment */
+ Status = Handler->TranslateBusAddress(Handler,
+ Handler,
+ BusAddress,
+ AddressSpace,
+ TranslatedAddress);
+
+ /* Dereference the handler and return */
+ HalDereferenceBusHandler(Handler);
+ return Status;
+}
+
/* PUBLIC FUNCTIONS **********************************************************/
/*
@@ -1423,9 +1454,12 @@
}
else
{
- /* Translation is easy */
- TranslatedAddress->QuadPart = BusAddress.QuadPart;
- return TRUE;
+ /* Call the bus handler */
+ return HaliTranslateBusAddress(InterfaceType,
+ BusNumber,
+ BusAddress,
+ AddressSpace,
+ TranslatedAddress);
}
}
Modified: trunk/reactos/hal/halx86/include/bus.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/bus.h?r…
==============================================================================
--- trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] Mon Jun 7 23:01:53 2010
@@ -368,7 +368,7 @@
BOOLEAN
NTAPI
-HalpTranslateBusAddress(
+HaliTranslateBusAddress(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,
Author: sir_richard
Date: Mon Jun 7 22:59:00 2010
New Revision: 47677
URL: http://svn.reactos.org/svn/reactos?rev=47677&view=rev
Log:
[HAL]: Implement system bus address 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:59:00 2010
@@ -24,8 +24,89 @@
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress)
{
- DPRINT1("SYSTEM Translate\n");
- while (TRUE);
+ PSUPPORTED_RANGE Range = NULL;
+
+ /* Check what kind of address space this is */
+ switch (*AddressSpace)
+ {
+ /* Memory address */
+ case 0:
+
+ /* Loop all prefetech memory */
+ for (Range = &BusHandler->BusAddresses->PrefetchMemory;
+ Range;
+ Range = Range->Next)
+ {
+ /* Check if it's in a valid range */
+ if ((BusAddress.QuadPart >= Range->Base) &&
+ (BusAddress.QuadPart <= Range->Limit))
+ {
+ /* Get out */
+ break;
+ }
+ }
+
+ /* Check if we haven't found anything yet */
+ if (!Range)
+ {
+ /* Loop all bus memory */
+ for (Range = &BusHandler->BusAddresses->Memory;
+ Range;
+ Range = Range->Next)
+ {
+ /* Check if it's in a valid range */
+ if ((BusAddress.QuadPart >= Range->Base) &&
+ (BusAddress.QuadPart <= Range->Limit))
+ {
+ /* Get out */
+ break;
+ }
+ }
+ }
+
+ /* Done */
+ break;
+
+ /* I/O Space */
+ case 1:
+
+ /* Loop all bus I/O memory */
+ for (Range = &BusHandler->BusAddresses->IO;
+ Range;
+ Range = Range->Next)
+ {
+ /* Check if it's in a valid range */
+ if ((BusAddress.QuadPart >= Range->Base) &&
+ (BusAddress.QuadPart <= Range->Limit))
+ {
+ /* Get out */
+ break;
+ }
+ }
+
+ /* Done */
+ break;
+ }
+
+ /* Check if we found a range */
+ if (Range)
+ {
+ /* Do the translation and return the kind of address space this is */
+ TranslatedAddress->QuadPart = BusAddress.QuadPart + Range->SystemBase;
+ if ((TranslatedAddress->QuadPart != BusAddress.QuadPart) ||
+ (*AddressSpace != Range->SystemAddressSpace))
+ {
+ /* Different than what the old HAL would do */
+ DPRINT1("Translation of %I64x is %I64x %s\n",
+ BusAddress.QuadPart, TranslatedAddress->QuadPart,
+ Range->SystemAddressSpace ? "In I/O Space" : "In RAM");
+ }
+ *AddressSpace = Range->SystemAddressSpace;
+ return TRUE;
+ }
+
+ /* Nothing found */
+ DPRINT1("Translation of %I64x failed!\n", BusAddress.QuadPart);
return FALSE;
}
Author: sir_richard
Date: Mon Jun 7 22:39:11 2010
New Revision: 47676
URL: http://svn.reactos.org/svn/reactos?rev=47676&view=rev
Log:
[HAL]: Implement Bus Handler support for HalGetInterruptVector too. The new functionality now includes support for checking against reserved HAL vectors instead of blindling assining IRQLs/Vectors to callers. A warning is printed on the debug log when the old HAL would've returned different values. Please test. If you have issues, the problem is in the DRIVERS, not this code.
Modified:
trunk/reactos/hal/halx86/generic/legacy/bussupp.c
Modified: trunk/reactos/hal/halx86/generic/legacy/bussupp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] Mon Jun 7 22:39:11 2010
@@ -1163,10 +1163,10 @@
ULONG
NTAPI
HalpGetSystemInterruptVector_Acpi(IN ULONG BusNumber,
- IN ULONG BusInterruptLevel,
- IN ULONG BusInterruptVector,
- OUT PKIRQL Irql,
- OUT PKAFFINITY Affinity)
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
{
ULONG Vector = IRQ2VECTOR(BusInterruptLevel);
*Irql = (KIRQL)VECTOR2IRQL(Vector);
@@ -1314,12 +1314,38 @@
OUT PKIRQL Irql,
OUT PKAFFINITY Affinity)
{
- /* Call the system bus translator */
- return HalpGetSystemInterruptVector_Acpi(BusNumber,
- BusInterruptLevel,
- BusInterruptVector,
- Irql,
- Affinity);
+ PBUS_HANDLER Handler;
+ ULONG Vector;
+ PAGED_CODE();
+
+ /* Defaults */
+ *Irql = 0;
+ *Affinity = 0;
+
+ /* Find the handler */
+ Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber);
+ if (!Handler) return 0;
+
+ /* Do the assignment */
+ Vector = Handler->GetInterruptVector(Handler,
+ Handler,
+ BusInterruptLevel,
+ BusInterruptVector,
+ Irql,
+ Affinity);
+ if ((Vector != IRQ2VECTOR(BusInterruptLevel)) ||
+ (*Irql != VECTOR2IRQL(IRQ2VECTOR(BusInterruptLevel))))
+ {
+ DPRINT1("Returning IRQL %lx, Vector %lx for Level/Vector: %lx/%lx\n",
+ *Irql, Vector, BusInterruptLevel, BusInterruptVector);
+ DPRINT1("Old HAL would've returned IRQL %lx and Vector %lx\n",
+ VECTOR2IRQL(IRQ2VECTOR(BusInterruptLevel)),
+ IRQ2VECTOR(BusInterruptLevel));
+ }
+
+ /* Dereference the handler and return */
+ HalDereferenceBusHandler(Handler);
+ return Vector;
}
/*