2 Initialization functions for EFI UNDI32 driver.
4 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
14 PXE_SW_UNDI
*pxe_31
= NULL
; // 3.1 entry
15 UNDI32_DEV
*UNDI32DeviceList
[MAX_NIC_INTERFACES
];
16 UNDI_CONFIG_TABLE
*UndiDataPointer
= NULL
;
19 // UNDI Class Driver Global Variables
21 EFI_DRIVER_BINDING_PROTOCOL gUndiDriverBinding
= {
32 When address mapping changes to virtual this should make the appropriate
35 (Standard Event handler)
51 Pxe31Pointer
= (VOID
*) pxe_31
;
55 (VOID
**) &Pxe31Pointer
59 // UNDI32DeviceList is an array of pointers
61 for (Index
= 0; Index
< (pxe_31
->IFcnt
| pxe_31
->IFcntExt
<< 8); Index
++) {
62 UNDI32DeviceList
[Index
]->NIIProtocol_31
.Id
= (UINT64
) (UINTN
) Pxe31Pointer
;
65 (VOID
**) &(UNDI32DeviceList
[Index
])
71 (VOID
**) &(pxe_31
->EntryPoint
)
73 pxe_31
= Pxe31Pointer
;
76 for (Index
= 0; Index
<= PXE_OPCODE_LAST_VALID
; Index
++) {
79 (VOID
**) &api_table
[Index
].api_ptr
86 When EFI is shuting down the boot services, we need to install a
87 configuration table for UNDI to work at runtime!
89 (Standard Event handler)
96 UndiNotifyReadyToBoot (
101 InstallConfigTable ();
106 Test to see if this driver supports ControllerHandle. Any ControllerHandle
107 than contains a DevicePath, PciIo protocol, Class code of 2, Vendor ID of 0x8086,
108 and DeviceId of (D100_DEVICE_ID || D102_DEVICE_ID || ICH3_DEVICE_ID_1 ||
109 ICH3_DEVICE_ID_2 || ICH3_DEVICE_ID_3 || ICH3_DEVICE_ID_4 || ICH3_DEVICE_ID_5 ||
110 ICH3_DEVICE_ID_6 || ICH3_DEVICE_ID_7 || ICH3_DEVICE_ID_8) can be supported.
112 @param This Protocol instance pointer.
113 @param Controller Handle of device to test.
114 @param RemainingDevicePath Not used.
116 @retval EFI_SUCCESS This driver supports this device.
117 @retval other This driver does not support this device.
122 UndiDriverSupported (
123 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
124 IN EFI_HANDLE Controller
,
125 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
129 EFI_PCI_IO_PROTOCOL
*PciIo
;
132 Status
= gBS
->OpenProtocol (
134 &gEfiDevicePathProtocolGuid
,
136 This
->DriverBindingHandle
,
138 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
140 if (EFI_ERROR (Status
)) {
144 Status
= gBS
->OpenProtocol (
146 &gEfiPciIoProtocolGuid
,
148 This
->DriverBindingHandle
,
150 EFI_OPEN_PROTOCOL_BY_DRIVER
152 if (EFI_ERROR (Status
)) {
156 Status
= PciIo
->Pci
.Read (
160 sizeof (PCI_CONFIG_HEADER
),
164 if (!EFI_ERROR (Status
)) {
165 Status
= EFI_UNSUPPORTED
;
167 if (Pci
.Hdr
.ClassCode
[2] == 0x02 && Pci
.Hdr
.VendorId
== PCI_VENDOR_ID_INTEL
) {
168 switch (Pci
.Hdr
.DeviceId
) {
171 case ICH3_DEVICE_ID_1
:
172 case ICH3_DEVICE_ID_2
:
173 case ICH3_DEVICE_ID_3
:
174 case ICH3_DEVICE_ID_4
:
175 case ICH3_DEVICE_ID_5
:
176 case ICH3_DEVICE_ID_6
:
177 case ICH3_DEVICE_ID_7
:
178 case ICH3_DEVICE_ID_8
:
195 Status
= EFI_SUCCESS
;
202 &gEfiPciIoProtocolGuid
,
203 This
->DriverBindingHandle
,
212 Start this driver on Controller by opening PciIo and DevicePath protocol.
213 Initialize PXE structures, create a copy of the Controller Device Path with the
214 NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol
215 on the newly created Device Path.
217 @param This Protocol instance pointer.
218 @param Controller Handle of device to work with.
219 @param RemainingDevicePath Not used, always produce all possible children.
221 @retval EFI_SUCCESS This driver is added to Controller.
222 @retval other This driver does not support this device.
228 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
229 IN EFI_HANDLE Controller
,
230 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
234 EFI_DEVICE_PATH_PROTOCOL
*UndiDevicePath
;
235 PCI_CONFIG_HEADER
*CfgHdr
;
236 UNDI32_DEV
*UNDI32Device
;
238 UINT8
*TmpPxePointer
;
239 EFI_PCI_IO_PROTOCOL
*PciIoFncs
;
242 BOOLEAN PciAttributesSaved
;
244 Status
= gBS
->OpenProtocol (
246 &gEfiPciIoProtocolGuid
,
247 (VOID
**) &PciIoFncs
,
248 This
->DriverBindingHandle
,
250 EFI_OPEN_PROTOCOL_BY_DRIVER
253 if (EFI_ERROR (Status
)) {
257 Status
= gBS
->OpenProtocol (
259 &gEfiDevicePathProtocolGuid
,
260 (VOID
**) &UndiDevicePath
,
261 This
->DriverBindingHandle
,
263 EFI_OPEN_PROTOCOL_BY_DRIVER
266 if (EFI_ERROR (Status
)) {
269 &gEfiPciIoProtocolGuid
,
270 This
->DriverBindingHandle
,
277 PciAttributesSaved
= FALSE
;
279 Status
= gBS
->AllocatePool (
280 EfiRuntimeServicesData
,
282 (VOID
**) &UNDI32Device
285 if (EFI_ERROR (Status
)) {
289 ZeroMem ((CHAR8
*) UNDI32Device
, sizeof (UNDI32_DEV
));
292 // Get original PCI attributes
294 Status
= PciIoFncs
->Attributes (
296 EfiPciIoAttributeOperationGet
,
298 &UNDI32Device
->NicInfo
.OriginalPciAttributes
301 if (EFI_ERROR (Status
)) {
302 goto UndiErrorDeleteDevice
;
304 PciAttributesSaved
= TRUE
;
307 // allocate and initialize both (old and new) the !pxe structures here,
308 // there should only be one copy of each of these structure for any number
309 // of NICs this undi supports. Also, these structures need to be on a
310 // paragraph boundary as per the spec. so, while allocating space for these,
311 // make sure that there is space for 2 !pxe structures (old and new) and a
312 // 32 bytes padding for alignment adjustment (in case)
314 TmpPxePointer
= NULL
;
315 if (pxe_31
== NULL
) {
316 Status
= gBS
->AllocatePool (
317 EfiRuntimeServicesData
,
318 (sizeof (PXE_SW_UNDI
) + sizeof (PXE_SW_UNDI
) + 32),
319 (VOID
**) &TmpPxePointer
322 if (EFI_ERROR (Status
)) {
323 goto UndiErrorDeleteDevice
;
328 sizeof (PXE_SW_UNDI
) + sizeof (PXE_SW_UNDI
) + 32
331 // check for paragraph alignment here, assuming that the pointer is
332 // already 8 byte aligned.
334 if (((UINTN
) TmpPxePointer
& 0x0F) != 0) {
335 pxe_31
= (PXE_SW_UNDI
*) ((UINTN
) (TmpPxePointer
+ 8));
337 pxe_31
= (PXE_SW_UNDI
*) TmpPxePointer
;
340 PxeStructInit (pxe_31
);
343 UNDI32Device
->NIIProtocol_31
.Id
= (UINT64
) (UINTN
) (pxe_31
);
345 Status
= PciIoFncs
->Attributes (
347 EfiPciIoAttributeOperationSupported
,
351 if (!EFI_ERROR (Status
)) {
352 Supports
&= EFI_PCI_DEVICE_ENABLE
;
353 Status
= PciIoFncs
->Attributes (
355 EfiPciIoAttributeOperationEnable
,
361 // Read all the registers from device's PCI Configuration space
363 Status
= PciIoFncs
->Pci
.Read (
368 &UNDI32Device
->NicInfo
.Config
371 CfgHdr
= (PCI_CONFIG_HEADER
*) &(UNDI32Device
->NicInfo
.Config
[0]);
374 // make sure that this device is a PCI bus master
377 NewCommand
= (UINT16
) (CfgHdr
->Command
| PCI_COMMAND_MASTER
| PCI_COMMAND_IO
);
378 if (CfgHdr
->Command
!= NewCommand
) {
379 PciIoFncs
->Pci
.Write (
386 CfgHdr
->Command
= NewCommand
;
390 // make sure that the latency timer is at least 32
392 if (CfgHdr
->LatencyTimer
< 32) {
393 CfgHdr
->LatencyTimer
= 32;
394 PciIoFncs
->Pci
.Write (
399 &CfgHdr
->LatencyTimer
403 // the IfNum index for the current interface will be the total number
404 // of interfaces initialized so far
406 UNDI32Device
->NIIProtocol_31
.IfNum
= pxe_31
->IFcnt
| pxe_31
->IFcntExt
<< 8;
408 PxeUpdate (&UNDI32Device
->NicInfo
, pxe_31
);
410 UNDI32Device
->NicInfo
.Io_Function
= PciIoFncs
;
411 UNDI32DeviceList
[UNDI32Device
->NIIProtocol_31
.IfNum
] = UNDI32Device
;
412 UNDI32Device
->Undi32BaseDevPath
= UndiDevicePath
;
414 Status
= AppendMac2DevPath (
415 &UNDI32Device
->Undi32DevPath
,
416 UNDI32Device
->Undi32BaseDevPath
,
417 &UNDI32Device
->NicInfo
421 goto UndiErrorDeletePxe
;
424 UNDI32Device
->Signature
= UNDI_DEV_SIGNATURE
;
426 UNDI32Device
->NIIProtocol_31
.Revision
= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31
;
427 UNDI32Device
->NIIProtocol_31
.Type
= EfiNetworkInterfaceUndi
;
428 UNDI32Device
->NIIProtocol_31
.MajorVer
= PXE_ROMID_MAJORVER
;
429 UNDI32Device
->NIIProtocol_31
.MinorVer
= PXE_ROMID_MINORVER_31
;
430 UNDI32Device
->NIIProtocol_31
.ImageSize
= 0;
431 UNDI32Device
->NIIProtocol_31
.ImageAddr
= 0;
432 UNDI32Device
->NIIProtocol_31
.Ipv6Supported
= TRUE
;
434 UNDI32Device
->NIIProtocol_31
.StringId
[0] = 'U';
435 UNDI32Device
->NIIProtocol_31
.StringId
[1] = 'N';
436 UNDI32Device
->NIIProtocol_31
.StringId
[2] = 'D';
437 UNDI32Device
->NIIProtocol_31
.StringId
[3] = 'I';
439 UNDI32Device
->DeviceHandle
= NULL
;
441 UNDI32Device
->Aip
.GetInformation
= UndiAipGetInfo
;
442 UNDI32Device
->Aip
.SetInformation
= UndiAipSetInfo
;
443 UNDI32Device
->Aip
.GetSupportedTypes
= UndiAipGetSupportedTypes
;
446 // install both the 3.0 and 3.1 NII protocols.
448 Status
= gBS
->InstallMultipleProtocolInterfaces (
449 &UNDI32Device
->DeviceHandle
,
450 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
451 &UNDI32Device
->NIIProtocol_31
,
452 &gEfiDevicePathProtocolGuid
,
453 UNDI32Device
->Undi32DevPath
,
454 &gEfiAdapterInformationProtocolGuid
,
459 if (EFI_ERROR (Status
)) {
460 goto UndiErrorDeleteDevicePath
;
464 // if the table exists, free it and alloc again, or alloc it directly
466 if (UndiDataPointer
!= NULL
) {
467 Status
= gBS
->FreePool(UndiDataPointer
);
469 if (EFI_ERROR (Status
)) {
470 goto UndiErrorDeleteDevicePath
;
473 Len
= ((pxe_31
->IFcnt
|pxe_31
->IFcntExt
<< 8)* sizeof (UndiDataPointer
->NII_entry
)) + sizeof (UndiDataPointer
);
474 Status
= gBS
->AllocatePool (EfiRuntimeServicesData
, Len
, (VOID
**) &UndiDataPointer
);
476 if (EFI_ERROR (Status
)) {
477 goto UndiErrorAllocDataPointer
;
481 // Open For Child Device
483 Status
= gBS
->OpenProtocol (
485 &gEfiPciIoProtocolGuid
,
486 (VOID
**) &PciIoFncs
,
487 This
->DriverBindingHandle
,
488 UNDI32Device
->DeviceHandle
,
489 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
493 UndiErrorAllocDataPointer
:
494 gBS
->UninstallMultipleProtocolInterfaces (
495 &UNDI32Device
->DeviceHandle
,
496 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
497 &UNDI32Device
->NIIProtocol_31
,
498 &gEfiDevicePathProtocolGuid
,
499 UNDI32Device
->Undi32DevPath
,
500 &gEfiAdapterInformationProtocolGuid
,
505 UndiErrorDeleteDevicePath
:
506 UNDI32DeviceList
[UNDI32Device
->NIIProtocol_31
.IfNum
] = NULL
;
507 gBS
->FreePool (UNDI32Device
->Undi32DevPath
);
510 PxeUpdate (NULL
, pxe_31
);
511 if (TmpPxePointer
!= NULL
) {
512 gBS
->FreePool (TmpPxePointer
);
516 UndiErrorDeleteDevice
:
517 if (PciAttributesSaved
) {
519 // Restore original PCI attributes
521 PciIoFncs
->Attributes (
523 EfiPciIoAttributeOperationSet
,
524 UNDI32Device
->NicInfo
.OriginalPciAttributes
,
529 gBS
->FreePool (UNDI32Device
);
534 &gEfiDevicePathProtocolGuid
,
535 This
->DriverBindingHandle
,
541 &gEfiPciIoProtocolGuid
,
542 This
->DriverBindingHandle
,
551 Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
552 closing the DevicePath and PciIo protocols on Controller.
554 @param This Protocol instance pointer.
555 @param Controller Handle of device to stop driver on.
556 @param NumberOfChildren How many children need to be stopped.
557 @param ChildHandleBuffer Not used.
559 @retval EFI_SUCCESS This driver is removed Controller.
560 @retval other This driver was not removed from this device.
563 // TODO: EFI_DEVICE_ERROR - add return value to function comment
567 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
568 IN EFI_HANDLE Controller
,
569 IN UINTN NumberOfChildren
,
570 IN EFI_HANDLE
*ChildHandleBuffer
574 BOOLEAN AllChildrenStopped
;
576 UNDI32_DEV
*UNDI32Device
;
577 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*NIIProtocol
;
580 // Complete all outstanding transactions to Controller.
581 // Don't allow any new transaction to Controller to be started.
583 if (NumberOfChildren
== 0) {
586 // Close the bus driver
588 Status
= gBS
->CloseProtocol (
590 &gEfiDevicePathProtocolGuid
,
591 This
->DriverBindingHandle
,
595 Status
= gBS
->CloseProtocol (
597 &gEfiPciIoProtocolGuid
,
598 This
->DriverBindingHandle
,
605 AllChildrenStopped
= TRUE
;
607 for (Index
= 0; Index
< NumberOfChildren
; Index
++) {
609 Status
= gBS
->OpenProtocol (
610 ChildHandleBuffer
[Index
],
611 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
612 (VOID
**) &NIIProtocol
,
613 This
->DriverBindingHandle
,
615 EFI_OPEN_PROTOCOL_GET_PROTOCOL
617 if (!EFI_ERROR (Status
)) {
619 UNDI32Device
= UNDI_DEV_FROM_THIS (NIIProtocol
);
621 Status
= gBS
->CloseProtocol (
623 &gEfiPciIoProtocolGuid
,
624 This
->DriverBindingHandle
,
625 ChildHandleBuffer
[Index
]
627 if (!EFI_ERROR (Status
)) {
628 Status
= gBS
->UninstallMultipleProtocolInterfaces (
629 ChildHandleBuffer
[Index
],
630 &gEfiDevicePathProtocolGuid
,
631 UNDI32Device
->Undi32DevPath
,
632 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
633 &UNDI32Device
->NIIProtocol_31
,
636 if (!EFI_ERROR (Status
)) {
638 // Restore original PCI attributes
640 Status
= UNDI32Device
->NicInfo
.Io_Function
->Attributes (
641 UNDI32Device
->NicInfo
.Io_Function
,
642 EfiPciIoAttributeOperationSet
,
643 UNDI32Device
->NicInfo
.OriginalPciAttributes
,
647 ASSERT_EFI_ERROR (Status
);
649 gBS
->FreePool (UNDI32Device
->Undi32DevPath
);
650 gBS
->FreePool (UNDI32Device
);
656 if (EFI_ERROR (Status
)) {
657 AllChildrenStopped
= FALSE
;
661 if (!AllChildrenStopped
) {
662 return EFI_DEVICE_ERROR
;
671 Use the EFI boot services to produce a pause. This is also the routine which
672 gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can
675 @param UnqId Runtime O/S routine might use this, this temp
676 routine does not use it
677 @param MicroSeconds Determines the length of pause.
685 IN UINTN MicroSeconds
688 gBS
->Stall ((UINT32
) MicroSeconds
);
693 Use the PCI IO abstraction to issue memory or I/O reads and writes. This is also the routine which
694 gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can do it's own I/O abstractions.
696 @param UnqId Runtime O/S routine may use this field, this temp
698 @param ReadWrite Determine if it is an I/O or Memory Read/Write
700 @param Len Determines the width of the data operation.
701 @param Port What port to Read/Write from.
702 @param BuffAddr Address to read to or write from.
716 EFI_PCI_IO_PROTOCOL_WIDTH Width
;
717 NIC_DATA_INSTANCE
*AdapterInfo
;
719 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 0;
720 AdapterInfo
= (NIC_DATA_INSTANCE
*) (UINTN
) UnqId
;
723 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 1;
727 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 2;
731 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 3;
737 AdapterInfo
->Io_Function
->Io
.Read (
738 AdapterInfo
->Io_Function
,
743 (VOID
*) (UINTN
) (BuffAddr
)
748 AdapterInfo
->Io_Function
->Io
.Write (
749 AdapterInfo
->Io_Function
,
754 (VOID
*) (UINTN
) (BuffAddr
)
759 AdapterInfo
->Io_Function
->Mem
.Read (
760 AdapterInfo
->Io_Function
,
765 (VOID
*) (UINTN
) (BuffAddr
)
770 AdapterInfo
->Io_Function
->Mem
.Write (
771 AdapterInfo
->Io_Function
,
776 (VOID
*) (UINTN
) (BuffAddr
)
786 Using the NIC data structure information, read the EEPROM to get the MAC address and then allocate space
787 for a new devicepath (**DevPtr) which will contain the original device path the NIC was found on (*BaseDevPtr)
788 and an added MAC node.
790 @param DevPtr Pointer which will point to the newly created device
791 path with the MAC node attached.
792 @param BaseDevPtr Pointer to the device path which the UNDI device
793 driver is latching on to.
794 @param AdapterInfo Pointer to the NIC data structure information which
795 the UNDI driver is layering on..
797 @retval EFI_SUCCESS A MAC address was successfully appended to the Base
799 @retval other Not enough resources available to create new Device
805 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevPtr
,
806 IN EFI_DEVICE_PATH_PROTOCOL
*BaseDevPtr
,
807 IN NIC_DATA_INSTANCE
*AdapterInfo
810 EFI_MAC_ADDRESS MACAddress
;
811 PCI_CONFIG_HEADER
*CfgHdr
;
816 MAC_ADDR_DEVICE_PATH MacAddrNode
;
817 EFI_DEVICE_PATH_PROTOCOL
*EndNode
;
824 // set the environment ready (similar to UNDI_Start call) so that we can
825 // execute the other UNDI_ calls to get the mac address
826 // we are using undi 3.1 style
828 AdapterInfo
->Delay
= TmpDelay
;
829 AdapterInfo
->Virt2Phys
= (VOID
*) 0;
830 AdapterInfo
->Block
= (VOID
*) 0;
831 AdapterInfo
->Map_Mem
= (VOID
*) 0;
832 AdapterInfo
->UnMap_Mem
= (VOID
*) 0;
833 AdapterInfo
->Sync_Mem
= (VOID
*) 0;
834 AdapterInfo
->Mem_Io
= TmpMemIo
;
836 // these tmp call-backs follow 3.1 undi style
837 // i.e. they have the unique_id parameter.
839 AdapterInfo
->VersionFlag
= 0x31;
840 AdapterInfo
->Unique_ID
= (UINT64
) (UINTN
) AdapterInfo
;
845 CfgHdr
= (PCI_CONFIG_HEADER
*) &(AdapterInfo
->Config
[0]);
846 AdapterInfo
->ioaddr
= 0;
847 AdapterInfo
->RevID
= CfgHdr
->RevID
;
849 AddrLen
= E100bGetEepromAddrLen (AdapterInfo
);
851 for (Index
= 0, Index2
= 0; Index
< 3; Index
++) {
852 Val
= E100bReadEeprom (AdapterInfo
, Index
, AddrLen
);
853 MACAddress
.Addr
[Index2
++] = (UINT8
) Val
;
854 MACAddress
.Addr
[Index2
++] = (UINT8
) (Val
>> 8);
857 SetMem (MACAddress
.Addr
+ Index2
, sizeof (EFI_MAC_ADDRESS
) - Index2
, 0);
858 //for (; Index2 < sizeof (EFI_MAC_ADDRESS); Index2++) {
859 // MACAddress.Addr[Index2] = 0;
864 AdapterInfo
->Delay
= (VOID
*) 0;
865 AdapterInfo
->Mem_Io
= (VOID
*) 0;
868 // fill the mac address node first
870 ZeroMem ((CHAR8
*) &MacAddrNode
, sizeof MacAddrNode
);
872 (CHAR8
*) &MacAddrNode
.MacAddress
,
873 (CHAR8
*) &MACAddress
,
874 sizeof (EFI_MAC_ADDRESS
)
877 MacAddrNode
.Header
.Type
= MESSAGING_DEVICE_PATH
;
878 MacAddrNode
.Header
.SubType
= MSG_MAC_ADDR_DP
;
879 MacAddrNode
.Header
.Length
[0] = (UINT8
) sizeof (MacAddrNode
);
880 MacAddrNode
.Header
.Length
[1] = 0;
883 // find the size of the base dev path.
885 EndNode
= BaseDevPtr
;
887 while (!IsDevicePathEnd (EndNode
)) {
888 EndNode
= NextDevicePathNode (EndNode
);
891 BasePathLen
= (UINT16
) ((UINTN
) (EndNode
) - (UINTN
) (BaseDevPtr
));
894 // create space for full dev path
896 TotalPathLen
= (UINT16
) (BasePathLen
+ sizeof (MacAddrNode
) + sizeof (EFI_DEVICE_PATH_PROTOCOL
));
898 Status
= gBS
->AllocatePool (
899 EfiRuntimeServicesData
,
904 if (Status
!= EFI_SUCCESS
) {
908 // copy the base path, mac addr and end_dev_path nodes
910 *DevPtr
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePtr
;
911 CopyMem (DevicePtr
, (CHAR8
*) BaseDevPtr
, BasePathLen
);
912 DevicePtr
+= BasePathLen
;
913 CopyMem (DevicePtr
, (CHAR8
*) &MacAddrNode
, sizeof (MacAddrNode
));
914 DevicePtr
+= sizeof (MacAddrNode
);
915 CopyMem (DevicePtr
, (CHAR8
*) EndNode
, sizeof (EFI_DEVICE_PATH_PROTOCOL
));
922 Install a GUID/Pointer pair into the system's configuration table.
926 @retval EFI_SUCCESS Install a GUID/Pointer pair into the system's
928 @retval other Did not successfully install the GUID/Pointer pair
929 into the configuration table.
932 // TODO: VOID - add argument and description to function comment
939 EFI_CONFIGURATION_TABLE
*CfgPtr
;
940 UNDI_CONFIG_TABLE
*TmpData
;
942 UNDI_CONFIG_TABLE
*UndiData
;
944 if (pxe_31
== NULL
) {
948 if(UndiDataPointer
== NULL
) {
952 UndiData
= (UNDI_CONFIG_TABLE
*)UndiDataPointer
;
954 UndiData
->NumberOfInterfaces
= (pxe_31
->IFcnt
| pxe_31
->IFcntExt
<< 8);
955 UndiData
->nextlink
= NULL
;
957 for (Index
= 0; Index
< (pxe_31
->IFcnt
| pxe_31
->IFcntExt
<< 8); Index
++) {
958 UndiData
->NII_entry
[Index
].NII_InterfacePointer
= &UNDI32DeviceList
[Index
]->NIIProtocol_31
;
959 UndiData
->NII_entry
[Index
].DevicePathPointer
= UNDI32DeviceList
[Index
]->Undi32DevPath
;
963 // see if there is an entry in the config table already
965 CfgPtr
= gST
->ConfigurationTable
;
967 for (Index
= 0; Index
< gST
->NumberOfTableEntries
; Index
++) {
968 Status
= CompareGuid (
970 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
972 if (Status
!= EFI_SUCCESS
) {
979 if (Index
< gST
->NumberOfTableEntries
) {
980 TmpData
= (UNDI_CONFIG_TABLE
*) CfgPtr
->VendorTable
;
983 // go to the last link
985 while (TmpData
->nextlink
!= NULL
) {
986 TmpData
= TmpData
->nextlink
;
989 TmpData
->nextlink
= UndiData
;
994 UndiData
= (UNDI_CONFIG_TABLE
*) CfgPtr
->VendorTable
;
998 // create an entry in the configuration table for our GUID
1000 Status
= gBS
->InstallConfigurationTable (
1001 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
1013 IN EFI_HANDLE ImageHandle
,
1014 IN EFI_SYSTEM_TABLE
*SystemTable
1020 Status
= EfiLibInstallDriverBindingComponentName2 (
1023 &gUndiDriverBinding
,
1025 &gUndiComponentName
,
1026 &gUndiComponentName2
1028 ASSERT_EFI_ERROR (Status
);
1030 Status
= gBS
->CreateEventEx (
1033 UndiNotifyReadyToBoot
,
1035 &gEfiEventReadyToBootGuid
,
1038 ASSERT_EFI_ERROR (Status
);
1040 Status
= gBS
->CreateEventEx (
1045 &gEfiEventVirtualAddressChangeGuid
,
1048 ASSERT_EFI_ERROR (Status
);