-/*++\r
+/** @file\r
+ Initialization functions for EFI UNDI32 driver.\r
\r
Copyright (c) 2006 - 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\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
-\r
- init.c\r
-\r
-Abstract:\r
-\r
- Initialization functions for EFI UNDI32 driver\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
\r
#include "Undi32.h"\r
-#include <Library/BaseLib.h>\r
//\r
// Global Variables\r
//\r
UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];\r
NII_TABLE *UndiDataPointer = NULL;\r
\r
-VOID\r
-EFIAPI\r
-UndiNotifyVirtual (\r
- EFI_EVENT Event,\r
- VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
When address mapping changes to virtual this should make the appropriate\r
address conversions.\r
\r
-Arguments:\r
-\r
(Standard Event handler)\r
\r
-Returns:\r
+ @return None\r
\r
- None\r
-\r
---*/\r
+**/\r
// TODO: Context - add argument and description to function comment\r
+VOID\r
+EFIAPI\r
+UndiNotifyVirtual (\r
+ EFI_EVENT Event,\r
+ VOID *Context\r
+ )\r
{\r
UINT16 Index;\r
VOID *Pxe31Pointer;\r
Pxe31Pointer = (VOID *) pxe_31;\r
\r
EfiConvertPointer (\r
- EFI_OPTIONAL_POINTER,\r
+ EFI_OPTIONAL_PTR,\r
(VOID **) &Pxe31Pointer\r
);\r
\r
for (Index = 0; Index < pxe_31->IFcnt; Index++) {\r
UNDI32DeviceList[Index]->NIIProtocol_31.ID = (UINT64) (UINTN) Pxe31Pointer;\r
EfiConvertPointer (\r
- EFI_OPTIONAL_POINTER,\r
+ EFI_OPTIONAL_PTR,\r
(VOID **) &(UNDI32DeviceList[Index])\r
);\r
}\r
\r
EfiConvertPointer (\r
- EFI_OPTIONAL_POINTER,\r
+ EFI_OPTIONAL_PTR,\r
(VOID **) &(pxe_31->EntryPoint)\r
);\r
pxe_31 = Pxe31Pointer;\r
\r
for (Index = 0; Index <= PXE_OPCODE_LAST_VALID; Index++) {\r
EfiConvertPointer (\r
- EFI_OPTIONAL_POINTER,\r
+ EFI_OPTIONAL_PTR,\r
(VOID **) &api_table[Index].api_ptr\r
);\r
}\r
}\r
\r
-VOID\r
-EFIAPI\r
-UndiNotifyExitBs (\r
- EFI_EVENT Event,\r
- VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
When EFI is shuting down the boot services, we need to install a\r
configuration table for UNDI to work at runtime!\r
\r
-Arguments:\r
-\r
(Standard Event handler)\r
\r
-Returns:\r
+ @return None\r
\r
- None\r
-\r
---*/\r
+**/\r
// TODO: Context - add argument and description to function comment\r
+VOID\r
+EFIAPI\r
+UndiNotifyExitBs (\r
+ EFI_EVENT Event,\r
+ VOID *Context\r
+ )\r
{\r
InstallConfigTable ();\r
}\r
};\r
\r
\r
-EFI_STATUS\r
-EFIAPI\r
-UndiDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
than contains a DevicePath, PciIo protocol, Class code of 2, Vendor ID of 0x8086,\r
and DeviceId of (D100_DEVICE_ID || D102_DEVICE_ID || ICH3_DEVICE_ID_1 ||\r
ICH3_DEVICE_ID_2 || ICH3_DEVICE_ID_3 || ICH3_DEVICE_ID_4 || ICH3_DEVICE_ID_5 ||\r
ICH3_DEVICE_ID_6 || ICH3_DEVICE_ID_7 || ICH3_DEVICE_ID_8) can be supported.\r
\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
-\r
- Controller - Handle of device to test.\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to test.\r
+ @param RemainingDevicePath Not used.\r
\r
- RemainingDevicePath - Not used.\r
+ @retval EFI_SUCCESS This driver supports this device.\r
+ @retval other This driver does not support this device.\r
\r
-Returns:\r
-\r
- EFI_SUCCESS - This driver supports this device.\r
-\r
- other - This driver does not support this device.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UndiDriverSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-EFIAPI\r
-UndiDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Start this driver on Controller by opening PciIo and DevicePath protocol.\r
Initialize PXE structures, create a copy of the Controller Device Path with the\r
NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol\r
on the newly created Device Path.\r
\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
-\r
- Controller - Handle of device to work with.\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to work with.\r
+ @param RemainingDevicePath Not used, always produce all possible children.\r
\r
- RemainingDevicePath - Not used, always produce all possible children.\r
+ @retval EFI_SUCCESS This driver is added to Controller.\r
+ @retval other This driver does not support this device.\r
\r
-Returns:\r
-\r
- EFI_SUCCESS - This driver is added to Controller.\r
-\r
- other - This driver does not support this device.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UndiDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *UndiDevicePath;\r
// if the table exists, free it and alloc again, or alloc it directly\r
//\r
if (UndiDataPointer != NULL) {\r
- Status = gBS->FreePool(UndiDataPointer);\r
+ Status = gBS->FreePool(UndiDataPointer);\r
}\r
if (EFI_ERROR (Status)) {\r
goto UndiErrorDeleteDevicePath;\r
return Status;\r
}\r
\r
+\r
+/**\r
+ Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and\r
+ closing the DevicePath and PciIo protocols on Controller.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param Controller Handle of device to stop driver on.\r
+ @param NumberOfChildren How many children need to be stopped.\r
+ @param ChildHandleBuffer Not used.\r
+\r
+ @retval EFI_SUCCESS This driver is removed Controller.\r
+ @retval other This driver was not removed from this device.\r
+\r
+**/\r
+// TODO: EFI_DEVICE_ERROR - add return value to function comment\r
EFI_STATUS\r
EFIAPI\r
UndiDriverStop (\r
IN UINTN NumberOfChildren,\r
IN EFI_HANDLE *ChildHandleBuffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and\r
- closing the DevicePath and PciIo protocols on Controller.\r
-\r
-Arguments:\r
- This - Protocol instance pointer.\r
- Controller - Handle of device to stop driver on.\r
- NumberOfChildren - How many children need to be stopped.\r
- ChildHandleBuffer - Not used.\r
-\r
-Returns:\r
- EFI_SUCCESS - This driver is removed Controller.\r
- other - This driver was not removed from this device.\r
-\r
---*/\r
-// TODO: EFI_DEVICE_ERROR - add return value to function comment\r
{\r
EFI_STATUS Status;\r
BOOLEAN AllChildrenStopped;\r
\r
}\r
\r
-VOID\r
-TmpDelay (\r
- IN UINT64 UnqId,\r
- IN UINTN MicroSeconds\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Use the EFI boot services to produce a pause. This is also the routine which\r
gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can\r
do it's own pause.\r
\r
-Arguments:\r
-\r
- UnqId - Runtime O/S routine might use this, this temp routine does not use it\r
-\r
- MicroSeconds - Determines the length of pause.\r
+ @param UnqId Runtime O/S routine might use this, this temp\r
+ routine does not use it\r
+ @param MicroSeconds Determines the length of pause.\r
\r
-Returns:\r
-\r
- none\r
+ @return none\r
\r
---*/\r
+**/\r
+VOID\r
+TmpDelay (\r
+ IN UINT64 UnqId,\r
+ IN UINTN MicroSeconds\r
+ )\r
{\r
gBS->Stall ((UINT32) MicroSeconds);\r
}\r
\r
+\r
+/**\r
+ Use the PCI IO abstraction to issue memory or I/O reads and writes. This is also the routine which\r
+ gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can do it's own I/O abstractions.\r
+\r
+ @param UnqId Runtime O/S routine may use this field, this temp\r
+ routine does not.\r
+ @param ReadWrite Determine if it is an I/O or Memory Read/Write\r
+ Operation.\r
+ @param Len Determines the width of the data operation.\r
+ @param Port What port to Read/Write from.\r
+ @param BuffAddr Address to read to or write from.\r
+\r
+ @return none\r
+\r
+**/\r
VOID\r
TmpMemIo (\r
IN UINT64 UnqId,\r
IN UINT64 Port,\r
IN UINT64 BuffAddr\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Use the PCI IO abstraction to issue memory or I/O reads and writes. This is also the routine which\r
- gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can do it's own I/O abstractions.\r
-\r
-Arguments:\r
-\r
- UnqId - Runtime O/S routine may use this field, this temp routine does not.\r
-\r
- ReadWrite - Determine if it is an I/O or Memory Read/Write Operation.\r
-\r
- Len - Determines the width of the data operation.\r
-\r
- Port - What port to Read/Write from.\r
-\r
- BuffAddr - Address to read to or write from.\r
-\r
-Returns:\r
-\r
- none\r
-\r
---*/\r
{\r
EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
NIC_DATA_INSTANCE *AdapterInfo;\r
return ;\r
}\r
\r
-EFI_STATUS\r
-AppendMac2DevPath (\r
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPtr,\r
- IN EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,\r
- IN NIC_DATA_INSTANCE *AdapterInfo\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Using the NIC data structure information, read the EEPROM to get the MAC address and then allocate space\r
for a new devicepath (**DevPtr) which will contain the original device path the NIC was found on (*BaseDevPtr)\r
and an added MAC node.\r
\r
-Arguments:\r
-\r
- DevPtr - Pointer which will point to the newly created device path with the MAC node attached.\r
-\r
- BaseDevPtr - Pointer to the device path which the UNDI device driver is latching on to.\r
-\r
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..\r
+ @param DevPtr Pointer which will point to the newly created device\r
+ path with the MAC node attached.\r
+ @param BaseDevPtr Pointer to the device path which the UNDI device\r
+ driver is latching on to.\r
+ @param AdapterInfo Pointer to the NIC data structure information which\r
+ the UNDI driver is layering on..\r
\r
-Returns:\r
+ @retval EFI_SUCCESS A MAC address was successfully appended to the Base\r
+ Device Path.\r
+ @retval other Not enough resources available to create new Device\r
+ Path node.\r
\r
- EFI_SUCCESS - A MAC address was successfully appended to the Base Device Path.\r
-\r
- other - Not enough resources available to create new Device Path node.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+AppendMac2DevPath (\r
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPtr,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,\r
+ IN NIC_DATA_INSTANCE *AdapterInfo\r
+ )\r
{\r
EFI_MAC_ADDRESS MACAddress;\r
PCI_CONFIG_HEADER *CfgHdr;\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-InstallConfigTable (\r
- IN VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Install a GUID/Pointer pair into the system's configuration table.\r
\r
-Arguments:\r
-\r
none\r
\r
-Returns:\r
+ @retval EFI_SUCCESS Install a GUID/Pointer pair into the system's\r
+ configuration table.\r
+ @retval other Did not successfully install the GUID/Pointer pair\r
+ into the configuration table.\r
\r
- EFI_SUCCESS - Install a GUID/Pointer pair into the system's configuration table.\r
-\r
- other - Did not successfully install the GUID/Pointer pair into the configuration table.\r
-\r
---*/\r
+**/\r
// TODO: VOID - add argument and description to function comment\r
+EFI_STATUS\r
+InstallConfigTable (\r
+ IN VOID\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_CONFIGURATION_TABLE *CfgPtr;\r
}\r
\r
if(UndiDataPointer == NULL) {\r
- return EFI_SUCCESS;\r
+ return EFI_SUCCESS;\r
}\r
\r
UndiData = (NII_TABLE *)UndiDataPointer;\r
\r
/**\r
\r
- Install driver binding protocol of UNDI.\r
-\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
- @param[in] SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The entry point is executed successfully.\r
- @retval other Some error occurs when executing this entry point.\r
-\r
**/\r
EFI_STATUS\r
EFIAPI\r