1f439973dSWarner Losh /** @file 2f439973dSWarner Losh It is invoked when the PXE Base Code Protocol is about to transmit, has received, 3f439973dSWarner Losh or is waiting to receive a packet. 4f439973dSWarner Losh 5f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 6f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 7f439973dSWarner Losh 8f439973dSWarner Losh @par Revision Reference: 9f439973dSWarner Losh This Protocol is introduced in EFI Specification 1.10 10f439973dSWarner Losh 11f439973dSWarner Losh **/ 12f439973dSWarner Losh 13f439973dSWarner Losh #ifndef _PXE_BASE_CODE_CALLBACK_H_ 14f439973dSWarner Losh #define _PXE_BASE_CODE_CALLBACK_H_ 15f439973dSWarner Losh 16f439973dSWarner Losh /// 17f439973dSWarner Losh /// Call Back Definitions. 18f439973dSWarner Losh /// 19f439973dSWarner Losh #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \ 20f439973dSWarner Losh { \ 21f439973dSWarner Losh 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ 22f439973dSWarner Losh } 23f439973dSWarner Losh 24f439973dSWarner Losh /// 25f439973dSWarner Losh /// UEFI Revision Number Definition. 26f439973dSWarner Losh /// 27f439973dSWarner Losh #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 0x00010000 28f439973dSWarner Losh 29f439973dSWarner Losh /// 30f439973dSWarner Losh /// EFI 1.1 Revision Number defintion. 31f439973dSWarner Losh /// 32f439973dSWarner Losh #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION \ 33f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 34f439973dSWarner Losh 35f439973dSWarner Losh /// 36f439973dSWarner Losh /// UEFI Protocol name. 37f439973dSWarner Losh /// 38f439973dSWarner Losh typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL; 39f439973dSWarner Losh 40f439973dSWarner Losh /// 41f439973dSWarner Losh /// EFI1.1 Protocol name. 42f439973dSWarner Losh /// 43f439973dSWarner Losh typedef EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK; 44f439973dSWarner Losh 45f439973dSWarner Losh /// 46f439973dSWarner Losh /// Event type list for PXE Base Code Protocol function. 47f439973dSWarner Losh /// 48f439973dSWarner Losh typedef enum { 49f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_FIRST, 50f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_DHCP, 51f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_DISCOVER, 52f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_MTFTP, 53f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE, 54f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_UDP_READ, 55f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_ARP, 56f439973dSWarner Losh EFI_PXE_BASE_CODE_FUNCTION_IGMP, 57f439973dSWarner Losh EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST 58f439973dSWarner Losh } EFI_PXE_BASE_CODE_FUNCTION; 59f439973dSWarner Losh 60f439973dSWarner Losh /// 61f439973dSWarner Losh /// Callback status type. 62f439973dSWarner Losh /// 63f439973dSWarner Losh typedef enum { 64f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, 65f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, 66f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT, 67f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST 68f439973dSWarner Losh } EFI_PXE_BASE_CODE_CALLBACK_STATUS; 69f439973dSWarner Losh 70f439973dSWarner Losh /** 71f439973dSWarner Losh Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has 72f439973dSWarner Losh received, or is waiting to receive a packet. 73f439973dSWarner Losh 74f439973dSWarner Losh This function is invoked when the PXE Base Code Protocol is about to transmit, has received, 75f439973dSWarner Losh or is waiting to receive a packet. Parameters Function and Received specify the type of event. 76f439973dSWarner Losh Parameters PacketLen and Packet specify the packet that generated the event. If these fields 77f439973dSWarner Losh are zero and NULL respectively, then this is a status update callback. If the operation specified 78f439973dSWarner Losh by Function is to continue, then CALLBACK_STATUS_CONTINUE should be returned. If the operation 79f439973dSWarner Losh specified by Function should be aborted, then CALLBACK_STATUS_ABORT should be returned. Due to 80f439973dSWarner Losh the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms. 81f439973dSWarner Losh The SetParameters() function must be called after a Callback Protocol is installed to enable the 82f439973dSWarner Losh use of callbacks. 83f439973dSWarner Losh 84f439973dSWarner Losh @param This The pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance. 85f439973dSWarner Losh @param Function The PXE Base Code Protocol function that is waiting for an event. 86f439973dSWarner Losh @param Received TRUE if the callback is being invoked due to a receive event. FALSE if 87f439973dSWarner Losh the callback is being invoked due to a transmit event. 88f439973dSWarner Losh @param PacketLen The length, in bytes, of Packet. This field will have a value of zero if 89f439973dSWarner Losh this is a wait for receive event. 90f439973dSWarner Losh @param Packet If Received is TRUE, a pointer to the packet that was just received; 91f439973dSWarner Losh otherwise a pointer to the packet that is about to be transmitted. 92f439973dSWarner Losh 93f439973dSWarner Losh @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation 94f439973dSWarner Losh @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT if Function specifies an abort operation 95f439973dSWarner Losh 96f439973dSWarner Losh **/ 97f439973dSWarner Losh typedef 98f439973dSWarner Losh EFI_PXE_BASE_CODE_CALLBACK_STATUS 99f439973dSWarner Losh (EFIAPI *EFI_PXE_CALLBACK)( 100f439973dSWarner Losh IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This, 101f439973dSWarner Losh IN EFI_PXE_BASE_CODE_FUNCTION Function, 102f439973dSWarner Losh IN BOOLEAN Received, 103f439973dSWarner Losh IN UINT32 PacketLen, 104f439973dSWarner Losh IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL 105f439973dSWarner Losh ); 106f439973dSWarner Losh 107f439973dSWarner Losh /// 108f439973dSWarner Losh /// Protocol that is invoked when the PXE Base Code Protocol is about 109f439973dSWarner Losh /// to transmit, has received, or is waiting to receive a packet. 110f439973dSWarner Losh /// 111f439973dSWarner Losh struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL { 112f439973dSWarner Losh /// 113f439973dSWarner Losh /// The revision of the EFI_PXE_BASE_CODE_PROTOCOL. All future revisions must 114f439973dSWarner Losh /// be backwards compatible. If a future version is not backwards compatible 115f439973dSWarner Losh /// it is not the same GUID. 116f439973dSWarner Losh /// 117f439973dSWarner Losh UINT64 Revision; 118f439973dSWarner Losh EFI_PXE_CALLBACK Callback; 119f439973dSWarner Losh }; 120f439973dSWarner Losh 121f439973dSWarner Losh extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid; 122f439973dSWarner Losh 123f439973dSWarner Losh #endif 124