[USBPORT][USBOHCI_NEW] Avoid using pointers for physical addresses.

This commit is contained in:
Vadim Galyant 2018-05-11 15:34:49 +02:00 committed by Thomas Faber
parent 837411e292
commit c89a190ea6
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
6 changed files with 17 additions and 17 deletions

View file

@ -672,8 +672,8 @@ OHCI_StartController(IN PVOID ohciExtension,
return MPStatus; return MPStatus;
} }
OhciExtension->HcResourcesVA = Resources->StartVA; OhciExtension->HcResourcesVA = (POHCI_HC_RESOURCES)Resources->StartVA;
OhciExtension->HcResourcesPA = Resources->StartPA; OhciExtension->HcResourcesPA = (POHCI_HC_RESOURCES)Resources->StartPA;
DPRINT_OHCI("OHCI_StartController: HcResourcesVA - %p, HcResourcesPA - %p\n", DPRINT_OHCI("OHCI_StartController: HcResourcesVA - %p, HcResourcesPA - %p\n",
OhciExtension->HcResourcesVA, OhciExtension->HcResourcesVA,
@ -1731,9 +1731,9 @@ OHCI_AbortTransfer(IN PVOID ohciExtension,
ED = OhciEndpoint->HcdED; ED = OhciEndpoint->HcdED;
NextTdPA = ED->HwED.HeadPointer & OHCI_ED_HEAD_POINTER_MASK; NextTdPA = ED->HwED.HeadPointer & OHCI_ED_HEAD_POINTER_MASK;
NextTD = RegPacket.UsbPortGetMappedVirtualAddress((PVOID)NextTdPA, NextTD = RegPacket.UsbPortGetMappedVirtualAddress(NextTdPA,
OhciExtension, OhciExtension,
OhciEndpoint); OhciEndpoint);
if (NextTD->OhciTransfer == (ULONG)OhciTransfer) if (NextTD->OhciTransfer == (ULONG)OhciTransfer)
{ {
@ -1978,7 +1978,7 @@ OHCI_PollAsyncEndpoint(IN POHCI_EXTENSION OhciExtension,
DbgBreakPoint(); DbgBreakPoint();
} }
NextTD = RegPacket.UsbPortGetMappedVirtualAddress((PVOID)NextTdPA, NextTD = RegPacket.UsbPortGetMappedVirtualAddress(NextTdPA,
OhciExtension, OhciExtension,
OhciEndpoint); OhciEndpoint);
DPRINT_OHCI("NextTD - %p\n", NextTD); DPRINT_OHCI("NextTD - %p\n", NextTD);

View file

@ -824,8 +824,8 @@ USBPORT_StartDevice(IN PDEVICE_OBJECT FdoDevice,
goto ExitWithError; goto ExitWithError;
} }
UsbPortResources->StartVA = (PVOID)HeaderBuffer->VirtualAddress; UsbPortResources->StartVA = HeaderBuffer->VirtualAddress;
UsbPortResources->StartPA = (PVOID)HeaderBuffer->PhysicalAddress; UsbPortResources->StartPA = HeaderBuffer->PhysicalAddress;
FdoExtension->MiniPortCommonBuffer = HeaderBuffer; FdoExtension->MiniPortCommonBuffer = HeaderBuffer;
} }

View file

@ -197,7 +197,7 @@ USBPORT_ResumeController(IN PDEVICE_OBJECT FdoDevice)
RtlZeroMemory(FdoExtension->MiniPortExt, Packet->MiniPortExtensionSize); RtlZeroMemory(FdoExtension->MiniPortExt, Packet->MiniPortExtensionSize);
RtlZeroMemory(FdoExtension->UsbPortResources.StartVA, RtlZeroMemory((PVOID)FdoExtension->UsbPortResources.StartVA,
Packet->MiniPortResourcesSize); Packet->MiniPortResourcesSize);
FdoExtension->UsbPortResources.IsChirpHandled = TRUE; FdoExtension->UsbPortResources.IsChirpHandled = TRUE;

View file

@ -1696,7 +1696,7 @@ USBPORT_AllocateCommonBuffer(IN PDEVICE_OBJECT FdoDevice,
PHYSICAL_ADDRESS LogicalAddress; PHYSICAL_ADDRESS LogicalAddress;
ULONG_PTR BaseVA; ULONG_PTR BaseVA;
ULONG_PTR StartBufferVA; ULONG_PTR StartBufferVA;
ULONG_PTR StartBufferPA; ULONG StartBufferPA;
DPRINT("USBPORT_AllocateCommonBuffer: FdoDevice - %p, BufferLength - %p\n", DPRINT("USBPORT_AllocateCommonBuffer: FdoDevice - %p, BufferLength - %p\n",
FdoDevice, FdoDevice,
@ -2108,7 +2108,7 @@ USBPORT_RequestAsyncCallback(IN PVOID MiniPortExtension,
PVOID PVOID
NTAPI NTAPI
USBPORT_GetMappedVirtualAddress(IN PVOID PhysicalAddress, USBPORT_GetMappedVirtualAddress(IN ULONG PhysicalAddress,
IN PVOID MiniPortExtension, IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint) IN PVOID MiniPortEndpoint)
{ {
@ -2129,7 +2129,7 @@ USBPORT_GetMappedVirtualAddress(IN PVOID PhysicalAddress,
HeaderBuffer = Endpoint->HeaderBuffer; HeaderBuffer = Endpoint->HeaderBuffer;
Offset = (ULONG_PTR)PhysicalAddress - HeaderBuffer->PhysicalAddress; Offset = PhysicalAddress - HeaderBuffer->PhysicalAddress;
VirtualAddress = HeaderBuffer->VirtualAddress + Offset; VirtualAddress = HeaderBuffer->VirtualAddress + Offset;
return (PVOID)VirtualAddress; return (PVOID)VirtualAddress;

View file

@ -148,7 +148,7 @@ typedef struct _USBPORT_COMMON_BUFFER_HEADER {
PHYSICAL_ADDRESS LogicalAddress; PHYSICAL_ADDRESS LogicalAddress;
SIZE_T BufferLength; SIZE_T BufferLength;
ULONG_PTR VirtualAddress; ULONG_PTR VirtualAddress;
ULONG_PTR PhysicalAddress; ULONG PhysicalAddress;
} USBPORT_COMMON_BUFFER_HEADER, *PUSBPORT_COMMON_BUFFER_HEADER; } USBPORT_COMMON_BUFFER_HEADER, *PUSBPORT_COMMON_BUFFER_HEADER;
typedef struct _USBPORT_ENDPOINT *PUSBPORT_ENDPOINT; typedef struct _USBPORT_ENDPOINT *PUSBPORT_ENDPOINT;

View file

@ -54,8 +54,8 @@ typedef struct _USBPORT_RESOURCES {
ULONG Reserved; ULONG Reserved;
PVOID ResourceBase; PVOID ResourceBase;
SIZE_T IoSpaceLength; SIZE_T IoSpaceLength;
PVOID StartVA; ULONG_PTR StartVA;
PVOID StartPA; ULONG StartPA;
UCHAR LegacySupport; UCHAR LegacySupport;
BOOLEAN IsChirpHandled; BOOLEAN IsChirpHandled;
UCHAR Reserved2; UCHAR Reserved2;
@ -76,7 +76,7 @@ typedef struct _USBPORT_ENDPOINT_PROPERTIES {
ULONG TransferType; ULONG TransferType;
ULONG Direction; ULONG Direction;
ULONG_PTR BufferVA; ULONG_PTR BufferVA;
ULONG_PTR BufferPA; ULONG BufferPA;
ULONG BufferLength; ULONG BufferLength;
ULONG Reserved3; ULONG Reserved3;
ULONG MaxTransferSize; ULONG MaxTransferSize;
@ -454,7 +454,7 @@ typedef ULONG
typedef PVOID typedef PVOID
(NTAPI *PUSBPORT_GET_MAPPED_VIRTUAL_ADDRESS)( (NTAPI *PUSBPORT_GET_MAPPED_VIRTUAL_ADDRESS)(
PVOID, ULONG,
PVOID, PVOID,
PVOID); PVOID);