Use default UNDI information if NII protocol not exists.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8082 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-04-14 08:52:06 +00:00
parent 05c7cb5d8e
commit 169a34619b
5 changed files with 30 additions and 14 deletions

View File

@ -1019,9 +1019,15 @@ PxeBcBuildDhcpOptions (
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UNDI; OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UNDI;
OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UNDI); OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UNDI);
OptEnt.Undi = (PXEBC_DHCP4_OPTION_UNDI *) OptList[Index]->Data; OptEnt.Undi = (PXEBC_DHCP4_OPTION_UNDI *) OptList[Index]->Data;
if (Private->Nii != NULL) {
OptEnt.Undi->Type = Private->Nii->Type; OptEnt.Undi->Type = Private->Nii->Type;
OptEnt.Undi->MajorVer = Private->Nii->MajorVer; OptEnt.Undi->MajorVer = Private->Nii->MajorVer;
OptEnt.Undi->MinorVer = Private->Nii->MinorVer; OptEnt.Undi->MinorVer = Private->Nii->MinorVer;
} else {
OptEnt.Undi->Type = DEFAULT_UNDI_TYPE;
OptEnt.Undi->MajorVer = DEFAULT_UNDI_MAJOR;
OptEnt.Undi->MinorVer = DEFAULT_UNDI_MINOR;
}
Index++; Index++;
OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]); OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]);
@ -1045,9 +1051,16 @@ PxeBcBuildDhcpOptions (
OptEnt.Clid = (PXEBC_DHCP4_OPTION_CLID *) OptList[Index]->Data; OptEnt.Clid = (PXEBC_DHCP4_OPTION_CLID *) OptList[Index]->Data;
CopyMem (OptEnt.Clid, DEFAULT_CLASS_ID_DATA, sizeof (PXEBC_DHCP4_OPTION_CLID)); CopyMem (OptEnt.Clid, DEFAULT_CLASS_ID_DATA, sizeof (PXEBC_DHCP4_OPTION_CLID));
CvtNum (SYS_ARCH, OptEnt.Clid->ArchitectureType, sizeof (OptEnt.Clid->ArchitectureType)); CvtNum (SYS_ARCH, OptEnt.Clid->ArchitectureType, sizeof (OptEnt.Clid->ArchitectureType));
if (Private->Nii != NULL) {
//
// If NII protocol exists, update DHCP option data
//
CopyMem (OptEnt.Clid->InterfaceName, Private->Nii->StringId, sizeof (OptEnt.Clid->InterfaceName)); CopyMem (OptEnt.Clid->InterfaceName, Private->Nii->StringId, sizeof (OptEnt.Clid->InterfaceName));
CvtNum (Private->Nii->MajorVer, OptEnt.Clid->UndiMajor, sizeof (OptEnt.Clid->UndiMajor)); CvtNum (Private->Nii->MajorVer, OptEnt.Clid->UndiMajor, sizeof (OptEnt.Clid->UndiMajor));
CvtNum (Private->Nii->MinorVer, OptEnt.Clid->UndiMinor, sizeof (OptEnt.Clid->UndiMinor)); CvtNum (Private->Nii->MinorVer, OptEnt.Clid->UndiMinor, sizeof (OptEnt.Clid->UndiMinor));
}
Index++; Index++;
return Index; return Index;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Dhcp and Discover routines for PxeBc. Dhcp and Discover routines for PxeBc.
Copyright (c) 2007, 2009, Intel Corporation.<BR> Copyright (c) 2007 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -193,7 +193,10 @@ typedef struct {
UINT16 Type; UINT16 Type;
} PXEBC_DHCP4_OPTION_ARCH; } PXEBC_DHCP4_OPTION_ARCH;
#define DEFAULT_CLASS_ID_DATA "PXEClient:Arch:?????:????:??????" #define DEFAULT_CLASS_ID_DATA "PXEClient:Arch:xxxxx:UNDI:003000"
#define DEFAULT_UNDI_TYPE 1
#define DEFAULT_UNDI_MAJOR 3
#define DEFAULT_UNDI_MINOR 0
typedef struct { typedef struct {
UINT8 ClassIdentifier[10]; UINT8 ClassIdentifier[10];

View File

@ -174,7 +174,7 @@ PxeBcDriverBindingStart (
} }
// //
// Get the NII interface // Get the NII interface if it exists.
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
ControllerHandle, ControllerHandle,
@ -185,7 +185,7 @@ PxeBcDriverBindingStart (
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto ON_ERROR; Private->Nii = NULL;
} }
Status = NetLibCreateServiceChild ( Status = NetLibCreateServiceChild (

View File

@ -1,7 +1,7 @@
/** @file /** @file
PxeBc MTFTP functions. PxeBc MTFTP functions.
Copyright (c) 2007, 2009, Intel Corporation.<BR> Copyright (c) 2007 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -158,7 +158,7 @@ PxeBcTftpGetFileSize (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) { if (Status == EFI_TFTP_ERROR) {
Private->Mode.TftpErrorReceived = TRUE; Private->Mode.TftpErrorReceived = TRUE;
Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode; Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;
AsciiStrnCpy ( AsciiStrnCpy (

View File

@ -1,7 +1,7 @@
#/** @file #/** @file
# Component name for module UefiPxeBc # Component name for module UefiPxeBc
# #
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved. # Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.
# #
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -92,7 +92,7 @@
gEfiLoadFileProtocolGuid # PROTOCOL ALWAYS_PRODUCED gEfiLoadFileProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiUdp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiUdp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiNetworkInterfaceIdentifierProtocolGuid_31 # PROTOCOL ALWAYS_CONSUMED gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## SOMETIMES_CONSUMES
gEfiIp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiIp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiIp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiIp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED