[USBPORT][USBOHCI_NEW] Avoid using pointers for physical addresses.
authorVadim Galyant <vgal@rambler.ru>
Fri, 11 May 2018 13:34:49 +0000 (15:34 +0200)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 11 May 2018 13:46:25 +0000 (15:46 +0200)
drivers/usb/usbohci_new/usbohci.c
drivers/usb/usbport/pnp.c
drivers/usb/usbport/power.c
drivers/usb/usbport/usbport.c
drivers/usb/usbport/usbport.h
sdk/include/reactos/drivers/usbport/usbmport.h

index 87c3c13..ef12328 100644 (file)
@@ -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);
index 7b0c5dd..52c649e 100644 (file)
@@ -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;
     }
index 0dca453..9fcb2aa 100644 (file)
@@ -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;
index cc85e73..9961063 100644 (file)
@@ -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;
index 7895b97..d09edb1 100644 (file)
@@ -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;
index 23a7e91..0b13871 100644 (file)
@@ -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);