# UefiPxeBcDxe

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **PxeBcDebugPrint** |  |
|  | **PxeBcDriverEntryPoint** |  |
|  | **PxeBcDriverBindingSupported** |  |
|  | **PxeBcDriverBindingStart** |  |
|  | **PxeBcDriverBindingStop** |  |
|  | **PXeBcStart** |  |
|  | **PxeBcStop** |  |
|  | **PxeBcDhcp** |  |
|  | **PXeBcDiscover** |  |
|  | **PxeBcMtftp** |  |
|  | **PxeBcUdpWrite** |  |
|  | **PxeBcUdpRead** |  |
|  | **PxeBcSetIpFilters** |  |
|  | **PxeBcArp** |  |
|  | **PxeBcSetParameters** |  |
|  | **PxeBcSetStationIp** |  |
|  | **PxeBcSetPackets** |  |
|  | **PxeBcCheckIpv6Support** |  |
|  | **PxeBcCreateChildren** |  |
|  | **PxeBcDestroyChild** |  |
|  | **PxeBcWaitForEsc** |  |
|  | **PxeBcPrintMacAddr** |  |
|  | **PxeBcModeReset** |  |
|  | **PxeBcBuildDhcp4Options** |  |
|  | **PxeBcSaveBootFile** |  |
|  | **PxeBcBootPrompt** |  |
| Global | **variables** |  |
| EFI_HANDLE | **gImageHandle   = NULL;** |  |
| NetworkStackVar | **configuration - timeout values read from NVRAM** |  |
| UINT8 | **n257           = 0;   // Default PXE timeout** |  |
| Extended | **timeout** |  |
| Protocol | **GUIDs (defined in external .rdata section)** |  |
| These | **are referenced via offsets into .rdata at known locations.** |  |
| The | **GUIDs match the standard UEFI PXE Base Code protocol GUID** |  |
| Forward | **declarations** |  |
| VOID | **PxeBcDebugPrint (** |  |
| Initialize | **global state via UefiBootServicesTableLib constructor** |  |
| Status | **= UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);** |  |
| Locate | **required HII protocols** |  |
| Status | **= gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, &gHiiConfigRouting);** |  |
| Locate | **DPC protocol and LNV Send IPMI Command library** |  |
| Status | **= gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, &gDpcProtocol);** |  |
| DPC | **protocol is optional; try to install our own** |  |
| Status | **= gBS->InstallMultipleProtocolInterfaces (** |  |
| Read | **NetworkStackVar NVRAM variable for configuration** |  |
| Check | **for PXE boot pre-context variable** |  |
| if | **(!PxeBcPreBootContextValid ()) {** |  |
| Install | **the driver binding and component name protocols** |  |
| Register | **the unload handler** |  |
| return | **gBS->HandleProtocol (** |  |
| Driver | **Binding Protocol** |  |
| Check | **if the controller has the Network Interface Identifier Protocol** |  |
| Status | **= gBS->OpenProtocol (** |  |
| Check | **for IPv6 support** |  |
| if | **(!PxeBcCheckpvv6Support (ControllerHandle, &Ipv6Supported)) {** |  |
| Allocate | **the private data structure** |  |
| Private | **= AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA));** |  |
| Read | **timeout configuration from NVRAM** |  |
| VariableSize | **= sizeof (TimeOut);** |  |
| Create | **the children (open UDP4, DHCP4, ARP, etc.)** |  |
| Status | **= PxeBcCreateChildren (Private, FALSE);** |  |
| Install | **the PXE Base Code Protocol on a new child handle** |  |
| Register | **the callback for pre-boot context** |  |
| PxeBcRegisterPreBootContext | **(Private);** |  |
| Allocate | **mode structure** |  |
| if | **(UseIpv6) {** |  |
| Set | **the receive filter to promiscuous** |  |
| PxeBcSetIpFilters | **(This, NULL);** |  |
| Reset | **the PXE mode state** |  |
| Check | **media status** |  |
| if | **(!PxeBcCheckMediaStatus (Private)) {** |  |
| Reset | **cache state** |  |
| Status | **= PxeBcDhcp6Solicit (Private, Private->Dhcp6, NULL);** |  |
| Parse | **the advertises and select best offer** |  |
| Status | **= PxeBcDhcp6SelectOffer (Private);** |  |
| Status | **= PxeBcDhcp4Discover (Private, Private->Dhcp4, NULL);** |  |
| Validate | **boot server type** |  |
| if | **((Type < 1 || Type > 3) && Type != 5) {** |  |
| Set | **mode state to boot server discovery** |  |
| Perform | **boot server discovery via DHCP or DNS** |  |
| if | **(Private->Mode->UsingIpv6) {** |  |
| Validate | **the buffer size** |  |
| if | **(*BufferSize < 0x200) {** |  |
| Route | **to IPv4 or IPv6 implementation** |  |
| Validate | **flag/address combinations** |  |
| if | **((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_MULTICAST) &&** |  |
| Multicast | **write not supported on IPv6** |  |
| return | **EFI_INVALID_PARAMETER;** |  |
| Route | **to appropriate UDP write path** |  |
| Validate | **the filter** |  |
| if | **(NewFilter->Filters == EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS ||** |  |
| Apply | **multicast group addresses** |  |
| return | **ApplyIpFilter (Private, NewFilter);** |  |
| Use | **the ARP protocol if available** |  |
| if | **(Private->Arp != NULL && !Private->Mode->UsingIpv6) {** |  |
| For | **IPv6, use ND (Neighbor Discovery) instead of ARP** |  |
| return | **EFI_NO_MAPPING;** |  |
| Update | **the mode parameters if provided** |  |
| if | **(NewAutoArp != NULL) {** |  |
| Zero | **TTL is invalid** |  |
| If | **UsingIpv6, NewSubnetMask is ignored** |  |
| Cannot | **set station IP to multicast** |  |
| Apply | **the configuration** |  |
| Set | **flags** |  |
| if | **(NewDhcpDiscoverValid != NULL) {** |  |
| Copy | **packet data** |  |
| if | **(NewDhcpDiscover != NULL) {** |  |
| Internal | **helper functions** |  |
| Try | **to open the IPv6 stack protocol** |  |
| Status | **= gBS->HandleProtocol (** |  |
| Check | **if the interface actually has an IPv6 address configured** |  |
| Status | **= CheckIpv6AddressAvailable (ImageHandle);** |  |
| Open | **DHCP6 service binding** |  |
| Create | **DHCP6 child** |  |
| Status | **= Private->Dhcp6->CreateChild (Private->Dhcp6, &Private->Dhcp6ChildHandle);** |  |
| Open | **UDP6 service binding** |  |
| Open | **DHCP4 service binding** |  |
| Create | **DHCP4 child** |  |
| Status | **= Private->Dhcp4->CreateChild (Private->Dhcp4, &Private->Dhcp4ChildHandle);** |  |
| Open | **UDP4 service binding** |  |
| Create | **UDP4 read/write tokens** |  |
| Stop | **if started** |  |
| if | **(Private->Mode != NULL && Private->Mode->Started) {** |  |
| Destroy | **DHCP and UDP children** |  |
| if | **(Private->Udp4 != NULL) {** |  |
| Free | **the mode buffer** |  |
| if | **(Private->Mode != NULL) {** |  |
| Free | **the private data itself** |  |
| Wait | **in 100ms increments** |  |
| WaitCount | **= TimeoutSeconds * 10;** |  |
| Check | **if key is available** |  |
| Status | **= gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);** |  |
| 100ms | **}** |  |
| Save | **IPv6 capability flags** |  |
| Ipv6Available | **= Mode->Ipv6Available;** |  |
| Clear | **the mode structure (size ~10424 bytes)** |  |
| ZeroMem | **(Mode, sizeof (EFI_PXE_BASE_CODE_MODE));** |  |
| Restore | **IPv6 flags** |  |
| Clear | **DHCP cache** |  |
| Boot | **file info** |  |
| Clear | **tokens** |  |
| if | **(Private->Udp4ReceiveToken != NULL) {** |  |
| Option | **57 (0x39): PXE Client ID / Class ID** |  |
| if | **(Count < OptCount) {** |  |
| Arch | **type** |  |
| reserved | **OptList[Count]->Data[2]   = 0;    // reserved** |  |
| Write | **the Boot#### variable** |  |
| This | **function reads the current BootCurrent variable, constructs a** |  |
| new | **Boot#### variable pointing to the downloaded NBP file, and** |  |
| writes | **it to NVRAM so that subsequent boots can load the same file** |  |
| without | **doing PXE again.** |  |
| Display | **boot prompt and wait for ESC to abort** |  |
| This | **function handles the "Press ESC key to abort PXE boot" prompt** |  |
| during | **the DHCP/PXE discovery phase.** |  |
| DEBUG | **((DEBUG_INFO, "\n>>Start PXE over %s\n"** |  |

---
*Generated by HR650X BIOS Decompilation Project*