The ULONG_PTR typedef is now removed from the Hyper-V driver code.
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
out = PageAlloc((SendRingBufferSize + RecvRingBufferSize) >> PAGE_SHIFT);
//out = MemAllocZeroed(sendRingBufferSize + recvRingBufferSize);
ASSERT(out);
- ASSERT(((ULONG_PTR)out & (PAGE_SIZE-1)) == 0);
+ ASSERT(((unsigned long)out & (PAGE_SIZE-1)) == 0);
- in = (void*)((ULONG_PTR)out + SendRingBufferSize);
+ in = (void*)((unsigned long)out + SendRingBufferSize);
NewChannel->RingBufferPages = out;
NewChannel->RingBufferPageCount = (SendRingBufferSize + RecvRingBufferSize) >> PAGE_SHIFT;
}
gVmbusConnection.RecvInterruptPage = gVmbusConnection.InterruptPage;
- gVmbusConnection.SendInterruptPage = (void*)((ULONG_PTR)gVmbusConnection.InterruptPage + (PAGE_SIZE >> 1));
+ gVmbusConnection.SendInterruptPage = (void*)((unsigned long)gVmbusConnection.InterruptPage + (PAGE_SIZE >> 1));
// Setup the monitor notification facility. The 1st page for parent->child and the 2nd page for child->parent
gVmbusConnection.MonitorPages = PageAlloc(2);
msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER;
msg->InterruptPage = GetPhysicalAddress(gVmbusConnection.InterruptPage);
msg->MonitorPage1 = GetPhysicalAddress(gVmbusConnection.MonitorPages);
- msg->MonitorPage2 = GetPhysicalAddress((void *)((ULONG_PTR)gVmbusConnection.MonitorPages + PAGE_SIZE));
+ msg->MonitorPage2 = GetPhysicalAddress((void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE));
// Add to list before we send the request since we may receive the response
// before returning from this routine
)
{
VMBUS_CHANNEL* channel;
- u32 relId = (u32)(ULONG_PTR)context;
+ u32 relId = (u32)(unsigned long)context;
ASSERT(relId > 0);
{
//QueueWorkItem(VmbusProcessEvent, (void*)relid);
//ret = WorkQueueQueueWorkItem(gVmbusConnection.workQueue, VmbusProcessChannelEvent, (void*)relid);
- VmbusProcessChannelEvent((void*)(ULONG_PTR)relid);
+ VmbusProcessChannelEvent((void*)(unsigned long)relid);
}
}
}
int maxLeaf;
HV_X64_MSR_HYPERCALL_CONTENTS hypercallMsr;
void* virtAddr=0;
- ULONG_PTR physAddr=0;
+ unsigned long physAddr=0;
DPRINT_ENTER(VMBUS);
goto Cleanup;
}
- gHvContext.SignalEventParam = (PHV_INPUT_SIGNAL_EVENT)(ALIGN_UP((ULONG_PTR)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN));
+ gHvContext.SignalEventParam = (PHV_INPUT_SIGNAL_EVENT)(ALIGN_UP((unsigned long)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN));
gHvContext.SignalEventParam->ConnectionId.Asu32 = 0;
gHvContext.SignalEventParam->ConnectionId.u.Id = VMBUS_EVENT_CONNECTION_ID;
gHvContext.SignalEventParam->FlagNumber = 0;
PHV_INPUT_POST_MESSAGE alignedMsg;
HV_STATUS status;
- ULONG_PTR addr;
+ unsigned long addr;
if (payloadSize > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
{
return -1;
}
- addr = (ULONG_PTR)MemAllocAtomic(sizeof(struct alignedInput));
+ addr = (unsigned long)MemAllocAtomic(sizeof(struct alignedInput));
if (!addr)
{
ret = -1;
goto Cleanup;
}
- ASSERT(((ULONG_PTR)netDevice->ReceiveBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer
+ ASSERT(((unsigned long)netDevice->ReceiveBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer
DPRINT_INFO(NETVSC, "Establishing receive buffer's GPADL...");
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)initPacket,
+ (unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
ret = -1;
goto Cleanup;
}
- ASSERT(((ULONG_PTR)netDevice->SendBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer
+ ASSERT(((unsigned long)netDevice->SendBuffer & (PAGE_SIZE-1)) == 0); // page-aligned buffer
DPRINT_INFO(NETVSC, "Establishing send buffer's GPADL...");
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)initPacket,
+ (unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
ret = NetDevice->Device->Driver->VmbusChannelInterface.SendPacket(NetDevice->Device,
revokePacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)revokePacket,
+ (unsigned long)revokePacket,
VmbusPacketTypeDataInBand,
0);
// If we failed here, we might as well return and have a leak rather than continue and a bugchk
ret = NetDevice->Device->Driver->VmbusChannelInterface.SendPacket(NetDevice->Device,
revokePacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)revokePacket,
+ (unsigned long)revokePacket,
VmbusPacketTypeDataInBand,
0);
// If we failed here, we might as well return and have a leak rather than continue and a bugchk
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)initPacket,
+ (unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)initPacket,
+ (unsigned long)initPacket,
VmbusPacketTypeDataInBand,
0);
if (ret != 0)
return;
}
- nvspPacket = (NVSP_MESSAGE*)((ULONG_PTR)Packet + (Packet->DataOffset8 << 3));
+ nvspPacket = (NVSP_MESSAGE*)((unsigned long)Packet + (Packet->DataOffset8 << 3));
DPRINT_DBG(NETVSC, "send completion packet - type %d", nvspPacket->Header.MessageType);
else if (nvspPacket->Header.MessageType == NvspMessage1TypeSendRNDISPacketComplete)
{
// Get the send context
- nvscPacket = (NETVSC_PACKET *)(ULONG_PTR)Packet->TransactionId;
+ nvscPacket = (NETVSC_PACKET *)(unsigned long)Packet->TransactionId;
ASSERT(nvscPacket);
// Notify the layer above us
Packet->PageBufferCount,
&sendMessage,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)Packet);
+ (unsigned long)Packet);
}
else
{
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
&sendMessage,
sizeof(NVSP_MESSAGE),
- (ULONG_PTR)Packet,
+ (unsigned long)Packet,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
NVSP_MESSAGE *nvspPacket;
NETVSC_PACKET *netvscPacket=NULL;
LIST_ENTRY* entry;
- ULONG_PTR start;
- ULONG_PTR end, endVirtual;
+ unsigned long start;
+ unsigned long end, endVirtual;
//NETVSC_DRIVER_OBJECT *netvscDriver;
XFERPAGE_PACKET *xferpagePacket=NULL;
LIST_ENTRY listHead;
return;
}
- nvspPacket = (NVSP_MESSAGE*)((ULONG_PTR)Packet + (Packet->DataOffset8 << 3));
+ nvspPacket = (NVSP_MESSAGE*)((unsigned long)Packet + (Packet->DataOffset8 << 3));
// Make sure this is a valid nvsp packet
if (nvspPacket->Header.MessageType != NvspMessage1TypeSendRNDISPacket )
netvscPacket->PageBuffers[0].Length = vmxferpagePacket->Ranges[i].ByteCount;
- start = GetPhysicalAddress((void*)((ULONG_PTR)netDevice->ReceiveBuffer + vmxferpagePacket->Ranges[i].ByteOffset));
+ start = GetPhysicalAddress((void*)((unsigned long)netDevice->ReceiveBuffer + vmxferpagePacket->Ranges[i].ByteOffset));
netvscPacket->PageBuffers[0].Pfn = start >> PAGE_SHIFT;
- endVirtual = (ULONG_PTR)netDevice->ReceiveBuffer
+ endVirtual = (unsigned long)netDevice->ReceiveBuffer
+ vmxferpagePacket->Ranges[i].ByteOffset
+ vmxferpagePacket->Ranges[i].ByteCount -1;
end = GetPhysicalAddress((void*)endVirtual);
packet->PageBuffers[0].Pfn = GetPhysicalAddress(&Request->RequestMessage) >> PAGE_SHIFT;
packet->PageBuffers[0].Length = Request->RequestMessage.MessageLength;
- packet->PageBuffers[0].Offset = (ULONG_PTR)&Request->RequestMessage & (PAGE_SIZE -1);
+ packet->PageBuffers[0].Offset = (unsigned long)&Request->RequestMessage & (PAGE_SIZE -1);
packet->Completion.Send.SendCompletionContext = Request;//packet;
packet->Completion.Send.OnSendCompletion = RndisFilterOnSendRequestCompletion;
- packet->Completion.Send.SendCompletionTid = (ULONG_PTR)Device;
+ packet->Completion.Send.SendCompletionTid = (unsigned long)Device;
ret = gRndisFilter.InnerDriver.OnSend(Device->NetDevice->Device, packet);
DPRINT_EXIT(NETVSC);
rndisHeader = (RNDIS_MESSAGE*)PageMapVirtualAddress(Packet->PageBuffers[0].Pfn);
- rndisHeader = (void*)((ULONG_PTR)rndisHeader + Packet->PageBuffers[0].Offset);
+ rndisHeader = (void*)((unsigned long)rndisHeader + Packet->PageBuffers[0].Offset);
// Make sure we got a valid rndis message
// FIXME: There seems to be a bug in set completion msg where its MessageLength is 16 bytes but
#if 0
if ( Packet->TotalDataBufferLength != rndisHeader->MessageLength )
{
- PageUnmapVirtualAddress((void*)(ULONG_PTR)rndisHeader - Packet->PageBuffers[0].Offset);
+ PageUnmapVirtualAddress((void*)(unsigned long)rndisHeader - Packet->PageBuffers[0].Offset);
DPRINT_ERR(NETVSC, "invalid rndis message? (expected %u bytes got %u)...dropping this message!",
rndisHeader->MessageLength, Packet->TotalDataBufferLength);
memcpy(&rndisMessage, rndisHeader, (rndisHeader->MessageLength > sizeof(RNDIS_MESSAGE))?sizeof(RNDIS_MESSAGE):rndisHeader->MessageLength);
- PageUnmapVirtualAddress((void*)(ULONG_PTR)rndisHeader - Packet->PageBuffers[0].Offset);
+ PageUnmapVirtualAddress((void*)(unsigned long)rndisHeader - Packet->PageBuffers[0].Offset);
DumpRndisMessage(&rndisMessage);
}
memcpy(Result,
- (void*)((ULONG_PTR)queryComplete + queryComplete->InformationBufferOffset),
+ (void*)((unsigned long)queryComplete + queryComplete->InformationBufferOffset),
queryComplete->InformationBufferLength);
*ResultSize = queryComplete->InformationBufferLength;
set->InformationBufferLength = sizeof(u32);
set->InformationBufferOffset = sizeof(RNDIS_SET_REQUEST);
- memcpy((void*)(ULONG_PTR)set + sizeof(RNDIS_SET_REQUEST), &NewFilter, sizeof(u32));
+ memcpy((void*)(unsigned long)set + sizeof(RNDIS_SET_REQUEST), &NewFilter, sizeof(u32));
ret = RndisFilterSendRequest(Device, request);
if (ret != 0)
Packet->IsDataPacket = TRUE;
Packet->PageBuffers[0].Pfn = GetPhysicalAddress(rndisMessage) >> PAGE_SHIFT;
- Packet->PageBuffers[0].Offset = (ULONG_PTR)rndisMessage & (PAGE_SIZE-1);
+ Packet->PageBuffers[0].Offset = (unsigned long)rndisMessage & (PAGE_SIZE-1);
Packet->PageBuffers[0].Length = rndisMessageSize;
// Save the packet send completion and context
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)request,
+ (unsigned long)request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0)
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)request,
+ (unsigned long)request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if ( ret != 0)
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)request,
+ (unsigned long)request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)request,
+ (unsigned long)request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)&storDevice->ResetRequest,
+ (unsigned long)&storDevice->ResetRequest,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
&requestExtension->Request->DataBuffer,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)requestExtension);
+ (unsigned long)requestExtension);
}
else
{
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
vstorPacket,
sizeof(VSTOR_PACKET),
- (ULONG_PTR)requestExtension,
+ (unsigned long)requestExtension,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
//ASSERT(bytesRecvd == sizeof(VSTOR_PACKET));
- request = (STORVSC_REQUEST_EXTENSION*)(ULONG_PTR)requestId;
+ request = (STORVSC_REQUEST_EXTENSION*)(unsigned long)requestId;
ASSERT(request);
//if (vstorPacket.Flags & SYNTHETIC_FLAG)
typedef u32 DWORD;
typedef unsigned char BYTE;
-typedef unsigned long ULONG_PTR;
-
typedef struct {
unsigned char Data[16];
} GUID;
#define GetVirtualAddress Physical2LogicalAddr
-void* Physical2LogicalAddr(ULONG_PTR PhysAddr);
+void* Physical2LogicalAddr(unsigned long PhysAddr);
#define GetPhysicalAddress Logical2PhysicalAddr
-ULONG_PTR Logical2PhysicalAddr(void * LogicalAddr);
+unsigned long Logical2PhysicalAddr(void * LogicalAddr);
-ULONG_PTR Virtual2Physical(void * VirtAddr);
+unsigned long Virtual2Physical(void * VirtAddr);
void* PageMapVirtualAddress(unsigned long Pfn);
void PageUnmapVirtualAddress(void* VirtAddr);
static void netvsc_xmit_completion(void *context)
{
NETVSC_PACKET *packet = (NETVSC_PACKET *)context;
- struct sk_buff *skb = (struct sk_buff *)(ULONG_PTR)packet->Completion.Send.SendCompletionTid;
+ struct sk_buff *skb = (struct sk_buff *)(unsigned long)packet->Completion.Send.SendCompletionTid;
struct net_device* net;
DPRINT_ENTER(NETVSC_DRV);
// Set the completion routine
packet->Completion.Send.OnSendCompletion = netvsc_xmit_completion;
packet->Completion.Send.SendCompletionContext = packet;
- packet->Completion.Send.SendCompletionTid = (ULONG_PTR)skb;
+ packet->Completion.Send.SendCompletionTid = (unsigned long)skb;
retry_send:
ret = net_drv_obj->OnSend(&net_device_ctx->device_ctx->device_obj, packet);
kfree(spin);
}
-void* Physical2LogicalAddr(ULONG_PTR PhysAddr)
+void* Physical2LogicalAddr(unsigned long PhysAddr)
{
void* logicalAddr = phys_to_virt(PhysAddr);
BUG_ON(!virt_addr_valid(logicalAddr));
return logicalAddr;
}
-ULONG_PTR Logical2PhysicalAddr(void * LogicalAddr)
+unsigned long Logical2PhysicalAddr(void * LogicalAddr)
{
BUG_ON(!virt_addr_valid(LogicalAddr));
return virt_to_phys(LogicalAddr);
}
-ULONG_PTR Virtual2Physical(void * VirtAddr)
+unsigned long Virtual2Physical(void * VirtAddr)
{
- ULONG_PTR pfn = vmalloc_to_pfn(VirtAddr);
+ unsigned long pfn = vmalloc_to_pfn(VirtAddr);
return pfn << PAGE_SHIFT;
}