https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c89a190ea655b030f4cc9…
commit c89a190ea655b030f4cc91de8b47ead424e9d339
Author: Vadim Galyant <vgal(a)rambler.ru>
AuthorDate: Fri May 11 15:34:49 2018 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Fri May 11 15:46:25 2018 +0200
[USBPORT][USBOHCI_NEW] Avoid using pointers for physical addresses.
---
drivers/usb/usbohci_new/usbohci.c | 12 ++++++------
drivers/usb/usbport/pnp.c | 4 ++--
drivers/usb/usbport/power.c | 2 +-
drivers/usb/usbport/usbport.c | 6 +++---
drivers/usb/usbport/usbport.h | 2 +-
sdk/include/reactos/drivers/usbport/usbmport.h | 8 ++++----
6 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/usb/usbohci_new/usbohci.c b/drivers/usb/usbohci_new/usbohci.c
index 87c3c13838..ef123288b2 100644
--- a/drivers/usb/usbohci_new/usbohci.c
+++ b/drivers/usb/usbohci_new/usbohci.c
@@ -672,8 +672,8 @@ OHCI_StartController(IN PVOID ohciExtension,
return MPStatus;
}
- OhciExtension->HcResourcesVA = Resources->StartVA;
- OhciExtension->HcResourcesPA = Resources->StartPA;
+ OhciExtension->HcResourcesVA = (POHCI_HC_RESOURCES)Resources->StartVA;
+ OhciExtension->HcResourcesPA = (POHCI_HC_RESOURCES)Resources->StartPA;
DPRINT_OHCI("OHCI_StartController: HcResourcesVA - %p, HcResourcesPA -
%p\n",
OhciExtension->HcResourcesVA,
@@ -1731,9 +1731,9 @@ OHCI_AbortTransfer(IN PVOID ohciExtension,
ED = OhciEndpoint->HcdED;
NextTdPA = ED->HwED.HeadPointer & OHCI_ED_HEAD_POINTER_MASK;
- NextTD = RegPacket.UsbPortGetMappedVirtualAddress((PVOID)NextTdPA,
- OhciExtension,
- OhciEndpoint);
+ NextTD = RegPacket.UsbPortGetMappedVirtualAddress(NextTdPA,
+ OhciExtension,
+ OhciEndpoint);
if (NextTD->OhciTransfer == (ULONG)OhciTransfer)
{
@@ -1978,7 +1978,7 @@ OHCI_PollAsyncEndpoint(IN POHCI_EXTENSION OhciExtension,
DbgBreakPoint();
}
- NextTD = RegPacket.UsbPortGetMappedVirtualAddress((PVOID)NextTdPA,
+ NextTD = RegPacket.UsbPortGetMappedVirtualAddress(NextTdPA,
OhciExtension,
OhciEndpoint);
DPRINT_OHCI("NextTD - %p\n", NextTD);
diff --git a/drivers/usb/usbport/pnp.c b/drivers/usb/usbport/pnp.c
index 7b0c5dd20e..52c649e9b5 100644
--- a/drivers/usb/usbport/pnp.c
+++ b/drivers/usb/usbport/pnp.c
@@ -824,8 +824,8 @@ USBPORT_StartDevice(IN PDEVICE_OBJECT FdoDevice,
goto ExitWithError;
}
- UsbPortResources->StartVA = (PVOID)HeaderBuffer->VirtualAddress;
- UsbPortResources->StartPA = (PVOID)HeaderBuffer->PhysicalAddress;
+ UsbPortResources->StartVA = HeaderBuffer->VirtualAddress;
+ UsbPortResources->StartPA = HeaderBuffer->PhysicalAddress;
FdoExtension->MiniPortCommonBuffer = HeaderBuffer;
}
diff --git a/drivers/usb/usbport/power.c b/drivers/usb/usbport/power.c
index 0dca45334d..9fcb2aa5e6 100644
--- a/drivers/usb/usbport/power.c
+++ b/drivers/usb/usbport/power.c
@@ -197,7 +197,7 @@ USBPORT_ResumeController(IN PDEVICE_OBJECT FdoDevice)
RtlZeroMemory(FdoExtension->MiniPortExt, Packet->MiniPortExtensionSize);
- RtlZeroMemory(FdoExtension->UsbPortResources.StartVA,
+ RtlZeroMemory((PVOID)FdoExtension->UsbPortResources.StartVA,
Packet->MiniPortResourcesSize);
FdoExtension->UsbPortResources.IsChirpHandled = TRUE;
diff --git a/drivers/usb/usbport/usbport.c b/drivers/usb/usbport/usbport.c
index cc85e73bca..9961063209 100644
--- a/drivers/usb/usbport/usbport.c
+++ b/drivers/usb/usbport/usbport.c
@@ -1696,7 +1696,7 @@ USBPORT_AllocateCommonBuffer(IN PDEVICE_OBJECT FdoDevice,
PHYSICAL_ADDRESS LogicalAddress;
ULONG_PTR BaseVA;
ULONG_PTR StartBufferVA;
- ULONG_PTR StartBufferPA;
+ ULONG StartBufferPA;
DPRINT("USBPORT_AllocateCommonBuffer: FdoDevice - %p, BufferLength -
%p\n",
FdoDevice,
@@ -2108,7 +2108,7 @@ USBPORT_RequestAsyncCallback(IN PVOID MiniPortExtension,
PVOID
NTAPI
-USBPORT_GetMappedVirtualAddress(IN PVOID PhysicalAddress,
+USBPORT_GetMappedVirtualAddress(IN ULONG PhysicalAddress,
IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint)
{
@@ -2129,7 +2129,7 @@ USBPORT_GetMappedVirtualAddress(IN PVOID PhysicalAddress,
HeaderBuffer = Endpoint->HeaderBuffer;
- Offset = (ULONG_PTR)PhysicalAddress - HeaderBuffer->PhysicalAddress;
+ Offset = PhysicalAddress - HeaderBuffer->PhysicalAddress;
VirtualAddress = HeaderBuffer->VirtualAddress + Offset;
return (PVOID)VirtualAddress;
diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h
index 7895b97bde..d09edb1b31 100644
--- a/drivers/usb/usbport/usbport.h
+++ b/drivers/usb/usbport/usbport.h
@@ -148,7 +148,7 @@ typedef struct _USBPORT_COMMON_BUFFER_HEADER {
PHYSICAL_ADDRESS LogicalAddress;
SIZE_T BufferLength;
ULONG_PTR VirtualAddress;
- ULONG_PTR PhysicalAddress;
+ ULONG PhysicalAddress;
} USBPORT_COMMON_BUFFER_HEADER, *PUSBPORT_COMMON_BUFFER_HEADER;
typedef struct _USBPORT_ENDPOINT *PUSBPORT_ENDPOINT;
diff --git a/sdk/include/reactos/drivers/usbport/usbmport.h
b/sdk/include/reactos/drivers/usbport/usbmport.h
index 23a7e91e9a..0b1387179e 100644
--- a/sdk/include/reactos/drivers/usbport/usbmport.h
+++ b/sdk/include/reactos/drivers/usbport/usbmport.h
@@ -54,8 +54,8 @@ typedef struct _USBPORT_RESOURCES {
ULONG Reserved;
PVOID ResourceBase;
SIZE_T IoSpaceLength;
- PVOID StartVA;
- PVOID StartPA;
+ ULONG_PTR StartVA;
+ ULONG StartPA;
UCHAR LegacySupport;
BOOLEAN IsChirpHandled;
UCHAR Reserved2;
@@ -76,7 +76,7 @@ typedef struct _USBPORT_ENDPOINT_PROPERTIES {
ULONG TransferType;
ULONG Direction;
ULONG_PTR BufferVA;
- ULONG_PTR BufferPA;
+ ULONG BufferPA;
ULONG BufferLength;
ULONG Reserved3;
ULONG MaxTransferSize;
@@ -454,7 +454,7 @@ typedef ULONG
typedef PVOID
(NTAPI *PUSBPORT_GET_MAPPED_VIRTUAL_ADDRESS)(
- PVOID,
+ ULONG,
PVOID,
PVOID);