david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[efi] Expand the range of well-known EFI GUIDs in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2014-07-31 00:00:18 +01:00
parent 7cfb502fff
commit 0b40e76d95
4 changed files with 390 additions and 10 deletions

View File

@ -0,0 +1,74 @@
/** @file
Bus Specific Driver Override protocol as defined in the UEFI 2.0 specification.
Bus drivers that have a bus specific algorithm for matching drivers to controllers are
required to produce this protocol for each controller. For example, a PCI Bus Driver will produce an
instance of this protocol for every PCI controller that has a PCI option ROM that contains one or
more UEFI drivers. The protocol instance is attached to the handle of the PCI controller.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_
#define _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_
FILE_LICENCE ( BSD3 );
///
/// Global ID for the Bus Specific Driver Override Protocol
///
#define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \
{ \
0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65 } \
}
typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
//
// Prototypes for the Bus Specific Driver Override Protocol
//
/**
Uses a bus specific algorithm to retrieve a driver image handle for a controller.
@param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_
OVERRIDE_PROTOCOL instance.
@param DriverImageHandle On input, a pointer to the previous driver image handle returned
by GetDriver(). On output, a pointer to the next driver
image handle. Passing in a NULL, will return the first driver
image handle.
@retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle.
@retval EFI_NOT_FOUND The end of the list of override drivers was reached.
A bus specific override driver is not returned in DriverImageHandle.
@retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
previous call to GetDriver().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER)(
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
IN OUT EFI_HANDLE *DriverImageHandle
);
///
/// This protocol matches one or more drivers to a controller. This protocol is produced by a bus driver,
/// and it is installed on the child handles of buses that require a bus specific algorithm for matching
/// drivers to controllers.
///
struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver;
};
extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid;
#endif

View File

@ -0,0 +1,131 @@
/** @file
EFI Component Name Protocol as defined in the EFI 1.1 specification.
This protocol is used to retrieve user readable names of EFI Drivers
and controllers managed by EFI Drivers.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __EFI_COMPONENT_NAME_H__
#define __EFI_COMPONENT_NAME_H__
FILE_LICENCE ( BSD3 );
///
/// The global ID for the Component Name Protocol.
///
#define EFI_COMPONENT_NAME_PROTOCOL_GUID \
{ \
0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
typedef struct _EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL;
/**
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language A pointer to a three-character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
@param DriverName A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support the
language specified by Language.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME)(
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
@param ChildHandle The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
@param Language A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
@param ControllerName A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language, from the point of view of the driver specified
by This.
@retval EFI_SUCCESS The Unicode string for the user-readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support the
language specified by Language.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)(
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
///
/// This protocol is used to retrieve user readable names of drivers
/// and controllers managed by UEFI Drivers.
///
struct _EFI_COMPONENT_NAME_PROTOCOL {
EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName;
EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName;
///
/// A Null-terminated ASCII string that contains one or more
/// ISO 639-2 language codes. This is the list of language codes
/// that this protocol supports.
///
CHAR8 *SupportedLanguages;
};
extern EFI_GUID gEfiComponentNameProtocolGuid;
#endif

View File

@ -0,0 +1,87 @@
/** @file
Load File protocol as defined in the UEFI 2.0 specification.
Load file protocol exists to supports the addition of new boot devices,
and to support booting from devices that do not map well to file system.
Network boot is done via a LoadFile protocol.
UEFI 2.0 can boot from any device that produces a LoadFile protocol.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __EFI_LOAD_FILE2_PROTOCOL_H__
#define __EFI_LOAD_FILE2_PROTOCOL_H__
FILE_LICENCE ( BSD3 );
#define EFI_LOAD_FILE2_PROTOCOL_GUID \
{ \
0x4006c0c1, 0xfcb3, 0x403e, {0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d } \
}
///
/// Protocol Guid defined by UEFI2.1.
///
#define LOAD_FILE2_PROTOCOL EFI_LOAD_FILE2_PROTOCOL_GUID
typedef struct _EFI_LOAD_FILE2_PROTOCOL EFI_LOAD_FILE2_PROTOCOL;
/**
Causes the driver to load a specified file.
@param This Protocol instance pointer.
@param FilePath The device specific path of the file to load.
@param BootPolicy Should always be FALSE.
@param BufferSize On input the size of Buffer in bytes. On output with a return
code of EFI_SUCCESS, the amount of data transferred to
Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
the size of Buffer required to retrieve the requested file.
@param Buffer The memory buffer to transfer the file to. IF Buffer is NULL,
then no the size of the requested file is returned in
BufferSize.
@retval EFI_SUCCESS The file was loaded.
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
BufferSize is NULL.
@retval EFI_NO_MEDIA No medium was present to load the file.
@retval EFI_DEVICE_ERROR The file was not loaded due to a device error.
@retval EFI_NO_RESPONSE The remote system did not respond.
@retval EFI_NOT_FOUND The file was not found
@retval EFI_ABORTED The file load process was manually canceled.
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current
directory entry. BufferSize has been updated with
the size needed to complete the request.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_LOAD_FILE2)(
IN EFI_LOAD_FILE2_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN BOOLEAN BootPolicy,
IN OUT UINTN *BufferSize,
IN VOID *Buffer OPTIONAL
);
///
/// The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from arbitrary devices.
///
struct _EFI_LOAD_FILE2_PROTOCOL {
EFI_LOAD_FILE2 LoadFile;
};
extern EFI_GUID gEfiLoadFile2ProtocolGuid;
#endif

View File

@ -32,17 +32,82 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/uuid.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/Protocol/BlockIo.h>
#include <ipxe/efi/Protocol/BusSpecificDriverOverride.h>
#include <ipxe/efi/Protocol/ComponentName.h>
#include <ipxe/efi/Protocol/ComponentName2.h>
#include <ipxe/efi/Protocol/DevicePath.h>
#include <ipxe/efi/Protocol/DevicePathToText.h>
#include <ipxe/efi/Protocol/BlockIo.h>
#include <ipxe/efi/Protocol/DiskIo.h>
#include <ipxe/efi/Protocol/DriverBinding.h>
#include <ipxe/efi/Protocol/LoadFile.h>
#include <ipxe/efi/Protocol/LoadFile2.h>
#include <ipxe/efi/Protocol/LoadedImage.h>
#include <ipxe/efi/Protocol/PciIo.h>
#include <ipxe/efi/Protocol/PciRootBridgeIo.h>
#include <ipxe/efi/Protocol/SimpleFileSystem.h>
#include <ipxe/efi/Protocol/SimpleNetwork.h>
/** Block I/O protocol GUID */
static EFI_GUID efi_block_io_protocol_guid
= EFI_BLOCK_IO_PROTOCOL_GUID;
/** Bus specific driver override protocol GUID */
static EFI_GUID efi_bus_specific_driver_override_protocol_guid
= EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID;
/** Component name protocol GUID */
static EFI_GUID efi_component_name_protocol_guid
= EFI_COMPONENT_NAME_PROTOCOL_GUID;
/** Component name 2 protocol GUID */
static EFI_GUID efi_component_name2_protocol_guid
= EFI_COMPONENT_NAME2_PROTOCOL_GUID;
/** Device path protocol GUID */
static EFI_GUID efi_device_path_protocol_guid
= EFI_DEVICE_PATH_PROTOCOL_GUID;
/** Disk I/O protocol GUID */
static EFI_GUID efi_disk_io_protocol_guid
= EFI_DISK_IO_PROTOCOL_GUID;
/** Driver binding protocol GUID */
static EFI_GUID efi_driver_binding_protocol_guid
= EFI_DRIVER_BINDING_PROTOCOL_GUID;
/** Load file protocol GUID */
static EFI_GUID efi_load_file_protocol_guid
= EFI_LOAD_FILE_PROTOCOL_GUID;
/** Load file 2 protocol GUID */
static EFI_GUID efi_load_file2_protocol_guid
= EFI_LOAD_FILE2_PROTOCOL_GUID;
/** Loaded image protocol GUID */
static EFI_GUID efi_loaded_image_protocol_guid
= EFI_LOADED_IMAGE_PROTOCOL_GUID;
/** Loaded image device path protocol GUID */
static EFI_GUID efi_loaded_image_device_path_protocol_guid
= EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
/** PCI I/O protocol GUID */
static EFI_GUID efi_pci_io_protocol_guid
= EFI_PCI_IO_PROTOCOL_GUID;
/** PCI root bridge I/O protocol GUID */
static EFI_GUID efi_pci_root_bridge_io_protocol_guid
= EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
/** Simple file system protocol GUID */
static EFI_GUID efi_simple_file_system_protocol_guid
= EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
/** Simple network protocol guid */
static EFI_GUID efi_simple_network_protocol_guid
= EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
/** Device path to text protocol */
static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
@ -50,20 +115,43 @@ EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
/** A well-known GUID */
struct efi_well_known_guid {
/** GUID */
EFI_GUID guid;
EFI_GUID *guid;
/** Name */
const char *name;
};
/** Well-known GUIDs */
static struct efi_well_known_guid efi_well_known_guids[] = {
{ EFI_BLOCK_IO_PROTOCOL_GUID, "BlockIo" },
{ EFI_DISK_IO_PROTOCOL_GUID, "DiskIo" },
{ EFI_DEVICE_PATH_PROTOCOL_GUID, "DevicePath" },
{ EFI_LOADED_IMAGE_PROTOCOL_GUID, "LoadedImage" },
{ EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID, "LoadedImageDevicePath" },
{ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "SimpleFileSystem" },
{ EFI_SIMPLE_NETWORK_PROTOCOL_GUID, "SimpleNetwork" },
{ &efi_block_io_protocol_guid,
"BlockIo" },
{ &efi_bus_specific_driver_override_protocol_guid,
"BusSpecificDriverOverride" },
{ &efi_component_name2_protocol_guid,
"ComponentName2" },
{ &efi_component_name_protocol_guid,
"ComponentName" },
{ &efi_device_path_protocol_guid,
"DevicePath" },
{ &efi_driver_binding_protocol_guid,
"DriverBinding" },
{ &efi_disk_io_protocol_guid,
"DiskIo" },
{ &efi_load_file_protocol_guid,
"LoadFile" },
{ &efi_load_file2_protocol_guid,
"LoadFile2" },
{ &efi_loaded_image_protocol_guid,
"LoadedImage" },
{ &efi_loaded_image_device_path_protocol_guid,
"LoadedImageDevicePath"},
{ &efi_pci_io_protocol_guid,
"PciIo" },
{ &efi_pci_root_bridge_io_protocol_guid,
"PciRootBridgeIo" },
{ &efi_simple_file_system_protocol_guid,
"SimpleFileSystem" },
{ &efi_simple_network_protocol_guid,
"SimpleNetwork" },
};
/**
@ -82,7 +170,7 @@ const char * efi_guid_ntoa ( EFI_GUID *guid ) {
/* Check for a match against well-known GUIDs */
for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
if ( memcmp ( guid, &efi_well_known_guids[i].guid,
if ( memcmp ( guid, efi_well_known_guids[i].guid,
sizeof ( *guid ) ) == 0 ) {
return efi_well_known_guids[i].name;
}