]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / EdkModulePkg / Universal / Network / Snp32_64 / Dxe / receive.c
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c
deleted file mode 100644 (file)
index 7c9cf5e..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*++\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module name:\r
-    receive.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-    2000-Feb-03 M(f)J   Genesis.\r
---*/\r
-\r
-\r
-#include "Snp.h"\r
-\r
-STATIC\r
-EFI_STATUS\r
-pxe_receive (\r
-  SNP_DRIVER      *snp,\r
-  VOID            *BufferPtr,\r
-  UINTN           *BuffSizePtr,\r
-  UINTN           *HeaderSizePtr,\r
-  EFI_MAC_ADDRESS *SourceAddrPtr,\r
-  EFI_MAC_ADDRESS *DestinationAddrPtr,\r
-  UINT16          *ProtocolPtr\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
- this routine calls undi to receive a packet and fills in the data in the\r
- input pointers!\r
\r
-Arguments:\r
-  snp  - pointer to snp driver structure\r
-  BufferPtr   - pointer to the memory for the received data\r
-  BuffSizePtr - is a pointer to the length of the buffer on entry and contains\r
-                the length of the received data on return\r
-  HeaderSizePtr - pointer to the header portion of the data received.\r
-  SourceAddrPtr    - optional parameter, is a pointer to contain the source\r
-                ethernet address on return\r
-  DestinationAddrPtr   - optional parameter, is a pointer to contain the destination\r
-                ethernet address on return\r
-  ProtocolPtr    - optional parameter, is a pointer to contain the protocol type\r
-                from the ethernet header on return\r
-\r
-\r
-Returns:\r
-\r
---*/\r
-{\r
-  PXE_CPB_RECEIVE *cpb;\r
-  PXE_DB_RECEIVE  *db;\r
-  UINTN           buf_size;\r
-  UINT64          TempData;\r
-\r
-  cpb       = snp->cpb;\r
-  db        = snp->db;\r
-  buf_size  = *BuffSizePtr;\r
-  //\r
-  // IMPORTANT NOTE:\r
-  // In case of the older 3.0 UNDI, if the input buffer address is beyond 4GB,\r
-  // DO NOT call the map function on the given buffer, instead use\r
-  // a global buffer. The reason is that UNDI3.0 has some unnecessary check of\r
-  // making sure that all the addresses (whether or not they will be given\r
-  // to the NIC ) supplied to it are below 4GB. It may or may not use\r
-  // the mapped address after all (like in case of CPB and DB)!\r
-  // Instead of using the global buffer whose address is allocated within the\r
-  // 2GB limit if I start mapping the given buffer we lose the data, here is\r
-  // why!!!\r
-  // if our address is > 4GB, the map call creates another buffer below 2GB and\r
-  // copies data to/from the original buffer to the mapped buffer either at\r
-  // map time or unmap time depending on the map direction.\r
-  // UNDI will not complain since we already mapped the buffer to be\r
-  // within the 2GB limit but will not use (I know undi) the mapped address\r
-  // since it does not give the user buffers to the NIC's receive unit,\r
-  // It just copies the received packet into the user buffer using the virtual\r
-  // (CPU) address rather than the mapped (device or physical) address.\r
-  // When the UNDI call returns, if we then unmap the buffer, we will lose\r
-  // the contents because unmap copies the contents of the mapped buffer into\r
-  // the original buffer (since the direction is FROM_DEVICE) !!!\r
-  //\r
-  // this is not a problem in Undi 3.1 because this undi uses it's map callback\r
-  // routine to map a cpu address to device address and it does it only if\r
-  // it is giving the address to the device and unmaps it before using the cpu\r
-  // address!\r
-  //\r
-  TempData = (UINT64) (UINTN) BufferPtr;\r
-  if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {\r
-    cpb->BufferAddr = (UINT64) (UINTN) snp->receive_buf;\r
-    cpb->BufferLen  = (UINT32) (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);\r
-  } else {\r
-    cpb->BufferAddr = (UINT64) (UINTN) BufferPtr;\r
-    cpb->BufferLen  = (UINT32) *BuffSizePtr;\r
-  }\r
-\r
-  cpb->reserved       = 0;\r
-\r
-  snp->cdb.OpCode     = PXE_OPCODE_RECEIVE;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-\r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_RECEIVE);\r
-  snp->cdb.CPBaddr    = (UINT64) (UINTN) cpb;\r
-\r
-  snp->cdb.DBsize     = sizeof (PXE_DB_RECEIVE);\r
-  snp->cdb.DBaddr     = (UINT64) (UINTN) db;\r
-\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
-\r
-  //\r
-  // Issue UNDI command and check result.\r
-  //\r
-  DEBUG ((EFI_D_INFO, "\nsnp->undi.receive ()  "));\r
-\r
-  (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);\r
-\r
-  switch (snp->cdb.StatCode) {\r
-  case PXE_STATCODE_SUCCESS:\r
-    break;\r
-\r
-  case PXE_STATCODE_NO_DATA:\r
-    DEBUG (\r
-      (EFI_D_INFO,\r
-      "\nsnp->undi.receive ()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
-      );\r
-\r
-    return EFI_NOT_READY;\r
-\r
-  default:\r
-    DEBUG (\r
-      (EFI_D_ERROR,\r
-      "\nsnp->undi.receive()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
-      );\r
-\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  *BuffSizePtr = db->FrameLen;\r
-\r
-  if (HeaderSizePtr != NULL) {\r
-    *HeaderSizePtr = db->MediaHeaderLen;\r
-  }\r
-\r
-  if (SourceAddrPtr != NULL) {\r
-    CopyMem (SourceAddrPtr, &db->SrcAddr, snp->mode.HwAddressSize);\r
-  }\r
-\r
-  if (DestinationAddrPtr != NULL) {\r
-    CopyMem (DestinationAddrPtr, &db->DestAddr, snp->mode.HwAddressSize);\r
-  }\r
-\r
-  if (ProtocolPtr != NULL) {\r
-    *ProtocolPtr = (UINT16) PXE_SWAP_UINT16 (db->Protocol); /*  we need to do the byte swapping */\r
-  }\r
-\r
-  TempData = (UINT64) (UINTN) BufferPtr;\r
-  if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {\r
-    CopyMem (BufferPtr, snp->receive_buf, snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);\r
-  }\r
-\r
-  return (*BuffSizePtr <= buf_size) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-snp_undi32_receive (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  OUT UINTN                      *HeaderSizePtr OPTIONAL,\r
-  IN OUT UINTN                   *BuffSizePtr,\r
-  OUT VOID                       *BufferPtr,\r
-  OUT EFI_MAC_ADDRESS            * SourceAddrPtr OPTIONAL,\r
-  OUT EFI_MAC_ADDRESS            * DestinationAddrPtr OPTIONAL,\r
-  OUT UINT16                     *ProtocolPtr OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
- This is the SNP interface routine for receiving network data.\r
- This routine basically retrieves snp structure, checks the SNP state and\r
- calls the pxe_receive routine to actually do the receive!\r
-\r
-Arguments:\r
-  this  - context pointer\r
-  HeaderSizePtr - optional parameter and is a pointer to the header portion of\r
-                the data received.\r
-  BuffSizePtr - is a pointer to the length of the buffer on entry and contains\r
-                the length of the received data on return\r
-  BufferPtr   - pointer to the memory for the received data\r
-  SourceAddrPtr    - optional parameter, is a pointer to contain the source\r
-                ethernet address on return\r
-  DestinationAddrPtr   - optional parameter, is a pointer to contain the destination\r
-                ethernet address on return\r
-  ProtocolPtr    - optional parameter, is a pointer to contain the protocol type\r
-                from the ethernet header on return\r
-\r
-Returns:\r
-\r
---*/\r
-{\r
-  SNP_DRIVER  *snp;\r
-\r
-  if (this == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
-\r
-  if (snp == NULL) {\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  switch (snp->mode.State) {\r
-  case EfiSimpleNetworkInitialized:\r
-    break;\r
-\r
-  case EfiSimpleNetworkStopped:\r
-    return EFI_NOT_STARTED;\r
-\r
-  case EfiSimpleNetworkStarted:\r
-    return EFI_DEVICE_ERROR;\r
-\r
-  default:\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  if ((BuffSizePtr == NULL) || (BufferPtr == NULL)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (!snp->mode.ReceiveFilterSetting) {\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-\r
-  return pxe_receive (\r
-          snp,\r
-          BufferPtr,\r
-          BuffSizePtr,\r
-          HeaderSizePtr,\r
-          SourceAddrPtr,\r
-          DestinationAddrPtr,\r
-          ProtocolPtr\r
-          );\r
-}\r