Hi all, I'm terribly sorry that I cannot follow emails in my gmail inbox, since gmail is blocked by China govement, as many of you may have already known. I'm a HP employee in China and we are going through the splitting process, so the blade server I was using were packed up and should be moved into a new room. I will try the latest source if possible. Thank you very much for your works. Da Shi Cao On Fri, Jun 26, 2015 at 10:09 AM, syslinux-bot for Gene Cumm <gene.cumm at gmail.com> wrote:> Commit-ID: 23b2707bd835d8a7158f9751134f427c6e743c40 > Gitweb: http://www.syslinux.org/commit/23b2707bd835d8a7158f9751134f427c6e743c40 > Author: Gene Cumm <gene.cumm at gmail.com> > AuthorDate: Thu, 25 Jun 2015 22:04:08 -0400 > Committer: Gene Cumm <gene.cumm at gmail.com> > CommitDate: Thu, 25 Jun 2015 22:04:08 -0400 > > efi/pxe: Reuse handle > > Store and reuse handle found with EFI_LOADED_IMAGE_PROTOCOL for > EFI_PXE_BASE_CODE_PROTOCOL and EFI_UDP4_SERVICE_BINDING_PROTOCOL > > This caused machines with multiple NICs to not reliably attach to the > correct NIC handle. > > gnu-efi LoadedImageProtocol PxeBaseCodeProtocol Udp4ServiceBindingProtocol > > Reported-By: Holger Baust <holger.baust at freenet.ag> > Reported-By: Michael Glasgow <glasgow at beer.net> > Reported-By: Da Shi Cao <dscao999 at gmail.com> > Signed-off-by: Gene Cumm <gene.cumm at gmail.com> > > --- > efi/efi.h | 2 +- > efi/main.c | 40 ++++++++++++++++------------------------ > efi/pxe.c | 16 ++++++---------- > 3 files changed, 23 insertions(+), 35 deletions(-) > > diff --git a/efi/efi.h b/efi/efi.h > index ef5bacb..1416488 100644 > --- a/efi/efi.h > +++ b/efi/efi.h > @@ -42,7 +42,7 @@ struct efi_binding { > EFI_HANDLE this; > }; > > -extern EFI_HANDLE image_handle; > +extern EFI_HANDLE image_handle, pxe_handle; > > struct screen_info; > extern void setup_screen(struct screen_info *); > diff --git a/efi/main.c b/efi/main.c > index 208fee4..6e43f79 100644 > --- a/efi/main.c > +++ b/efi/main.c > @@ -40,36 +40,27 @@ efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid, EFI_HANDLE agent, > guid, agent, controller); > } > > +/* As of UEFI-2.4.0, all EFI_SERVICE_BINDINGs are for networking */ > struct efi_binding *efi_create_binding(EFI_GUID *bguid, EFI_GUID *pguid) > { > EFI_SERVICE_BINDING *sbp; > struct efi_binding *b; > EFI_STATUS status; > - EFI_HANDLE protocol, child, *handles = NULL; > - UINTN i, nr_handles = 0; > + EFI_HANDLE protocol, child; > > b = malloc(sizeof(*b)); > if (!b) > return NULL; > > - status = LibLocateHandle(ByProtocol, bguid, NULL, &nr_handles, &handles); > + status = uefi_call_wrapper(BS->OpenProtocol, 6, pxe_handle, > + bguid, (void **)&sbp, > + image_handle, pxe_handle, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL); > if (status != EFI_SUCCESS) > goto free_binding; > > - for (i = 0; i < nr_handles; i++) { > - status = uefi_call_wrapper(BS->OpenProtocol, 6, handles[i], > - bguid, (void **)&sbp, > - image_handle, handles[i], > - EFI_OPEN_PROTOCOL_GET_PROTOCOL); > - if (status == EFI_SUCCESS) > - break; > - > - uefi_call_wrapper(BS->CloseProtocol, 4, handles[i], bguid, > - image_handle, handles[i]); > - } > - > - if (i == nr_handles) > - goto free_binding; > + uefi_call_wrapper(BS->CloseProtocol, 4, pxe_handle, bguid, > + image_handle, pxe_handle); > > child = NULL; > > @@ -78,13 +69,13 @@ struct efi_binding *efi_create_binding(EFI_GUID *bguid, EFI_GUID *pguid) > goto close_protocol; > > status = uefi_call_wrapper(BS->OpenProtocol, 6, child, > - pguid, (void **)&protocol, > - image_handle, sbp, > - EFI_OPEN_PROTOCOL_GET_PROTOCOL); > + pguid, (void **)&protocol, > + image_handle, sbp, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL); > if (status != EFI_SUCCESS) > goto destroy_child; > > - b->parent = handles[i]; > + b->parent = pxe_handle; > b->binding = sbp; > b->child = child; > b->this = protocol; > @@ -95,8 +86,8 @@ destroy_child: > uefi_call_wrapper(sbp->DestroyChild, 2, sbp, child); > > close_protocol: > - uefi_call_wrapper(BS->CloseProtocol, 4, handles[i], bguid, > - image_handle, handles[i]); > + uefi_call_wrapper(BS->CloseProtocol, 4, pxe_handle, bguid, > + image_handle, pxe_handle); > > free_binding: > free(b); > @@ -454,7 +445,7 @@ get_mem_desc(unsigned long memmap, UINTN desc_sz, int i) > return (EFI_MEMORY_DESCRIPTOR *)(memmap + (i * desc_sz)); > } > > -EFI_HANDLE image_handle; > +EFI_HANDLE image_handle, pxe_handle; > > static inline UINT64 round_up(UINT64 x, UINT64 y) > { > @@ -1295,6 +1286,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table) > } else { > efi_derivative(SYSLINUX_FS_PXELINUX); > ops[0] = &pxe_fs_ops; > + pxe_handle = info->DeviceHandle; > } > > /* setup timer for boot menu system support */ > diff --git a/efi/pxe.c b/efi/pxe.c > index 443ab47..82cdee4 100644 > --- a/efi/pxe.c > +++ b/efi/pxe.c > @@ -93,20 +93,13 @@ void net_parse_dhcp(void) > EFI_PXE_BASE_CODE *bc; > unsigned int pkt_len = sizeof(EFI_PXE_BASE_CODE_PACKET); > EFI_STATUS status; > - EFI_HANDLE *handles = NULL; > - UINTN nr_handles = 0; > uint8_t hardlen; > uint32_t ip; > char dst[256]; > + UINTN i = 0; > > - status = LibLocateHandle(ByProtocol, &PxeBaseCodeProtocol, > - NULL, &nr_handles, &handles); > - if (status != EFI_SUCCESS) > - return; > - > - /* Probably want to use IPv4 protocol to decide which handle to use */ > - status = uefi_call_wrapper(BS->HandleProtocol, 3, handles[0], > - &PxeBaseCodeProtocol, (void **)&bc); > + status = uefi_call_wrapper(BS->HandleProtocol, 3, pxe_handle, > + &PxeBaseCodeProtocol, (void **)&bc); > if (status != EFI_SUCCESS) { > Print(L"Failed to lookup PxeBaseCodeProtocol\n"); > } > @@ -182,4 +175,7 @@ void net_parse_dhcp(void) > ((const uint8_t *)&ip)[3]); > > Print(L"My IP is %a\n", dst); > + if (!(ip_ok(ip))) { > + Print(L" NO valid IP found.\n"); > + } > }
On Aug 12, 2015 11:36 PM, "Da Shi Cao" <dscao999 at gmail.com> wrote:> > Hi all, > I'm terribly sorry that I cannot follow emails in my gmail inbox, > since gmail is blocked by China govement, as many of you may have > already known. > I'm a HP employee in China and we are going through the splitting > process, so the blade server I was using were packed up and should be > moved into a new room. > I will try the latest source if possible. > > Thank you very much for your works. > Da Shi Cao >What about to your HP mail? I'd definitely advise the latest as I merged some commits this weekend. --Gene
Cao, Da-Shi (EG-China-Presales-CPC-GZ)
2015-Aug-13 10:48 UTC
[syslinux] [syslinux:master] efi/pxe: Reuse handle
Hi Gene, As a corporate email, I receive a lot of emails each day. I only focus on two type of emails: from my customer and from my boss. I have local rules to move them into separate folders. I think I must have missed some emails for this thread and I?m very sorry!. Regards, Thomas From: Gene Cumm [mailto:gene.cumm at gmail.com] Sent: Thursday, August 13, 2015 18:14 To: Cao, Da-Shi (EG-China-Presales-CPC-GZ) Cc: For discussion of Syslinux and tftp-hpa; Da Shi Cao Subject: Re: [syslinux:master] efi/pxe: Reuse handle On Aug 12, 2015 11:36 PM, "Da Shi Cao" <dscao999 at gmail.com<mailto:dscao999 at gmail.com>> wrote:> > Hi all, > I'm terribly sorry that I cannot follow emails in my gmail inbox, > since gmail is blocked by China govement, as many of you may have > already known. > I'm a HP employee in China and we are going through the splitting > process, so the blade server I was using were packed up and should be > moved into a new room. > I will try the latest source if possible. > > Thank you very much for your works. > Da Shi Cao >What about to your HP mail? I'd definitely advise the latest as I merged some commits this weekend. --Gene
> What about to your HP mail? I'd definitely advise the latest as I merged > some commits this weekend. > > --GeneHmm... Shamelessly, and off-topic, but not _that_ much... :) For several months we have seen reports (of different matters) here in the Syslinux Mailing List in which some HP model(s) have been having problems network-booting (in UEFI mode; I don't recall whether there were also reports using BIOS/CSM mode). Among the several reports involving HP hardware, I happen to remember at least one case of those, brought up by Patrick, if I am not mistaken, (and somewhat reported to HP too). Although updates to the UEFI firmware in that case were published and available from HP, the updates where *only* available for "Windows OS", in spite of having other categories of downloads for the same model, such as "independent (of OS)" and "Linux" - as if the firmware would be dependent on OS :O. At the time, my assumption (which I posted in the mailing list too) was that HP was/is providing a way to update the firmware from a Windows OS only (and probably - my assumption continues - HP tests and supports these updates under Windows environments *only*). In the HP website, when selecting the "Linux" category of downloads for the HP model in that particular case, one firmware update was available too, but it happens to be old, whereas several updates are available through the "Windows OS" category, with more-than-a-few "fixed" items in the changelog history. Why is this relevant? Because the HP model was reported to be failing to network-boot syslinux.efi -> Linux (IIRC), and the chances that a firmware update could solve the problem in that case were/are not discarded at all. It could be beneficial to see HP updating the firmware for "non-Windows" users too (i.e. taking care of the problems, testing and publishing the updates for these "other" users / cases). Who knows, maybe we could even see some bugs in Syslinux solved, specific hardware tested, and firmware updates with relevant patches published (for all). Or, maybe this will be left here as a random rant, with no positive consequences :(. Regards, Ady. PS: If I happen to be misremembering (some) details of the particular case (which is possible), please forgive me; I have not looked up the particular emails, which could help refresh my imperfect memory.> _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux >