Staging: hv: osd: remove physical address wrapper functions
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 29 Jul 2009 22:39:27 +0000 (15:39 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:01:53 +0000 (12:01 -0700)
Use the real functions the kernel provides, so that people can see what
is actually going on in the code easier.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/Channel.c
drivers/staging/hv/Connection.c
drivers/staging/hv/Hv.c
drivers/staging/hv/NetVsc.c
drivers/staging/hv/RndisFilter.c
drivers/staging/hv/include/osd.h
drivers/staging/hv/osd.c

index 61fc345211e9124dbef050eca716ee9c223b7af6..5b876438d41b56f223879555433a41fb2c0dd691 100644 (file)
@@ -416,7 +416,7 @@ VmbusChannelCreateGpadlHeader(
        ASSERT( (Size & (PAGE_SIZE-1)) == 0);
 
        pageCount = Size >> PAGE_SHIFT;
-       pfn = GetPhysicalAddress(Kbuffer) >> PAGE_SHIFT;
+       pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT;
 
        /* do we need a gpadl body msg */
        pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(VMBUS_CHANNEL_GPADL_HEADER) - sizeof(GPA_RANGE);
index d7091ad130f3d08241c27d4db013ab26fd860aaa..960c41789f357d4d946e045f9e836dbf10ff50ca 100644 (file)
@@ -110,9 +110,9 @@ VmbusConnect(void)
 
        msg->Header.MessageType = ChannelMessageInitiateContact;
        msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER;
-       msg->InterruptPage = GetPhysicalAddress(gVmbusConnection.InterruptPage);
-       msg->MonitorPage1 = GetPhysicalAddress(gVmbusConnection.MonitorPages);
-       msg->MonitorPage2 = GetPhysicalAddress((void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE));
+       msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage);
+       msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages);
+       msg->MonitorPage2 = virt_to_phys((void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE));
 
        /*
         * Add to list before we send the request since we may
index 4b9b3fb3b933126c43d673c76fec065e684fcbbb..87dc628420031aca777f98077fc4d0ee2952b9a4 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/vmalloc.h>
+#include <asm/io.h>
 #include "include/logging.h"
 #include "VmbusPrivate.h"
 
@@ -166,8 +167,8 @@ HvDoHypercall (
 {
 #ifdef CONFIG_X86_64
     u64 hvStatus=0;
-    u64 inputAddress = (Input)? GetPhysicalAddress(Input) : 0;
-       u64 outputAddress = (Output)? GetPhysicalAddress(Output) : 0;
+       u64 inputAddress = (Input)? virt_to_phys(Input) : 0;
+       u64 outputAddress = (Output)? virt_to_phys(Output) : 0;
     volatile void* hypercallPage = gHvContext.HypercallPage;
 
     DPRINT_DBG(VMBUS, "Hypercall <control %llx input phys %llx virt %p output phys %llx virt %p hypercall %p>",
@@ -191,10 +192,10 @@ HvDoHypercall (
     u32 controlLo = Control & 0xFFFFFFFF;
     u32 hvStatusHi = 1;
     u32 hvStatusLo = 1;
-    u64 inputAddress = (Input) ? GetPhysicalAddress(Input) : 0;
+    u64 inputAddress = (Input) ? virt_to_phys(Input) : 0;
     u32 inputAddressHi = inputAddress >> 32;
     u32 inputAddressLo = inputAddress & 0xFFFFFFFF;
-       u64 outputAddress = (Output) ?GetPhysicalAddress(Output) : 0;
+       u64 outputAddress = (Output) ? virt_to_phys(Output) : 0;
     u32 outputAddressHi = outputAddress >> 32;
     u32 outputAddressLo = outputAddress & 0xFFFFFFFF;
     volatile void* hypercallPage = gHvContext.HypercallPage;
@@ -276,8 +277,8 @@ HvInit (
                }
 
                hypercallMsr.Enable = 1;
-               /* hypercallMsr.GuestPhysicalAddress = Logical2PhysicalAddr(virtAddr) >> PAGE_SHIFT; */
-               hypercallMsr.GuestPhysicalAddress = Virtual2Physical(virtAddr) >> PAGE_SHIFT;
+               /* hypercallMsr.GuestPhysicalAddress = virt_to_phys(virtAddr) >> PAGE_SHIFT; */
+               hypercallMsr.GuestPhysicalAddress = vmalloc_to_pfn(virtAddr);
                WriteMsr(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64);
 
        /* Confirm that hypercall page did get setup. */
@@ -507,8 +508,8 @@ HvSynicInit (
 
                if (guestID == HV_LINUX_GUEST_ID)
                {
-                       gHvContext.synICMessagePage[0] = GetVirtualAddress(simp.BaseSimpGpa << PAGE_SHIFT);
-                       gHvContext.synICEventPage[0] = GetVirtualAddress(siefp.BaseSiefpGpa << PAGE_SHIFT);
+                       gHvContext.synICMessagePage[0] = phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT);
+                       gHvContext.synICEventPage[0] = phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT);
                }
                else
                {
@@ -536,7 +537,7 @@ HvSynicInit (
                /* Setup the Synic's message page */
                simp.AsUINT64 = ReadMsr(HV_X64_MSR_SIMP);
                simp.SimpEnabled = 1;
-               simp.BaseSimpGpa = GetPhysicalAddress(gHvContext.synICMessagePage[0]) >> PAGE_SHIFT;
+               simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0]) >> PAGE_SHIFT;
 
                DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.AsUINT64);
 
@@ -545,7 +546,7 @@ HvSynicInit (
                /* Setup the Synic's event page */
                siefp.AsUINT64 = ReadMsr(HV_X64_MSR_SIEFP);
                siefp.SiefpEnabled = 1;
-               siefp.BaseSiefpGpa = GetPhysicalAddress(gHvContext.synICEventPage[0]) >> PAGE_SHIFT;
+               siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0]) >> PAGE_SHIFT;
 
                DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.AsUINT64);
 
index 8e71ce6406e9ec2572debd416ac601f4deab5d45..ab71c0ad361d6a43116540532e7b083a4f42950a 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/delay.h>
+#include <asm/io.h>
 #include "include/logging.h"
 #include "NetVsc.h"
 #include "RndisFilter.h"
@@ -1241,13 +1242,13 @@ NetVscOnReceive(
 
                netvscPacket->PageBuffers[0].Length = vmxferpagePacket->Ranges[i].ByteCount;
 
-               start = GetPhysicalAddress((void*)((unsigned long)netDevice->ReceiveBuffer + vmxferpagePacket->Ranges[i].ByteOffset));
+               start = virt_to_phys((void*)((unsigned long)netDevice->ReceiveBuffer + vmxferpagePacket->Ranges[i].ByteOffset));
 
                netvscPacket->PageBuffers[0].Pfn = start >> PAGE_SHIFT;
                endVirtual = (unsigned long)netDevice->ReceiveBuffer
                    + vmxferpagePacket->Ranges[i].ByteOffset
                    + vmxferpagePacket->Ranges[i].ByteCount -1;
-               end = GetPhysicalAddress((void*)endVirtual);
+               end = virt_to_phys((void*)endVirtual);
 
                /* Calculate the page relative offset */
                netvscPacket->PageBuffers[0].Offset = vmxferpagePacket->Ranges[i].ByteOffset & (PAGE_SIZE -1);
@@ -1266,7 +1267,7 @@ NetVscOnReceive(
                            bytesRemain -= PAGE_SIZE;
                        }
                        netvscPacket->PageBuffers[j].Pfn =
-                           GetPhysicalAddress((void*)(endVirtual - bytesRemain)) >> PAGE_SHIFT;
+                           virt_to_phys((void*)(endVirtual - bytesRemain)) >> PAGE_SHIFT;
                        netvscPacket->PageBufferCount++;
                        if (bytesRemain == 0)
                            break;
index 362efb0704b2c8ae8db02741e5dcf88ec3264a5e..70dd17511b88daf2bbe428d797e14715f222f597 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/kernel.h>
 #include <linux/highmem.h>
 #include <asm/kmap_types.h>
+#include <asm/io.h>
 
 #include "include/logging.h"
 
@@ -358,7 +359,7 @@ RndisFilterSendRequest(
        packet->TotalDataBufferLength = Request->RequestMessage.MessageLength;
        packet->PageBufferCount = 1;
 
-       packet->PageBuffers[0].Pfn = GetPhysicalAddress(&Request->RequestMessage) >> PAGE_SHIFT;
+       packet->PageBuffers[0].Pfn = virt_to_phys(&Request->RequestMessage) >> PAGE_SHIFT;
        packet->PageBuffers[0].Length = Request->RequestMessage.MessageLength;
        packet->PageBuffers[0].Offset = (unsigned long)&Request->RequestMessage & (PAGE_SIZE -1);
 
@@ -1110,7 +1111,7 @@ RndisFilterOnSend(
        rndisPacket->DataLength = Packet->TotalDataBufferLength;
 
        Packet->IsDataPacket = true;
-       Packet->PageBuffers[0].Pfn              = GetPhysicalAddress(rndisMessage) >> PAGE_SHIFT;
+       Packet->PageBuffers[0].Pfn      = virt_to_phys(rndisMessage) >> PAGE_SHIFT;
        Packet->PageBuffers[0].Offset   = (unsigned long)rndisMessage & (PAGE_SIZE-1);
        Packet->PageBuffers[0].Length   = rndisMessageSize;
 
index a3e2e29cf3319b12b9bb8b256a4a7dda6f966c89..58c47a7cd3f02b6bb65c7203d7ec1d658a9b1627 100644 (file)
@@ -89,14 +89,6 @@ extern int   WaitEventWait(struct osd_waitevent *waitEvent);
 extern int     WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs);
 
 
-#define GetVirtualAddress Physical2LogicalAddr
-void* Physical2LogicalAddr(unsigned long PhysAddr);
-
-#define GetPhysicalAddress Logical2PhysicalAddr
-unsigned long Logical2PhysicalAddr(void * LogicalAddr);
-
-unsigned long Virtual2Physical(void * VirtAddr);
-
 int osd_schedule_callback(struct workqueue_struct *wq,
                          void (*func)(void *),
                          void *data);
index ad883c93ec9cc43eb7454ab99f45eec9f1bb127c..007a5532d1316c0e86031ba89c90fc6edc61dd55 100644 (file)
@@ -90,7 +90,7 @@ void PageFree(void* page, unsigned int count)
 
 void *MemMapIO(unsigned long phys, unsigned long size)
 {
-       return (void*)GetVirtualAddress(phys); /* return ioremap_nocache(phys, size); */
+       return (void*)phys_to_virt(phys); /* return ioremap_nocache(phys, size); */
 }
 
 void MemUnmapIO(void *virt)
@@ -180,27 +180,6 @@ int WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs)
        return ret;
 }
 
-void* Physical2LogicalAddr(unsigned long PhysAddr)
-{
-       void* logicalAddr = phys_to_virt(PhysAddr);
-       BUG_ON(!virt_addr_valid(logicalAddr));
-       return logicalAddr;
-}
-
-unsigned long Logical2PhysicalAddr(void * LogicalAddr)
-{
-       BUG_ON(!virt_addr_valid(LogicalAddr));
-       return virt_to_phys(LogicalAddr);
-}
-
-
-unsigned long Virtual2Physical(void * VirtAddr)
-{
-       unsigned long pfn = vmalloc_to_pfn(VirtAddr);
-
-       return pfn << PAGE_SHIFT;
-}
-
 static void osd_callback_work(struct work_struct *work)
 {
        struct osd_callback_struct *cb = container_of(work,