]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Define correct ABI for issuing UNDI command and UNDI callback functions...
authorxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Nov 2011 02:59:20 +0000 (02:59 +0000)
committerxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Nov 2011 02:59:20 +0000 (02:59 +0000)
This update ensure correct calling convention for interfaces between binary UNDI driver and SnpDxe.

Signed-off-by: xdu2
Reviewed-by: geekboy15a
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12657 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/SnpDxe/Callback.c
MdeModulePkg/Universal/Network/SnpDxe/Snp.c
MdeModulePkg/Universal/Network/SnpDxe/Snp.h

index 79d13251cd507ddfe84395656cf1dca23c4552f1..5ee191aeea35e63fb502cd62233f42f5a3a6d9bb 100644 (file)
@@ -3,7 +3,7 @@
   the callback routines for Undi3.1 have an extra parameter UniqueId which\r
   stores the interface context for the NIC that snp is trying to talk.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -30,25 +30,26 @@ EFI_LOCK             mLock;
 //\r
 extern EFI_PCI_IO_PROTOCOL  *mPciIo;\r
 \r
-/** \r
-  Convert a virtual or CPU address provided by SNP to a physical or device \r
-  address. \r
+/**\r
+  Convert a virtual or CPU address provided by SNP to a physical or device\r
+  address.\r
 \r
   This is a callback routine supplied to UNDI at undi_start time. Since EFI uses\r
-  the identical mapping, this routine returns the physical address same as the \r
-  virtual address for most of the addresses. an address above 4GB cannot \r
-  generally be used as a device address, it needs to be mapped to a lower \r
-  physical address. This routine does not call the map routine itself, but it \r
-  assumes that the mapping was done at the time of providing the address to \r
-  UNDI. This routine just looks up the address in a map table (which is the v2p \r
-  structure chain). \r
-  \r
+  the identical mapping, this routine returns the physical address same as the\r
+  virtual address for most of the addresses. an address above 4GB cannot\r
+  generally be used as a device address, it needs to be mapped to a lower\r
+  physical address. This routine does not call the map routine itself, but it\r
+  assumes that the mapping was done at the time of providing the address to\r
+  UNDI. This routine just looks up the address in a map table (which is the v2p\r
+  structure chain).\r
+\r
   @param  CpuAddr        Virtual address.\r
-  @param  DeviceAddrPtr  Pointer to the physical address, or 0 in case of any \r
+  @param  DeviceAddrPtr  Pointer to the physical address, or 0 in case of any\r
                          error.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackV2p30 (\r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
@@ -83,7 +84,7 @@ SnpUndi32CallbackV2p30 (
 \r
 /**\r
   Acquire or release a lock of an exclusive access to a critical section of the\r
-  code/data. \r
+  code/data.\r
 \r
   This is a callback routine supplied to UNDI at undi_start time.\r
 \r
@@ -91,6 +92,7 @@ SnpUndi32CallbackV2p30 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackBlock30 (\r
   IN UINT32 Enable\r
   )\r
@@ -113,13 +115,14 @@ SnpUndi32CallbackBlock30 (
 \r
 /**\r
   Delay MicroSeconds of micro seconds.\r
-   \r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
 \r
   @param MicroSeconds  Number of micro seconds to pause, ususlly multiple of 10.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackDelay30 (\r
   IN UINT64 MicroSeconds\r
   )\r
@@ -130,16 +133,16 @@ SnpUndi32CallbackDelay30 (
 }\r
 \r
 /**\r
-  IO routine for UNDI. \r
+  IO routine for UNDI.\r
 \r
-  This is a callback routine supplied to UNDI at undi_start time. This is not \r
-  currently being used by UNDI3.0 because Undi3.0 uses io/mem offsets relative \r
-  to the beginning of the device io/mem address and so it needs to use the \r
-  PCI_IO_FUNCTION that abstracts the start of the device's io/mem addresses. \r
-  Since SNP cannot retrive the context of the undi3.0 interface it cannot use \r
-  the PCI_IO_FUNCTION that specific for that NIC and uses one global IO \r
-  functions structure, this does not work. This however works fine for EFI1.0 \r
-  Undis because they use absolute addresses for io/mem access. \r
+  This is a callback routine supplied to UNDI at undi_start time. This is not\r
+  currently being used by UNDI3.0 because Undi3.0 uses io/mem offsets relative\r
+  to the beginning of the device io/mem address and so it needs to use the\r
+  PCI_IO_FUNCTION that abstracts the start of the device's io/mem addresses.\r
+  Since SNP cannot retrive the context of the undi3.0 interface it cannot use\r
+  the PCI_IO_FUNCTION that specific for that NIC and uses one global IO\r
+  functions structure, this does not work. This however works fine for EFI1.0\r
+  Undis because they use absolute addresses for io/mem access.\r
 \r
   @param ReadOrWrite  Indicates read or write, IO or Memory.\r
   @param NumBytes     Number of bytes to read or write.\r
@@ -149,6 +152,7 @@ SnpUndi32CallbackDelay30 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMemio30 (\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
@@ -225,20 +229,21 @@ SnpUndi32CallbackMemio30 (
 }\r
 \r
 /**\r
-  Acquire or release a lock of the exclusive access to a critical section of the \r
-  code/data. \r
-   \r
+  Acquire or release a lock of the exclusive access to a critical section of the\r
+  code/data.\r
+\r
   This is a callback routine supplied to UNDI3.1 at undi_start time.\r
   New callbacks for 3.1: there won't be a virtual2physical callback for UNDI 3.1\r
-  because undi3.1 uses the MemMap call to map the required address by itself! \r
+  because undi3.1 uses the MemMap call to map the required address by itself!\r
 \r
-  @param UniqueId  This was supplied to UNDI at Undi_Start, SNP uses this to \r
+  @param UniqueId  This was supplied to UNDI at Undi_Start, SNP uses this to\r
                       store Undi interface context (Undi does not read or write\r
                       this variable).\r
-  @param Enable    Non-zero indicates acquire; Zero indicates release. \r
+  @param Enable    Non-zero indicates acquire; Zero indicates release.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackBlock (\r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
@@ -260,16 +265,17 @@ SnpUndi32CallbackBlock (
 \r
 /**\r
   Delay MicroSeconds of micro seconds.\r
-   \r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
 \r
   @param UniqueId      This was supplied to UNDI at Undi_Start, SNP uses this to\r
                        store Undi interface context (Undi does not read or write\r
                        this variable).\r
-  @param MicroSeconds  Number of micro seconds to pause, ususlly multiple of 10.  \r
+  @param MicroSeconds  Number of micro seconds to pause, ususlly multiple of 10.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackDelay (\r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
@@ -281,21 +287,22 @@ SnpUndi32CallbackDelay (
 }\r
 \r
 /**\r
-  IO routine for UNDI3.1. \r
-   \r
+  IO routine for UNDI3.1.\r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
-   \r
-  @param UniqueId       This was supplied to UNDI at Undi_Start, SNP uses this \r
-                               to store Undi interface context (Undi does not read or\r
-                               write this variable).\r
+\r
+  @param UniqueId       This was supplied to UNDI at Undi_Start, SNP uses this\r
+                        to store Undi interface context (Undi does not read or\r
+                        write this variable).\r
   @param ReadOrWrite    Indicates read or write, IO or Memory.\r
   @param NumBytes       Number of bytes to read or write.\r
   @param MemOrPortAddr  IO or memory address to read from or write to.\r
   @param BufferPtr      Memory location to read into or that contains the bytes\r
-                               to write.\r
+                        to write.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMemio (\r
   IN UINT64     UniqueId,\r
   IN UINT8      ReadOrWrite,\r
@@ -374,7 +381,7 @@ SnpUndi32CallbackMemio (
 }\r
 \r
 /**\r
-  Map a CPU address to a device address. \r
+  Map a CPU address to a device address.\r
 \r
   This is a callback routine supplied to UNDI at undi_start time.\r
 \r
@@ -389,6 +396,7 @@ SnpUndi32CallbackMemio (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMap (\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
@@ -467,21 +475,22 @@ SnpUndi32CallbackMap (
 }\r
 \r
 /**\r
-  Unmap an address that was previously mapped using map callback. \r
-   \r
+  Unmap an address that was previously mapped using map callback.\r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
 \r
-  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to \r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to\r
                      store. Undi interface context (Undi does not read or write\r
                      this variable).\r
   @param CpuAddr     Virtual address that was mapped.\r
   @param NumBytes    Size of memory mapped.\r
-  @param Direction   Direction of data flow for this memory's usage: \r
+  @param Direction   Direction of data flow for this memory's usage:\r
                      cpu->device, device->cpu or both ways.\r
   @param DeviceAddr  The mapped device address.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackUnmap (\r
   IN UINT64 UniqueId,\r
   IN UINT64 CpuAddr,\r
@@ -512,19 +521,19 @@ SnpUndi32CallbackUnmap (
   return ;\r
 }\r
 \r
-/** \r
-  Synchronize the virtual buffer contents with the mapped buffer contents. \r
-   \r
+/**\r
+  Synchronize the virtual buffer contents with the mapped buffer contents.\r
+\r
   This is a callback routine supplied to UNDI at undi_start time. The virtual\r
-  and mapped buffers need not correspond to the same physical memory (especially \r
-  if the virtual address is > 4GB). Depending on the direction for which the \r
-  buffer is mapped, undi will need to synchronize their contents whenever it \r
-  writes to/reads from the buffer using either the cpu address or the device \r
-  address. \r
-  EFI does not provide a sync call since virt=physical, we should just do the \r
-  synchronization ourselves here. \r
-\r
-  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to \r
+  and mapped buffers need not correspond to the same physical memory (especially\r
+  if the virtual address is > 4GB). Depending on the direction for which the\r
+  buffer is mapped, undi will need to synchronize their contents whenever it\r
+  writes to/reads from the buffer using either the cpu address or the device\r
+  address.\r
+  EFI does not provide a sync call since virt=physical, we should just do the\r
+  synchronization ourselves here.\r
+\r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to\r
                      store Undi interface context (Undi does not read or write\r
                      this variable).\r
   @param CpuAddr     Virtual address that was mapped.\r
@@ -535,6 +544,7 @@ SnpUndi32CallbackUnmap (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackSync (\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
index 2dc0536117c0ad1675deb1a146e10695f354f818..72693e9ec461c4d808ed898f6f55b3b133f520aa 100644 (file)
@@ -58,6 +58,7 @@ SnpNotifyExitBootServices (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 IssueHwUndiCommand (\r
   UINT64 Cdb\r
   )\r
index bf9ed8823338de4c4e74c47e427026d0e254277e..dc6384533456431578c6e88967d6fe853e1141fc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
     Declaration of strctures and functions for SnpDxe driver.\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed\r
 and made available under the terms and conditions of the BSD License which\r
 accompanies this distribution. The full text of the license may be found at\r
@@ -49,7 +49,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 typedef\r
 EFI_STATUS\r
-(*ISSUE_UNDI32_COMMAND) (\r
+(EFIAPI *ISSUE_UNDI32_COMMAND) (\r
   UINT64         Cdb\r
   );\r
 \r
@@ -295,6 +295,7 @@ DelV2p (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackBlock30 (\r
   IN UINT32 Enable\r
   );\r
@@ -308,6 +309,7 @@ SnpUndi32CallbackBlock30 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackDelay30 (\r
   IN UINT64 MicroSeconds\r
   );\r
@@ -331,6 +333,7 @@ SnpUndi32CallbackDelay30 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMemio30 (\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
@@ -355,6 +358,7 @@ SnpUndi32CallbackMemio30 (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackV2p30 (\r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
@@ -369,12 +373,13 @@ SnpUndi32CallbackV2p30 (
   the MemMap call to map the required address by itself!\r
 \r
   @param UniqueId  This was supplied to UNDI at Undi_Start, SNP uses this to\r
-                                                                store Undi interface context (Undi does not read or write\r
-                                                                this variable)\r
+                   store Undi interface context (Undi does not read or write\r
+                   this variable)\r
   @param Enable    non-zero indicates acquire\r
                    zero indicates release\r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackBlock (\r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
@@ -386,11 +391,12 @@ SnpUndi32CallbackBlock (
   pause.\r
 \r
   @param UniqueId      This was supplied to UNDI at Undi_Start, SNP uses this to\r
-                                                                    store Undi interface context (Undi does not read or write\r
-                                                                    this variable)\r
+                       store Undi interface context (Undi does not read or write\r
+                       this variable)\r
   @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackDelay (\r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
@@ -401,8 +407,8 @@ SnpUndi32CallbackDelay (
   This is the IO routine for UNDI3.1 to start CPB.\r
 \r
   @param UniqueId       This was supplied to UNDI at Undi_Start, SNP uses this\r
-                                                                                       to store Undi interface context (Undi does not read or\r
-                                                                                       write this variable)\r
+                        to store Undi interface context (Undi does not read or\r
+                        write this variable)\r
   @param ReadOrWrite    indicates read or write, IO or Memory.\r
   @param NumBytes       number of bytes to read or write.\r
   @param MemOrPortAddr  IO or memory address to read from or write to.\r
@@ -410,6 +416,7 @@ SnpUndi32CallbackDelay (
                         to write.\r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMemio (\r
   IN UINT64     UniqueId,\r
   IN UINT8      ReadOrWrite,\r
@@ -433,6 +440,7 @@ SnpUndi32CallbackMemio (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackMap (\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
@@ -456,6 +464,7 @@ SnpUndi32CallbackMap (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackUnmap (\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
@@ -486,6 +495,7 @@ SnpUndi32CallbackUnmap (
 \r
 **/\r
 VOID\r
+EFIAPI\r
 SnpUndi32CallbackSync (\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r