3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Initialization functions for EFI UNDI32 driver
29 PXE_SW_UNDI
*pxe
= 0; // 3.0 entry point
30 PXE_SW_UNDI
*pxe_31
= 0; // 3.1 entry
31 UNDI32_DEV
*UNDI32DeviceList
[MAX_NIC_INTERFACES
];
33 NII_TABLE
*UnidiDataPointer
=NULL
;
45 When address mapping changes to virtual this should make the appropriate
50 (Standard Event handler)
57 // TODO: Context - add argument and description to function comment
63 Pxe31Pointer
= (VOID
*) pxe_31
;
67 (VOID
**) &Pxe31Pointer
71 // UNDI32DeviceList is an array of pointers
73 for (Index
= 0; Index
< pxe_31
->IFcnt
; Index
++) {
74 UNDI32DeviceList
[Index
]->NIIProtocol_31
.ID
= (UINT64
) (UINTN
) Pxe31Pointer
;
77 (VOID
**) &(UNDI32DeviceList
[Index
])
83 (VOID
**) &(pxe_31
->EntryPoint
)
85 pxe_31
= Pxe31Pointer
;
88 for (Index
= 0; Index
<= PXE_OPCODE_LAST_VALID
; Index
++) {
91 (VOID
**) &api_table
[Index
].api_ptr
106 When EFI is shuting down the boot services, we need to install a
107 configuration table for UNDI to work at runtime!
111 (Standard Event handler)
118 // TODO: Context - add argument and description to function comment
120 InstallConfigTable ();
123 // UNDI Class Driver Global Variables
125 EFI_DRIVER_BINDING_PROTOCOL gUndiDriverBinding
= {
136 InitializeUNDIDriver (
137 IN EFI_HANDLE ImageHandle
,
138 IN EFI_SYSTEM_TABLE
*SystemTable
144 Register Driver Binding protocol for this driver.
148 ImageHandle - Image Handle
150 SystemTable - Pointer to system table
154 EFI_SUCCESS - Driver loaded.
156 other - Driver not loaded.
163 Status
= gBS
->CreateEvent (
164 EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES
,
176 UndiDriverSupported (
177 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
178 IN EFI_HANDLE Controller
,
179 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
185 Test to see if this driver supports ControllerHandle. Any ControllerHandle
186 than contains a DevicePath, PciIo protocol, Class code of 2, Vendor ID of 0x8086,
187 and DeviceId of (D100_DEVICE_ID || D102_DEVICE_ID || ICH3_DEVICE_ID_1 ||
188 ICH3_DEVICE_ID_2 || ICH3_DEVICE_ID_3 || ICH3_DEVICE_ID_4 || ICH3_DEVICE_ID_5 ||
189 ICH3_DEVICE_ID_6 || ICH3_DEVICE_ID_7 || ICH3_DEVICE_ID_8) can be supported.
193 This - Protocol instance pointer.
195 Controller - Handle of device to test.
197 RemainingDevicePath - Not used.
201 EFI_SUCCESS - This driver supports this device.
203 other - This driver does not support this device.
208 EFI_PCI_IO_PROTOCOL
*PciIo
;
211 Status
= gBS
->OpenProtocol (
213 &gEfiDevicePathProtocolGuid
,
215 This
->DriverBindingHandle
,
217 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
219 if (EFI_ERROR (Status
)) {
223 Status
= gBS
->OpenProtocol (
225 &gEfiPciIoProtocolGuid
,
227 This
->DriverBindingHandle
,
229 EFI_OPEN_PROTOCOL_BY_DRIVER
231 if (EFI_ERROR (Status
)) {
235 Status
= PciIo
->Pci
.Read (
239 sizeof (PCI_CONFIG_HEADER
),
243 if (!EFI_ERROR (Status
)) {
244 Status
= EFI_UNSUPPORTED
;
246 if (Pci
.Hdr
.ClassCode
[2] == 0x02 && Pci
.Hdr
.VendorId
== PCI_VENDOR_ID_INTEL
) {
247 switch (Pci
.Hdr
.DeviceId
) {
250 case ICH3_DEVICE_ID_1
:
251 case ICH3_DEVICE_ID_2
:
252 case ICH3_DEVICE_ID_3
:
253 case ICH3_DEVICE_ID_4
:
254 case ICH3_DEVICE_ID_5
:
255 case ICH3_DEVICE_ID_6
:
256 case ICH3_DEVICE_ID_7
:
257 case ICH3_DEVICE_ID_8
:
274 Status
= EFI_SUCCESS
;
281 &gEfiPciIoProtocolGuid
,
282 This
->DriverBindingHandle
,
292 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
293 IN EFI_HANDLE Controller
,
294 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
300 Start this driver on Controller by opening PciIo and DevicePath protocol.
301 Initialize PXE structures, create a copy of the Controller Device Path with the
302 NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol
303 on the newly created Device Path.
307 This - Protocol instance pointer.
309 Controller - Handle of device to work with.
311 RemainingDevicePath - Not used, always produce all possible children.
315 EFI_SUCCESS - This driver is added to Controller.
317 other - This driver does not support this device.
322 EFI_DEVICE_PATH_PROTOCOL
*UndiDevicePath
;
323 PCI_CONFIG_HEADER
*CfgHdr
;
324 UNDI32_DEV
*UNDI32Device
;
326 UINT8
*TmpPxePointer
;
327 EFI_PCI_IO_PROTOCOL
*PciIoFncs
;
330 Status
= gBS
->OpenProtocol (
332 &gEfiPciIoProtocolGuid
,
333 (VOID
**) &PciIoFncs
,
334 This
->DriverBindingHandle
,
336 EFI_OPEN_PROTOCOL_BY_DRIVER
339 if (EFI_ERROR (Status
)) {
343 Status
= gBS
->OpenProtocol (
345 &gEfiDevicePathProtocolGuid
,
346 (VOID
**) &UndiDevicePath
,
347 This
->DriverBindingHandle
,
349 EFI_OPEN_PROTOCOL_BY_DRIVER
352 if (EFI_ERROR (Status
)) {
355 &gEfiPciIoProtocolGuid
,
356 This
->DriverBindingHandle
,
363 Status
= gBS
->AllocatePool (
364 EfiRuntimeServicesData
,
366 (VOID
**) &UNDI32Device
369 if (EFI_ERROR (Status
)) {
373 ZeroMem ((CHAR8
*) UNDI32Device
, sizeof (UNDI32_DEV
));
376 // allocate and initialize both (old and new) the !pxe structures here,
377 // there should only be one copy of each of these structure for any number
378 // of NICs this undi supports. Also, these structures need to be on a
379 // paragraph boundary as per the spec. so, while allocating space for these,
380 // make sure that there is space for 2 !pxe structures (old and new) and a
381 // 32 bytes padding for alignment adjustment (in case)
383 TmpPxePointer
= NULL
;
384 if (pxe_31
== NULL
) {
385 Status
= gBS
->AllocatePool (
386 EfiRuntimeServicesData
,
387 (sizeof (PXE_SW_UNDI
) + sizeof (PXE_SW_UNDI
) + 32),
388 (VOID
**) &TmpPxePointer
391 if (EFI_ERROR (Status
)) {
392 goto UndiErrorDeleteDevice
;
397 sizeof (PXE_SW_UNDI
) + sizeof (PXE_SW_UNDI
) + 32
400 // check for paragraph alignment here, assuming that the pointer is
401 // already 8 byte aligned.
403 if (((UINTN
) TmpPxePointer
& 0x0F) != 0) {
404 pxe_31
= (PXE_SW_UNDI
*) ((UINTN
) (TmpPxePointer
+ 8));
406 pxe_31
= (PXE_SW_UNDI
*) TmpPxePointer
;
409 // assuming that the sizeof pxe_31 is a 16 byte multiple
411 pxe
= (PXE_SW_UNDI
*) ((CHAR8
*) (pxe_31
) + sizeof (PXE_SW_UNDI
));
413 PxeStructInit (pxe
, 0x30);
414 PxeStructInit (pxe_31
, 0x31);
417 UNDI32Device
->NIIProtocol
.ID
= (UINT64
) (UINTN
) (pxe
);
418 UNDI32Device
->NIIProtocol_31
.ID
= (UINT64
) (UINTN
) (pxe_31
);
420 Status
= PciIoFncs
->Attributes (
422 EfiPciIoAttributeOperationEnable
,
423 EFI_PCI_DEVICE_ENABLE
| EFI_PCI_IO_ATTRIBUTE_MEMORY
| EFI_PCI_IO_ATTRIBUTE_IO
| EFI_PCI_IO_ATTRIBUTE_BUS_MASTER
,
427 // Read all the registers from device's PCI Configuration space
429 Status
= PciIoFncs
->Pci
.Read (
434 &UNDI32Device
->NicInfo
.Config
437 CfgHdr
= (PCI_CONFIG_HEADER
*) &(UNDI32Device
->NicInfo
.Config
[0]);
440 // make sure that this device is a PCI bus master
443 NewCommand
= (UINT16
) (CfgHdr
->Command
| PCI_COMMAND_MASTER
| PCI_COMMAND_IO
);
444 if (CfgHdr
->Command
!= NewCommand
) {
445 PciIoFncs
->Pci
.Write (
452 CfgHdr
->Command
= NewCommand
;
456 // make sure that the latency timer is at least 32
458 if (CfgHdr
->LatencyTimer
< 32) {
459 CfgHdr
->LatencyTimer
= 32;
460 PciIoFncs
->Pci
.Write (
465 &CfgHdr
->LatencyTimer
469 // the IfNum index for the current interface will be the total number
470 // of interfaces initialized so far
472 UNDI32Device
->NIIProtocol
.IfNum
= pxe
->IFcnt
;
473 UNDI32Device
->NIIProtocol_31
.IfNum
= pxe_31
->IFcnt
;
475 PxeUpdate (&UNDI32Device
->NicInfo
, pxe
);
476 PxeUpdate (&UNDI32Device
->NicInfo
, pxe_31
);
478 UNDI32Device
->NicInfo
.Io_Function
= PciIoFncs
;
479 UNDI32DeviceList
[UNDI32Device
->NIIProtocol
.IfNum
] = UNDI32Device
;
480 UNDI32Device
->Undi32BaseDevPath
= UndiDevicePath
;
482 Status
= AppendMac2DevPath (
483 &UNDI32Device
->Undi32DevPath
,
484 UNDI32Device
->Undi32BaseDevPath
,
485 &UNDI32Device
->NicInfo
489 goto UndiErrorDeletePxe
;
492 UNDI32Device
->Signature
= UNDI_DEV_SIGNATURE
;
494 UNDI32Device
->NIIProtocol
.Revision
= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
;
495 UNDI32Device
->NIIProtocol
.Type
= EfiNetworkInterfaceUndi
;
496 UNDI32Device
->NIIProtocol
.MajorVer
= PXE_ROMID_MAJORVER
;
497 UNDI32Device
->NIIProtocol
.MinorVer
= PXE_ROMID_MINORVER
;
498 UNDI32Device
->NIIProtocol
.ImageSize
= 0;
499 UNDI32Device
->NIIProtocol
.ImageAddr
= 0;
500 UNDI32Device
->NIIProtocol
.Ipv6Supported
= FALSE
;
502 UNDI32Device
->NIIProtocol
.StringId
[0] = 'U';
503 UNDI32Device
->NIIProtocol
.StringId
[1] = 'N';
504 UNDI32Device
->NIIProtocol
.StringId
[2] = 'D';
505 UNDI32Device
->NIIProtocol
.StringId
[3] = 'I';
507 UNDI32Device
->NIIProtocol_31
.Revision
= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31
;
508 UNDI32Device
->NIIProtocol_31
.Type
= EfiNetworkInterfaceUndi
;
509 UNDI32Device
->NIIProtocol_31
.MajorVer
= PXE_ROMID_MAJORVER
;
510 UNDI32Device
->NIIProtocol_31
.MinorVer
= PXE_ROMID_MINORVER_31
;
511 UNDI32Device
->NIIProtocol_31
.ImageSize
= 0;
512 UNDI32Device
->NIIProtocol_31
.ImageAddr
= 0;
513 UNDI32Device
->NIIProtocol_31
.Ipv6Supported
= FALSE
;
515 UNDI32Device
->NIIProtocol_31
.StringId
[0] = 'U';
516 UNDI32Device
->NIIProtocol_31
.StringId
[1] = 'N';
517 UNDI32Device
->NIIProtocol_31
.StringId
[2] = 'D';
518 UNDI32Device
->NIIProtocol_31
.StringId
[3] = 'I';
520 UNDI32Device
->DeviceHandle
= NULL
;
523 // install both the 3.0 and 3.1 NII protocols.
525 Status
= gBS
->InstallMultipleProtocolInterfaces (
526 &UNDI32Device
->DeviceHandle
,
527 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
528 &UNDI32Device
->NIIProtocol_31
,
529 &gEfiNetworkInterfaceIdentifierProtocolGuid
,
530 &UNDI32Device
->NIIProtocol
,
531 &gEfiDevicePathProtocolGuid
,
532 UNDI32Device
->Undi32DevPath
,
536 if (EFI_ERROR (Status
)) {
537 goto UndiErrorDeleteDevicePath
;
541 // if the table exists, free it and alloc again, or alloc it directly
543 if (UnidiDataPointer
!= NULL
) {
544 Status
= gBS
->FreePool(UnidiDataPointer
);
546 if (EFI_ERROR (Status
)) {
547 goto UndiErrorDeleteDevicePath
;
550 Len
= (pxe_31
->IFcnt
* sizeof (NII_ENTRY
)) + sizeof (UnidiDataPointer
);
551 Status
= gBS
->AllocatePool (EfiRuntimeServicesData
, Len
, (VOID
**) &UnidiDataPointer
);
553 if (EFI_ERROR (Status
)) {
554 goto UndiErrorAllocDataPointer
;
558 // Open For Child Device
560 Status
= gBS
->OpenProtocol (
562 &gEfiPciIoProtocolGuid
,
563 (VOID
**) &PciIoFncs
,
564 This
->DriverBindingHandle
,
565 UNDI32Device
->DeviceHandle
,
566 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
570 UndiErrorAllocDataPointer
:
571 gBS
->UninstallMultipleProtocolInterfaces (
572 &UNDI32Device
->DeviceHandle
,
573 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
574 &UNDI32Device
->NIIProtocol_31
,
575 &gEfiNetworkInterfaceIdentifierProtocolGuid
,
576 &UNDI32Device
->NIIProtocol
,
577 &gEfiDevicePathProtocolGuid
,
578 UNDI32Device
->Undi32DevPath
,
582 UndiErrorDeleteDevicePath
:
583 UNDI32DeviceList
[UNDI32Device
->NIIProtocol
.IfNum
] = NULL
;
584 gBS
->FreePool (UNDI32Device
->Undi32DevPath
);
587 PxeUpdate (NULL
, pxe
);
588 PxeUpdate (NULL
, pxe_31
);
589 if (TmpPxePointer
!= NULL
) {
590 gBS
->FreePool (TmpPxePointer
);
594 UndiErrorDeleteDevice
:
595 gBS
->FreePool (UNDI32Device
);
600 &gEfiDevicePathProtocolGuid
,
601 This
->DriverBindingHandle
,
607 &gEfiPciIoProtocolGuid
,
608 This
->DriverBindingHandle
,
618 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
619 IN EFI_HANDLE Controller
,
620 IN UINTN NumberOfChildren
,
621 IN EFI_HANDLE
*ChildHandleBuffer
626 Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
627 closing the DevicePath and PciIo protocols on Controller.
630 This - Protocol instance pointer.
631 Controller - Handle of device to stop driver on.
632 NumberOfChildren - How many children need to be stopped.
633 ChildHandleBuffer - Not used.
636 EFI_SUCCESS - This driver is removed Controller.
637 other - This driver was not removed from this device.
640 // TODO: EFI_DEVICE_ERROR - add return value to function comment
643 BOOLEAN AllChildrenStopped
;
645 UNDI32_DEV
*UNDI32Device
;
646 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*NIIProtocol
;
647 EFI_PCI_IO_PROTOCOL
*PciIo
;
650 // Complete all outstanding transactions to Controller.
651 // Don't allow any new transaction to Controller to be started.
653 if (NumberOfChildren
== 0) {
656 // Close the bus driver
658 Status
= gBS
->CloseProtocol (
660 &gEfiDevicePathProtocolGuid
,
661 This
->DriverBindingHandle
,
665 Status
= gBS
->CloseProtocol (
667 &gEfiPciIoProtocolGuid
,
668 This
->DriverBindingHandle
,
675 AllChildrenStopped
= TRUE
;
677 for (Index
= 0; Index
< NumberOfChildren
; Index
++) {
679 Status
= gBS
->OpenProtocol (
680 ChildHandleBuffer
[Index
],
681 &gEfiNetworkInterfaceIdentifierProtocolGuid
,
682 (VOID
**) &NIIProtocol
,
683 This
->DriverBindingHandle
,
685 EFI_OPEN_PROTOCOL_GET_PROTOCOL
687 if (!EFI_ERROR (Status
)) {
689 UNDI32Device
= UNDI_DEV_FROM_THIS (NIIProtocol
);
691 Status
= gBS
->CloseProtocol (
693 &gEfiPciIoProtocolGuid
,
694 This
->DriverBindingHandle
,
695 ChildHandleBuffer
[Index
]
698 Status
= gBS
->UninstallMultipleProtocolInterfaces (
699 ChildHandleBuffer
[Index
],
700 &gEfiDevicePathProtocolGuid
,
701 UNDI32Device
->Undi32DevPath
,
702 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,
703 &UNDI32Device
->NIIProtocol_31
,
704 &gEfiNetworkInterfaceIdentifierProtocolGuid
,
705 &UNDI32Device
->NIIProtocol
,
709 if (EFI_ERROR (Status
)) {
712 &gEfiPciIoProtocolGuid
,
714 This
->DriverBindingHandle
,
715 ChildHandleBuffer
[Index
],
716 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
719 gBS
->FreePool (UNDI32Device
->Undi32DevPath
);
720 gBS
->FreePool (UNDI32Device
);
724 if (EFI_ERROR (Status
)) {
725 AllChildrenStopped
= FALSE
;
729 if (!AllChildrenStopped
) {
730 return EFI_DEVICE_ERROR
;
740 IN UINTN MicroSeconds
746 Use the EFI boot services to produce a pause. This is also the routine which
747 gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can
752 UnqId - Runtime O/S routine might use this, this temp routine does not use it
754 MicroSeconds - Determines the length of pause.
762 gBS
->Stall ((UINT32
) MicroSeconds
);
777 Use the PCI IO abstraction to issue memory or I/O reads and writes. This is also the routine which
778 gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can do it's own I/O abstractions.
782 UnqId - Runtime O/S routine may use this field, this temp routine does not.
784 ReadWrite - Determine if it is an I/O or Memory Read/Write Operation.
786 Len - Determines the width of the data operation.
788 Port - What port to Read/Write from.
790 BuffAddr - Address to read to or write from.
798 EFI_PCI_IO_PROTOCOL_WIDTH Width
;
799 NIC_DATA_INSTANCE
*AdapterInfo
;
801 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 0;
802 AdapterInfo
= (NIC_DATA_INSTANCE
*) (UINTN
) UnqId
;
805 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 1;
809 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 2;
813 Width
= (EFI_PCI_IO_PROTOCOL_WIDTH
) 3;
819 AdapterInfo
->Io_Function
->Io
.Read (
820 AdapterInfo
->Io_Function
,
825 (VOID
*) (UINTN
) (BuffAddr
)
830 AdapterInfo
->Io_Function
->Io
.Write (
831 AdapterInfo
->Io_Function
,
836 (VOID
*) (UINTN
) (BuffAddr
)
841 AdapterInfo
->Io_Function
->Mem
.Read (
842 AdapterInfo
->Io_Function
,
847 (VOID
*) (UINTN
) (BuffAddr
)
852 AdapterInfo
->Io_Function
->Mem
.Write (
853 AdapterInfo
->Io_Function
,
858 (VOID
*) (UINTN
) (BuffAddr
)
868 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevPtr
,
869 IN EFI_DEVICE_PATH_PROTOCOL
*BaseDevPtr
,
870 IN NIC_DATA_INSTANCE
*AdapterInfo
876 Using the NIC data structure information, read the EEPROM to get the MAC address and then allocate space
877 for a new devicepath (**DevPtr) which will contain the original device path the NIC was found on (*BaseDevPtr)
878 and an added MAC node.
882 DevPtr - Pointer which will point to the newly created device path with the MAC node attached.
884 BaseDevPtr - Pointer to the device path which the UNDI device driver is latching on to.
886 AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
890 EFI_SUCCESS - A MAC address was successfully appended to the Base Device Path.
892 other - Not enough resources available to create new Device Path node.
896 EFI_MAC_ADDRESS MACAddress
;
897 PCI_CONFIG_HEADER
*CfgHdr
;
902 MAC_ADDR_DEVICE_PATH MacAddrNode
;
903 EFI_DEVICE_PATH_PROTOCOL
*EndNode
;
910 // set the environment ready (similar to UNDI_Start call) so that we can
911 // execute the other UNDI_ calls to get the mac address
912 // we are using undi 3.1 style
914 AdapterInfo
->Delay
= TmpDelay
;
915 AdapterInfo
->Virt2Phys
= (VOID
*) 0;
916 AdapterInfo
->Block
= (VOID
*) 0;
917 AdapterInfo
->Map_Mem
= (VOID
*) 0;
918 AdapterInfo
->UnMap_Mem
= (VOID
*) 0;
919 AdapterInfo
->Sync_Mem
= (VOID
*) 0;
920 AdapterInfo
->Mem_Io
= TmpMemIo
;
922 // these tmp call-backs follow 3.1 undi style
923 // i.e. they have the unique_id parameter.
925 AdapterInfo
->VersionFlag
= 0x31;
926 AdapterInfo
->Unique_ID
= (UINT64
) (UINTN
) AdapterInfo
;
931 CfgHdr
= (PCI_CONFIG_HEADER
*) &(AdapterInfo
->Config
[0]);
932 AdapterInfo
->ioaddr
= 0;
933 AdapterInfo
->RevID
= CfgHdr
->RevID
;
935 AddrLen
= E100bGetEepromAddrLen (AdapterInfo
);
937 for (Index
= 0, Index2
= 0; Index
< 3; Index
++) {
938 Val
= E100bReadEeprom (AdapterInfo
, Index
, AddrLen
);
939 MACAddress
.Addr
[Index2
++] = (UINT8
) Val
;
940 MACAddress
.Addr
[Index2
++] = (UINT8
) (Val
>> 8);
943 SetMem (MACAddress
.Addr
+ Index2
, sizeof (EFI_MAC_ADDRESS
) - Index2
, 0);
944 //for (; Index2 < sizeof (EFI_MAC_ADDRESS); Index2++) {
945 // MACAddress.Addr[Index2] = 0;
950 AdapterInfo
->Delay
= (VOID
*) 0;
951 AdapterInfo
->Mem_Io
= (VOID
*) 0;
954 // fill the mac address node first
956 ZeroMem ((CHAR8
*) &MacAddrNode
, sizeof MacAddrNode
);
958 (CHAR8
*) &MacAddrNode
.MacAddress
,
959 (CHAR8
*) &MACAddress
,
960 sizeof (EFI_MAC_ADDRESS
)
963 MacAddrNode
.Header
.Type
= MESSAGING_DEVICE_PATH
;
964 MacAddrNode
.Header
.SubType
= MSG_MAC_ADDR_DP
;
965 MacAddrNode
.Header
.Length
[0] = sizeof (MacAddrNode
);
966 MacAddrNode
.Header
.Length
[1] = 0;
969 // find the size of the base dev path.
971 EndNode
= BaseDevPtr
;
973 while (!IsDevicePathEnd (EndNode
)) {
974 EndNode
= NextDevicePathNode (EndNode
);
977 BasePathLen
= (UINT16
) ((UINTN
) (EndNode
) - (UINTN
) (BaseDevPtr
));
980 // create space for full dev path
982 TotalPathLen
= (UINT16
) (BasePathLen
+ sizeof (MacAddrNode
) + sizeof (EFI_DEVICE_PATH_PROTOCOL
));
984 Status
= gBS
->AllocatePool (
985 EfiRuntimeServicesData
,
990 if (Status
!= EFI_SUCCESS
) {
994 // copy the base path, mac addr and end_dev_path nodes
996 *DevPtr
= (EFI_DEVICE_PATH_PROTOCOL
*) DevicePtr
;
997 CopyMem (DevicePtr
, (CHAR8
*) BaseDevPtr
, BasePathLen
);
998 DevicePtr
+= BasePathLen
;
999 CopyMem (DevicePtr
, (CHAR8
*) &MacAddrNode
, sizeof (MacAddrNode
));
1000 DevicePtr
+= sizeof (MacAddrNode
);
1001 CopyMem (DevicePtr
, (CHAR8
*) EndNode
, sizeof (EFI_DEVICE_PATH_PROTOCOL
));
1007 InstallConfigTable (
1012 Routine Description:
1014 Install a GUID/Pointer pair into the system's configuration table.
1022 EFI_SUCCESS - Install a GUID/Pointer pair into the system's configuration table.
1024 other - Did not successfully install the GUID/Pointer pair into the configuration table.
1027 // TODO: VOID - add argument and description to function comment
1030 EFI_CONFIGURATION_TABLE
*CfgPtr
;
1033 NII_TABLE
*UndiData
;
1035 if (pxe_31
== NULL
) {
1039 if(UnidiDataPointer
== NULL
) {
1043 UndiData
= (NII_TABLE
*)UnidiDataPointer
;
1045 UndiData
->NumEntries
= pxe_31
->IFcnt
;
1046 UndiData
->NextLink
= NULL
;
1048 for (Index
= 0; Index
< pxe_31
->IFcnt
; Index
++) {
1049 UndiData
->NiiEntry
[Index
].InterfacePointer
= &UNDI32DeviceList
[Index
]->NIIProtocol_31
;
1050 UndiData
->NiiEntry
[Index
].DevicePathPointer
= UNDI32DeviceList
[Index
]->Undi32DevPath
;
1054 // see if there is an entry in the config table already
1056 CfgPtr
= gST
->ConfigurationTable
;
1058 for (Index
= 0; Index
< gST
->NumberOfTableEntries
; Index
++) {
1059 Status
= CompareGuid (
1060 &CfgPtr
->VendorGuid
,
1061 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
1063 if (Status
!= EFI_SUCCESS
) {
1070 if (Index
< gST
->NumberOfTableEntries
) {
1071 TmpData
= (NII_TABLE
*) CfgPtr
->VendorTable
;
1074 // go to the last link
1076 while (TmpData
->NextLink
!= NULL
) {
1077 TmpData
= TmpData
->NextLink
;
1080 TmpData
->NextLink
= UndiData
;
1085 UndiData
= (NII_TABLE
*) CfgPtr
->VendorTable
;
1089 // create an entry in the configuration table for our GUID
1091 Status
= gBS
->InstallConfigurationTable (
1092 &gEfiNetworkInterfaceIdentifierProtocolGuid_31
,