]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Callback.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Callback.c
index c4789ba11dc81be576666a40eb7e1bca2e180f9e..79d13251cd507ddfe84395656cf1dca23c4552f1 100644 (file)
@@ -3,8 +3,8 @@
   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. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2008, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -30,20 +30,22 @@ EFI_LOCK             mLock;
 //\r
 extern EFI_PCI_IO_PROTOCOL  *mPciIo;\r
 \r
-/**\r
-  This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine with a virtual or CPU address that SNP provided to \r
-  convert it to a physical or device address. Since EFI uses the identical \r
-  mapping, this routine returns the physical address same as the virtual address\r
-  for most of the addresses. an address above 4GB cannot generally be used as a \r
-  device address, it needs to be mapped to a lower physical address. This \r
-  routine does not call the map routine itself, but it assumes that the mapping\r
-  was done at the time of providing the address to UNDI. This routine just \r
-  looks up the address in a map table (which is the v2p structure chain). \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
-  @param  CpuAddr        virtual address of a buffer.\r
-  @param  DeviceAddrPtr  pointer to the physical address.\r
-                         The DeviceAddrPtr will contain 0 in case of any error.\r
+  @param  CpuAddr        Virtual address.\r
+  @param  DeviceAddrPtr  Pointer to the physical address, or 0 in case of any \r
+                         error.\r
 \r
 **/\r
 VOID\r
@@ -80,12 +82,12 @@ SnpUndi32CallbackV2p30 (
 }\r
 \r
 /**\r
+  Acquire or release a lock of an exclusive access to a critical section of the\r
+  code/data. \r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine when it wants to have exclusive access to a critical\r
-  section of the code/data.\r
 \r
-  @param Enable   non-zero indicates acquire\r
-                  zero indicates release\r
+  @param Enable   Non-zero indicates acquire; Zero indicates release.\r
 \r
 **/\r
 VOID\r
@@ -110,11 +112,11 @@ SnpUndi32CallbackBlock30 (
 }\r
 \r
 /**\r
+  Delay MicroSeconds of micro seconds.\r
+   \r
   This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine with the number of micro seconds when it wants to\r
-  pause.\r
 \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
@@ -128,21 +130,22 @@ SnpUndi32CallbackDelay30 (
 }\r
 \r
 /**\r
-  This is a callback routine supplied to UNDI at undi_start time.\r
-  This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
-  because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
-  io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
-  start of the device's io/mem addresses. Since SNP cannot retrive the context\r
-  of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
-  that NIC and uses one global IO functions structure, this does not work.\r
-  This however works fine for EFI1.0 Undis because they use absolute addresses\r
-  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
-  @param Address      IO or memory address to read from or write to\r
-  @param BufferAddr   memory location to read into or that contains the bytes to \r
-                      write\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
+\r
+  @param ReadOrWrite  Indicates read or write, IO or Memory.\r
+  @param NumBytes     Number of bytes to read or write.\r
+  @param Address      IO or memory address to read from or write to.\r
+  @param BufferAddr   Memory location to read into or that contains the bytes to\r
+                      write.\r
 \r
 **/\r
 VOID\r
@@ -222,18 +225,18 @@ SnpUndi32CallbackMemio30 (
 }\r
 \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
-  UNDI call this routine when it wants to have exclusive access to a critical\r
-  section of the code/data.\r
-  New callbacks for 3.1:\r
-  there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
-  the MemMap call to map the required address by itself!\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
 \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\r
-                   zero indicates release\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
+\r
 **/\r
 VOID\r
 SnpUndi32CallbackBlock (\r
@@ -256,14 +259,15 @@ SnpUndi32CallbackBlock (
 }\r
 \r
 /**\r
+  Delay MicroSeconds of micro seconds.\r
+   \r
   This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine with the number of micro seconds when it wants to\r
-  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
-  @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\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
 **/\r
 VOID\r
 SnpUndi32CallbackDelay (\r
@@ -277,17 +281,19 @@ SnpUndi32CallbackDelay (
 }\r
 \r
 /**\r
+  IO routine for UNDI3.1. \r
+   \r
   This is a callback routine supplied to UNDI at undi_start time.\r
-  This is the IO routine for UNDI3.1 to start CPB.\r
-\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
+                               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
+  @param BufferPtr      Memory location to read into or that contains the bytes\r
+                               to write.\r
+\r
 **/\r
 VOID\r
 SnpUndi32CallbackMemio (\r
@@ -368,17 +374,18 @@ SnpUndi32CallbackMemio (
 }\r
 \r
 /**\r
+  Map a CPU address to a device address. \r
+\r
   This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine when it has to map a CPU address to a device\r
-  address.\r
 \r
-  @param UniqueId      - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-                         Undi interface context (Undi does not read or write this variable)\r
-  @param CpuAddr       - Virtual address to be mapped!\r
-  @param NumBytes      - size of memory to be mapped\r
-  @param Direction     - direction of data flow for this memory's usage:\r
-                         cpu->device, device->cpu or both ways\r
-  @param DeviceAddrPtr - pointer to return the mapped device address\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 to be mapped.\r
+  @param NumBytes      Size of memory to be mapped.\r
+  @param Direction     Direction of data flow for this memory's usage:\r
+                       cpu->device, device->cpu or both ways.\r
+  @param DeviceAddrPtr Pointer to return the mapped device address.\r
 \r
 **/\r
 VOID\r
@@ -460,17 +467,18 @@ SnpUndi32CallbackMap (
 }\r
 \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
-  UNDI call this routine when it wants to unmap an address that was previously\r
-  mapped using map callback.\r
 \r
-  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store.\r
-                     Undi interface context (Undi does not read or write 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
-                     cpu->device, device->cpu or both ways\r
-  @param DeviceAddr  the mapped device address\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
+                     cpu->device, device->cpu or both ways.\r
+  @param DeviceAddr  The mapped device address.\r
 \r
 **/\r
 VOID\r
@@ -493,8 +501,7 @@ SnpUndi32CallbackUnmap (
     }\r
   }\r
 \r
-  if (Index >= MAX_MAP_LENGTH)\r
-  {\r
+  if (Index >= MAX_MAP_LENGTH) {\r
     DEBUG ((EFI_D_ERROR, "SNP could not find a mapping, failed to unmap.\n"));\r
     return ;\r
   }\r
@@ -505,25 +512,26 @@ SnpUndi32CallbackUnmap (
   return ;\r
 }\r
 \r
-/**\r
-  This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine when it wants synchronize the virtual buffer contents\r
-  with the mapped buffer contents. The virtual and mapped buffers need not\r
-  correspond to the same physical memory (especially if the virtual address is\r
-  > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
-  need to synchronize their contents whenever it writes to/reads from the buffer\r
-  using either the cpu address or the device address.\r
-\r
-  EFI does not provide a sync call, since virt=physical, we sould just do\r
-  the synchronization ourself here!\r
-\r
-  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-                     Undi interface context (Undi does not read or write 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
+/** \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
+                     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
                      cpu->device, device->cpu or both ways.\r
-  @param DeviceAddr  the mapped device address.\r
+  @param DeviceAddr  The mapped device address.\r
 \r
 **/\r
 VOID\r