12CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
52 Callback = Private->PxeBcCallback;
59 Private->Mode.TftpErrorReceived =
TRUE;
60 Private->Mode.TftpError.ErrorCode = (UINT8)Packet->Error.ErrorCode;
62 Private->Mode.TftpError.ErrorString,
63 PXE_MTFTP_ERROR_STRING_LENGTH,
64 (CHAR8 *)Packet->Error.ErrorMessage,
65 PXE_MTFTP_ERROR_STRING_LENGTH - 1
67 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] =
'\0';
70 if (Callback !=
NULL) {
74 Status = Callback->Callback (
81 if (Status != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
120 IN OUT UINT64 *BufferSize
128 UINT8 OptBuf[PXE_MTFTP_OPTBUF_MAXNUM_INDEX];
134 Status = EFI_DEVICE_ERROR;
135 Mtftp6 = Private->Mtftp6;
139 OptBufSize = PXE_MTFTP_OPTBUF_MAXNUM_INDEX;
141 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
143 Status = Mtftp6->Configure (Mtftp6, Config);
144 if (EFI_ERROR (Status)) {
151 ReqOpt[0].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];
155 if (BlockSize !=
NULL) {
156 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
158 OptBufSize -= (
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
163 if (WindowSize !=
NULL) {
164 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
166 OptBufSize -= (
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
171 Status = Mtftp6->GetInfo (
181 if (EFI_ERROR (Status)) {
182 if (Status == EFI_TFTP_ERROR) {
186 Private->Mode.TftpErrorReceived =
TRUE;
187 Private->Mode.TftpError.ErrorCode = (UINT8)Packet->
Error.
ErrorCode;
189 Private->Mode.TftpError.ErrorString,
190 PXE_MTFTP_ERROR_STRING_LENGTH,
192 PXE_MTFTP_ERROR_STRING_LENGTH - 1
194 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] =
'\0';
204 Status = Mtftp6->ParseOptions (
211 if (EFI_ERROR (Status)) {
218 Status = EFI_NOT_FOUND;
219 while (OptCnt != 0) {
220 if (
AsciiStrnCmp ((CHAR8 *)Option[OptCnt - 1].OptionStr,
"tsize", 5) == 0) {
231 if (Packet !=
NULL) {
235 Mtftp6->Configure (Mtftp6,
NULL);
265 IN OUT UINT64 *BufferSize,
266 IN BOOLEAN DontUseBuffer
273 UINT8 BlksizeBuf[10];
274 UINT8 WindowsizeBuf[10];
277 Status = EFI_DEVICE_ERROR;
278 Mtftp6 = Private->Mtftp6;
280 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
282 Status = Mtftp6->Configure (Mtftp6, Config);
283 if (EFI_ERROR (Status)) {
287 if (BlockSize !=
NULL) {
288 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
289 ReqOpt[OptCnt].
ValueStr = BlksizeBuf;
294 if (WindowSize !=
NULL) {
295 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
296 ReqOpt[OptCnt].
ValueStr = WindowsizeBuf;
321 Status = Mtftp6->ReadFile (Mtftp6, &Token);
327 Mtftp6->Configure (Mtftp6,
NULL);
353 IN BOOLEAN Overwrite,
356 IN OUT UINT64 *BufferSize
366 Status = EFI_DEVICE_ERROR;
367 Mtftp6 = Private->Mtftp6;
369 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
371 Status = Mtftp6->Configure (Mtftp6, Config);
372 if (EFI_ERROR (Status)) {
376 if (BlockSize !=
NULL) {
377 ReqOpt[0].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
395 Status = Mtftp6->WriteFile (Mtftp6, &Token);
401 Mtftp6->Configure (Mtftp6,
NULL);
431 IN OUT UINT64 *BufferSize,
432 IN BOOLEAN DontUseBuffer
439 UINT8 BlksizeBuf[10];
440 UINT8 WindowsizeBuf[10];
443 Status = EFI_DEVICE_ERROR;
444 Mtftp6 = Private->Mtftp6;
446 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
448 Status = Mtftp6->Configure (Mtftp6, Config);
449 if (EFI_ERROR (Status)) {
453 if (BlockSize !=
NULL) {
454 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
455 ReqOpt[OptCnt].
ValueStr = BlksizeBuf;
460 if (WindowSize !=
NULL) {
461 ReqOpt[OptCnt].
OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
462 ReqOpt[OptCnt].
ValueStr = WindowsizeBuf;
487 Status = Mtftp6->ReadDirectory (Mtftp6, &Token);
493 Mtftp6->Configure (Mtftp6,
NULL);
530 Callback = Private->PxeBcCallback;
533 if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) {
537 Private->Mode.TftpErrorReceived =
TRUE;
538 Private->Mode.TftpError.ErrorCode = (UINT8)Packet->Error.ErrorCode;
540 Private->Mode.TftpError.ErrorString,
541 PXE_MTFTP_ERROR_STRING_LENGTH,
542 (CHAR8 *)Packet->Error.ErrorMessage,
543 PXE_MTFTP_ERROR_STRING_LENGTH - 1
545 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] =
'\0';
548 if (Callback !=
NULL) {
552 Status = Callback->Callback (
559 if (Status != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
563 Status = EFI_ABORTED;
598 IN OUT UINT64 *BufferSize
606 UINT8 OptBuf[PXE_MTFTP_OPTBUF_MAXNUM_INDEX];
612 Status = EFI_DEVICE_ERROR;
613 Mtftp4 = Private->Mtftp4;
617 OptBufSize = PXE_MTFTP_OPTBUF_MAXNUM_INDEX;
619 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
621 Status = Mtftp4->Configure (Mtftp4, Config);
622 if (EFI_ERROR (Status)) {
629 ReqOpt[0].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];
631 ReqOpt[0].ValueStr = OptBuf;
633 if (BlockSize !=
NULL) {
634 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
635 ReqOpt[OptCnt].ValueStr = (UINT8 *)(ReqOpt[OptCnt-1].ValueStr +
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
636 OptBufSize -= (
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
641 if (WindowSize !=
NULL) {
642 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
643 ReqOpt[OptCnt].ValueStr = (UINT8 *)(ReqOpt[OptCnt-1].ValueStr +
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
644 OptBufSize -= (
AsciiStrLen ((CHAR8 *)ReqOpt[OptCnt-1].ValueStr) + 1);
649 Status = Mtftp4->GetInfo (
659 if (EFI_ERROR (Status)) {
660 if (Status == EFI_TFTP_ERROR) {
664 Private->Mode.TftpErrorReceived =
TRUE;
665 Private->Mode.TftpError.ErrorCode = (UINT8)Packet->
Error.ErrorCode;
667 Private->Mode.TftpError.ErrorString,
668 PXE_MTFTP_ERROR_STRING_LENGTH,
669 (CHAR8 *)Packet->
Error.ErrorMessage,
670 PXE_MTFTP_ERROR_STRING_LENGTH - 1
672 Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] =
'\0';
682 Status = Mtftp4->ParseOptions (
689 if (EFI_ERROR (Status)) {
696 Status = EFI_NOT_FOUND;
697 while (OptCnt != 0) {
698 if (
AsciiStrnCmp ((CHAR8 *)Option[OptCnt - 1].OptionStr,
"tsize", 5) == 0) {
709 if (Packet !=
NULL) {
713 Mtftp4->Configure (Mtftp4,
NULL);
743 IN OUT UINT64 *BufferSize,
744 IN BOOLEAN DontUseBuffer
751 UINT8 BlksizeBuf[10];
752 UINT8 WindowsizeBuf[10];
755 Status = EFI_DEVICE_ERROR;
756 Mtftp4 = Private->Mtftp4;
758 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
760 Status = Mtftp4->Configure (Mtftp4, Config);
761 if (EFI_ERROR (Status)) {
765 if (BlockSize !=
NULL) {
766 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
767 ReqOpt[OptCnt].ValueStr = BlksizeBuf;
772 if (WindowSize !=
NULL) {
773 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
774 ReqOpt[OptCnt].ValueStr = WindowsizeBuf;
799 Status = Mtftp4->ReadFile (Mtftp4, &Token);
805 Mtftp4->Configure (Mtftp4,
NULL);
831 IN BOOLEAN Overwrite,
834 IN OUT UINT64 *BufferSize
844 Status = EFI_DEVICE_ERROR;
845 Mtftp4 = Private->Mtftp4;
847 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
849 Status = Mtftp4->Configure (Mtftp4, Config);
850 if (EFI_ERROR (Status)) {
854 if (BlockSize !=
NULL) {
855 ReqOpt[0].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
856 ReqOpt[0].ValueStr = OptBuf;
873 Status = Mtftp4->WriteFile (Mtftp4, &Token);
879 Mtftp4->Configure (Mtftp4,
NULL);
909 IN OUT UINT64 *BufferSize,
910 IN BOOLEAN DontUseBuffer
917 UINT8 BlksizeBuf[10];
918 UINT8 WindowsizeBuf[10];
921 Status = EFI_DEVICE_ERROR;
922 Mtftp4 = Private->Mtftp4;
924 Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
926 Status = Mtftp4->Configure (Mtftp4, Config);
927 if (EFI_ERROR (Status)) {
931 if (BlockSize !=
NULL) {
932 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
933 ReqOpt[OptCnt].ValueStr = BlksizeBuf;
938 if (WindowSize !=
NULL) {
939 ReqOpt[OptCnt].OptionStr = (UINT8 *)mMtftpOptions[PXE_MTFTP_OPTION_WINDOWSIZE_INDEX];
940 ReqOpt[OptCnt].ValueStr = WindowsizeBuf;
965 Status = Mtftp4->ReadDirectory (Mtftp4, &Token);
971 Mtftp4->Configure (Mtftp4,
NULL);
999 IN OUT UINT64 *BufferSize
1002 if (Private->PxeBc.Mode->UsingIpv6) {
1047 IN UINT8 *BufferPtr,
1048 IN OUT UINT64 *BufferSize,
1049 IN BOOLEAN DontUseBuffer
1052 if (Private->PxeBc.Mode->UsingIpv6) {
1098 IN BOOLEAN Overwrite,
1100 IN UINT8 *BufferPtr,
1101 IN OUT UINT64 *BufferSize
1104 if (Private->PxeBc.Mode->UsingIpv6) {
1151 IN UINT8 *BufferPtr,
1152 IN OUT UINT64 *BufferSize,
1153 IN BOOLEAN DontUseBuffer
1156 if (Private->PxeBc.Mode->UsingIpv6) {
RETURN_STATUS EFIAPI AsciiStrnCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source, IN UINTN Length)
UINT64 EFIAPI AsciiStrDecimalToUint64(IN CONST CHAR8 *String)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define EFI_MTFTP6_OPCODE_ERROR
The MTFTPv6 packet is an error packet.
EFI_STATUS PxeBcMtftp6ReadFile(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP6_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS PxeBcTftpGetFileSize(IN PXEBC_PRIVATE_DATA *Private, IN VOID *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN OUT UINT64 *BufferSize)
EFI_STATUS PxeBcMtftp4ReadFile(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP4_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS PxeBcMtftp4ReadDirectory(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP4_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS PxeBcMtftp6WriteFile(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP6_CONFIG_DATA *Config, IN UINT8 *Filename, IN BOOLEAN Overwrite, IN UINTN *BlockSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize)
EFI_STATUS PxeBcMtftp6ReadDirectory(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP6_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS PxeBcMtftp4GetFileSize(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP4_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN OUT UINT64 *BufferSize)
EFI_STATUS PxeBcMtftp4WriteFile(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP4_CONFIG_DATA *Config, IN UINT8 *Filename, IN BOOLEAN Overwrite, IN UINTN *BlockSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize)
EFI_STATUS PxeBcTftpReadDirectory(IN PXEBC_PRIVATE_DATA *Private, IN VOID *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS PxeBcTftpReadFile(IN PXEBC_PRIVATE_DATA *Private, IN VOID *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize, IN BOOLEAN DontUseBuffer)
EFI_STATUS EFIAPI PxeBcMtftp6CheckPacket(IN EFI_MTFTP6_PROTOCOL *This, IN EFI_MTFTP6_TOKEN *Token, IN UINT16 PacketLen, IN EFI_MTFTP6_PACKET *Packet)
EFI_STATUS EFIAPI PxeBcMtftp4CheckPacket(IN EFI_MTFTP4_PROTOCOL *This, IN EFI_MTFTP4_TOKEN *Token, IN UINT16 PacketLen, IN EFI_MTFTP4_PACKET *Packet)
EFI_STATUS PxeBcTftpWriteFile(IN PXEBC_PRIVATE_DATA *Private, IN VOID *Config, IN UINT8 *Filename, IN BOOLEAN Overwrite, IN UINTN *BlockSize, IN UINT8 *BufferPtr, IN OUT UINT64 *BufferSize)
EFI_STATUS PxeBcMtftp6GetFileSize(IN PXEBC_PRIVATE_DATA *Private, IN EFI_MTFTP6_CONFIG_DATA *Config, IN UINT8 *Filename, IN UINTN *BlockSize, IN UINTN *WindowSize, IN OUT UINT64 *BufferSize)
UINTN PxeBcUintnToAscDec(IN UINTN Number, IN UINT8 *Buffer, IN UINTN BufferSize)
EFI_MTFTP4_CHECK_PACKET CheckPacket
EFI_MTFTP4_PACKET_NEEDED PacketNeeded
EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback
EFI_MTFTP4_OVERRIDE_DATA * OverrideData
EFI_MTFTP4_OPTION * OptionList
EFI_MTFTP6_PACKET_NEEDED PacketNeeded
EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback
EFI_MTFTP6_OPTION * OptionList
EFI_MTFTP6_OVERRIDE_DATA * OverrideData
EFI_MTFTP6_CHECK_PACKET CheckPacket
UINT8 * ValueStr
Pointer to the null-terminated ASCII MTFTPv6 value string.
UINT8 * OptionStr
Pointer to the null-terminated ASCII MTFTPv6 option string.
EFI_MTFTP4_ERROR_HEADER Error
EFI_MTFTP6_ERROR_HEADER Error
Error packet header.