- //\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