Menu

#5 stale definition for Mtftp() function in efipxebc.h

v1.0_(example)
closed
nobody
None
5
2013-06-12
2012-11-13
Anonymous
No

The definition for the Mtftp() method in the PXE base code protocol in the efipxebc.h file that comes with GNU EFI 3.0q looks like this:

typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (
IN struct _EFI_PXE_BASE_CODE *This,
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINTN *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS *ServerIp,
IN UINT8 *Filename,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
IN BOOLEAN DontUseBuffer
);

Note that the BufferSize is defined to be a UINTN *. However, the protocol definition that comes with the latest Tiano UDK looks like this:

typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (
IN EFI_PXE_BASE_CODE_PROTOCOL * This,
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINT64 *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS * ServerIp,
IN UINT8 *Filename,
IN EFI_PXE_BASE_CODE_MTFTP_INFO * Info OPTIONAL,
IN BOOLEAN DontUseBuffer
);

Note that here, BufferSize is a UINT64 *. The file shipped with GNU EFI is from 1998 whereas the latest one is from 2004. I suspect Intel changed the API in order handle 64-bit systems.

I recently created a bootloader using GNU EFI and was able to implement and test the PXE basecode support. I used an Emercon NITX-315 Atom board with 32-bit UEFI firmware, and an Intel 82574 NIC for PXE booting. The actual UEFI code on this board expects the BufferSize to be a UINT64, and making it a UINTN instead causes memory corruption, at least on 32-bit systems. This caused various strange failures with my code, including hanging the board when calling the Stop() method in the PXE protocol. It's possible nobody else has tried it before now, but this must be fixed in order to successfully use the PXE basecode protocol.

NOTE: I realize there is a strong change you may ignore this bug based on the assumption that the latest UEFI firmware support is largely 64-bit only. Don't do that.

For now I've fixed this in my local copy of the code.

Discussion

  • Nigel Croxon

    Nigel Croxon - 2013-02-20

    I have added this change and it will be available in version 3.0t.

     
  • Nigel Croxon

    Nigel Croxon - 2013-06-12
    • status: open --> closed
    • Group: --> v1.0_(example)
     

Log in to post a comment.

MongoDB Logo MongoDB