瀏覽代碼

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年之前
父節點
當前提交
0b40e76d95

+ 74
- 0
src/include/ipxe/efi/Protocol/BusSpecificDriverOverride.h 查看文件

@@ -0,0 +1,74 @@
1
+/** @file
2
+  Bus Specific Driver Override protocol as defined in the UEFI 2.0 specification.
3
+
4
+  Bus drivers that have a bus specific algorithm for matching drivers to controllers are
5
+  required to produce this protocol for each controller. For example, a PCI Bus Driver will produce an
6
+  instance of this protocol for every PCI controller that has a PCI option ROM that contains one or
7
+  more UEFI drivers. The protocol instance is attached to the handle of the PCI controller.
8
+
9
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
10
+  This program and the accompanying materials
11
+  are licensed and made available under the terms and conditions of the BSD License
12
+  which accompanies this distribution.  The full text of the license may be found at
13
+  http://opensource.org/licenses/bsd-license.php
14
+
15
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
+
18
+**/
19
+
20
+#ifndef _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_
21
+#define _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_
22
+
23
+FILE_LICENCE ( BSD3 );
24
+
25
+///
26
+/// Global ID for the Bus Specific Driver Override Protocol
27
+///
28
+#define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \
29
+  { \
30
+    0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65 } \
31
+  }
32
+
33
+typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
34
+
35
+//
36
+// Prototypes for the Bus Specific Driver Override Protocol
37
+//
38
+
39
+/**
40
+  Uses a bus specific algorithm to retrieve a driver image handle for a controller.
41
+
42
+  @param  This                  A pointer to the EFI_BUS_SPECIFIC_DRIVER_
43
+                                OVERRIDE_PROTOCOL instance.
44
+  @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned
45
+                                by GetDriver(). On output, a pointer to the next driver
46
+                                image handle. Passing in a NULL, will return the first driver
47
+                                image handle.
48
+
49
+  @retval EFI_SUCCESS           A bus specific override driver is returned in DriverImageHandle.
50
+  @retval EFI_NOT_FOUND         The end of the list of override drivers was reached.
51
+                                A bus specific override driver is not returned in DriverImageHandle.
52
+  @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
53
+                                previous call to GetDriver().
54
+
55
+**/
56
+typedef
57
+EFI_STATUS
58
+(EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER)(
59
+  IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL              *This,
60
+  IN OUT EFI_HANDLE                                         *DriverImageHandle
61
+  );
62
+
63
+///
64
+/// This protocol matches one or more drivers to a controller. This protocol is produced by a bus driver,
65
+/// and it is installed on the child handles of buses that require a bus specific algorithm for matching
66
+/// drivers to controllers.
67
+///
68
+struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
69
+  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver;
70
+};
71
+
72
+extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid;
73
+
74
+#endif

+ 131
- 0
src/include/ipxe/efi/Protocol/ComponentName.h 查看文件

@@ -0,0 +1,131 @@
1
+/** @file
2
+  EFI Component Name Protocol as defined in the EFI 1.1 specification.
3
+  This protocol is used to retrieve user readable names of EFI Drivers
4
+  and controllers managed by EFI Drivers.
5
+
6
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
7
+This program and the accompanying materials are licensed and made available under
8
+the terms and conditions of the BSD License that accompanies this distribution.
9
+The full text of the license may be found at
10
+http://opensource.org/licenses/bsd-license.php.
11
+
12
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
+
15
+**/
16
+
17
+#ifndef __EFI_COMPONENT_NAME_H__
18
+#define __EFI_COMPONENT_NAME_H__
19
+
20
+FILE_LICENCE ( BSD3 );
21
+
22
+///
23
+/// The global ID for the Component Name Protocol.
24
+///
25
+#define EFI_COMPONENT_NAME_PROTOCOL_GUID \
26
+  { \
27
+    0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
28
+  }
29
+
30
+typedef struct _EFI_COMPONENT_NAME_PROTOCOL  EFI_COMPONENT_NAME_PROTOCOL;
31
+
32
+
33
+/**
34
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
35
+
36
+  @param  This       A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
37
+  @param  Language   A pointer to a three-character ISO 639-2 language identifier.
38
+                     This is the language of the driver name that that the caller
39
+                     is requesting, and it must match one of the languages specified
40
+                     in SupportedLanguages.  The number of languages supported by a
41
+                     driver is up to the driver writer.
42
+  @param  DriverName A pointer to the Unicode string to return.  This Unicode string
43
+                     is the name of the driver specified by This in the language
44
+                     specified by Language.
45
+
46
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This
47
+                                and the language specified by Language was returned
48
+                                in DriverName.
49
+  @retval EFI_INVALID_PARAMETER Language is NULL.
50
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
51
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
52
+                                language specified by Language.
53
+
54
+**/
55
+typedef
56
+EFI_STATUS
57
+(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME)(
58
+  IN EFI_COMPONENT_NAME_PROTOCOL           *This,
59
+  IN  CHAR8                                *Language,
60
+  OUT CHAR16                               **DriverName
61
+  );
62
+
63
+
64
+/**
65
+  Retrieves a Unicode string that is the user readable name of the controller
66
+  that is being managed by an EFI Driver.
67
+
68
+  @param  This             A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
69
+  @param  ControllerHandle The handle of a controller that the driver specified by
70
+                           This is managing.  This handle specifies the controller
71
+                           whose name is to be returned.
72
+  @param  ChildHandle      The handle of the child controller to retrieve the name
73
+                           of.  This is an optional parameter that may be NULL.  It
74
+                           will be NULL for device drivers.  It will also be NULL
75
+                           for a bus drivers that wish to retrieve the name of the
76
+                           bus controller.  It will not be NULL for a bus driver
77
+                           that wishes to retrieve the name of a child controller.
78
+  @param  Language         A pointer to a three character ISO 639-2 language
79
+                           identifier.  This is the language of the controller name
80
+                           that the caller is requesting, and it must match one
81
+                           of the languages specified in SupportedLanguages.  The
82
+                           number of languages supported by a driver is up to the
83
+                           driver writer.
84
+  @param  ControllerName   A pointer to the Unicode string to return.  This Unicode
85
+                           string is the name of the controller specified by
86
+                           ControllerHandle and ChildHandle in the language specified
87
+                           by Language, from the point of view of the driver specified
88
+                           by This.
89
+
90
+  @retval EFI_SUCCESS           The Unicode string for the user-readable name in the
91
+                                language specified by Language for the driver
92
+                                specified by This was returned in DriverName.
93
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
94
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
95
+  @retval EFI_INVALID_PARAMETER Language is NULL.
96
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.
97
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing
98
+                                the controller specified by ControllerHandle and
99
+                                ChildHandle.
100
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
101
+                                language specified by Language.
102
+
103
+**/
104
+typedef
105
+EFI_STATUS
106
+(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)(
107
+  IN EFI_COMPONENT_NAME_PROTOCOL                              *This,
108
+  IN  EFI_HANDLE                                              ControllerHandle,
109
+  IN  EFI_HANDLE                                              ChildHandle        OPTIONAL,
110
+  IN  CHAR8                                                   *Language,
111
+  OUT CHAR16                                                  **ControllerName
112
+  );
113
+
114
+///
115
+/// This protocol is used to retrieve user readable names of drivers
116
+/// and controllers managed by UEFI Drivers.
117
+///
118
+struct _EFI_COMPONENT_NAME_PROTOCOL {
119
+  EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;
120
+  EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;
121
+  ///
122
+  /// A Null-terminated ASCII string that contains one or more
123
+  /// ISO 639-2 language codes. This is the list of language codes
124
+  /// that this protocol supports.
125
+  ///
126
+  CHAR8                                   *SupportedLanguages;
127
+};
128
+
129
+extern EFI_GUID gEfiComponentNameProtocolGuid;
130
+
131
+#endif

+ 87
- 0
src/include/ipxe/efi/Protocol/LoadFile2.h 查看文件

@@ -0,0 +1,87 @@
1
+/** @file
2
+  Load File protocol as defined in the UEFI 2.0 specification.
3
+
4
+  Load file protocol exists to supports the addition of new boot devices,
5
+  and to support booting from devices that do not map well to file system.
6
+  Network boot is done via a LoadFile protocol.
7
+
8
+  UEFI 2.0 can boot from any device that produces a LoadFile protocol.
9
+
10
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
11
+  This program and the accompanying materials
12
+  are licensed and made available under the terms and conditions of the BSD License
13
+  which accompanies this distribution.  The full text of the license may be found at
14
+  http://opensource.org/licenses/bsd-license.php
15
+
16
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18
+
19
+**/
20
+
21
+#ifndef __EFI_LOAD_FILE2_PROTOCOL_H__
22
+#define __EFI_LOAD_FILE2_PROTOCOL_H__
23
+
24
+FILE_LICENCE ( BSD3 );
25
+
26
+#define EFI_LOAD_FILE2_PROTOCOL_GUID \
27
+  { \
28
+    0x4006c0c1, 0xfcb3, 0x403e, {0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d } \
29
+  }
30
+
31
+///
32
+/// Protocol Guid defined by UEFI2.1.
33
+///
34
+#define LOAD_FILE2_PROTOCOL EFI_LOAD_FILE2_PROTOCOL_GUID
35
+
36
+typedef struct _EFI_LOAD_FILE2_PROTOCOL EFI_LOAD_FILE2_PROTOCOL;
37
+
38
+
39
+/**
40
+  Causes the driver to load a specified file.
41
+
42
+  @param  This       Protocol instance pointer.
43
+  @param  FilePath   The device specific path of the file to load.
44
+  @param  BootPolicy Should always be FALSE.
45
+  @param  BufferSize On input the size of Buffer in bytes. On output with a return
46
+                     code of EFI_SUCCESS, the amount of data transferred to
47
+                     Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
48
+                     the size of Buffer required to retrieve the requested file.
49
+  @param  Buffer     The memory buffer to transfer the file to. IF Buffer is NULL,
50
+                     then no the size of the requested file is returned in
51
+                     BufferSize.
52
+
53
+  @retval EFI_SUCCESS           The file was loaded.
54
+  @retval EFI_UNSUPPORTED       BootPolicy is TRUE.
55
+  @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
56
+                                BufferSize is NULL.
57
+  @retval EFI_NO_MEDIA          No medium was present to load the file.
58
+  @retval EFI_DEVICE_ERROR      The file was not loaded due to a device error.
59
+  @retval EFI_NO_RESPONSE       The remote system did not respond.
60
+  @retval EFI_NOT_FOUND         The file was not found
61
+  @retval EFI_ABORTED           The file load process was manually canceled.
62
+  @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small to read the current
63
+                                directory entry. BufferSize has been updated with
64
+                                the size needed to complete the request.
65
+
66
+
67
+**/
68
+typedef
69
+EFI_STATUS
70
+(EFIAPI *EFI_LOAD_FILE2)(
71
+  IN EFI_LOAD_FILE2_PROTOCOL           *This,
72
+  IN EFI_DEVICE_PATH_PROTOCOL         *FilePath,
73
+  IN BOOLEAN                          BootPolicy,
74
+  IN OUT UINTN                        *BufferSize,
75
+  IN VOID                             *Buffer OPTIONAL
76
+  );
77
+
78
+///
79
+/// The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from arbitrary devices.
80
+///
81
+struct _EFI_LOAD_FILE2_PROTOCOL {
82
+  EFI_LOAD_FILE2 LoadFile;
83
+};
84
+
85
+extern EFI_GUID gEfiLoadFile2ProtocolGuid;
86
+
87
+#endif

+ 98
- 10
src/interface/efi/efi_debug.c 查看文件

@@ -32,17 +32,82 @@ FILE_LICENCE ( GPL2_OR_LATER );
32 32
 #include <ipxe/uuid.h>
33 33
 #include <ipxe/efi/efi.h>
34 34
 #include <ipxe/efi/efi_driver.h>
35
+#include <ipxe/efi/Protocol/BlockIo.h>
36
+#include <ipxe/efi/Protocol/BusSpecificDriverOverride.h>
37
+#include <ipxe/efi/Protocol/ComponentName.h>
38
+#include <ipxe/efi/Protocol/ComponentName2.h>
35 39
 #include <ipxe/efi/Protocol/DevicePath.h>
36 40
 #include <ipxe/efi/Protocol/DevicePathToText.h>
37
-#include <ipxe/efi/Protocol/BlockIo.h>
38 41
 #include <ipxe/efi/Protocol/DiskIo.h>
42
+#include <ipxe/efi/Protocol/DriverBinding.h>
43
+#include <ipxe/efi/Protocol/LoadFile.h>
44
+#include <ipxe/efi/Protocol/LoadFile2.h>
45
+#include <ipxe/efi/Protocol/LoadedImage.h>
46
+#include <ipxe/efi/Protocol/PciIo.h>
47
+#include <ipxe/efi/Protocol/PciRootBridgeIo.h>
39 48
 #include <ipxe/efi/Protocol/SimpleFileSystem.h>
40 49
 #include <ipxe/efi/Protocol/SimpleNetwork.h>
41 50
 
51
+/** Block I/O protocol GUID */
52
+static EFI_GUID efi_block_io_protocol_guid
53
+	= EFI_BLOCK_IO_PROTOCOL_GUID;
54
+
55
+/** Bus specific driver override protocol GUID */
56
+static EFI_GUID efi_bus_specific_driver_override_protocol_guid
57
+	= EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID;
58
+
59
+/** Component name protocol GUID */
60
+static EFI_GUID efi_component_name_protocol_guid
61
+	= EFI_COMPONENT_NAME_PROTOCOL_GUID;
62
+
63
+/** Component name 2 protocol GUID */
64
+static EFI_GUID efi_component_name2_protocol_guid
65
+	= EFI_COMPONENT_NAME2_PROTOCOL_GUID;
66
+
42 67
 /** Device path protocol GUID */
43 68
 static EFI_GUID efi_device_path_protocol_guid
44 69
 	= EFI_DEVICE_PATH_PROTOCOL_GUID;
45 70
 
71
+/** Disk I/O protocol GUID */
72
+static EFI_GUID efi_disk_io_protocol_guid
73
+	= EFI_DISK_IO_PROTOCOL_GUID;
74
+
75
+/** Driver binding protocol GUID */
76
+static EFI_GUID efi_driver_binding_protocol_guid
77
+	= EFI_DRIVER_BINDING_PROTOCOL_GUID;
78
+
79
+/** Load file protocol GUID */
80
+static EFI_GUID efi_load_file_protocol_guid
81
+	= EFI_LOAD_FILE_PROTOCOL_GUID;
82
+
83
+/** Load file 2 protocol GUID */
84
+static EFI_GUID efi_load_file2_protocol_guid
85
+	= EFI_LOAD_FILE2_PROTOCOL_GUID;
86
+
87
+/** Loaded image protocol GUID */
88
+static EFI_GUID efi_loaded_image_protocol_guid
89
+	= EFI_LOADED_IMAGE_PROTOCOL_GUID;
90
+
91
+/** Loaded image device path protocol GUID */
92
+static EFI_GUID efi_loaded_image_device_path_protocol_guid
93
+	= EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
94
+
95
+/** PCI I/O protocol GUID */
96
+static EFI_GUID efi_pci_io_protocol_guid
97
+	= EFI_PCI_IO_PROTOCOL_GUID;
98
+
99
+/** PCI root bridge I/O protocol GUID */
100
+static EFI_GUID efi_pci_root_bridge_io_protocol_guid
101
+	= EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
102
+
103
+/** Simple file system protocol GUID */
104
+static EFI_GUID efi_simple_file_system_protocol_guid
105
+	= EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
106
+
107
+/** Simple network protocol guid */
108
+static EFI_GUID efi_simple_network_protocol_guid
109
+	= EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
110
+
46 111
 /** Device path to text protocol */
47 112
 static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
48 113
 EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
@@ -50,20 +115,43 @@ EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
50 115
 /** A well-known GUID */
51 116
 struct efi_well_known_guid {
52 117
 	/** GUID */
53
-	EFI_GUID guid;
118
+	EFI_GUID *guid;
54 119
 	/** Name */
55 120
 	const char *name;
56 121
 };
57 122
 
58 123
 /** Well-known GUIDs */
59 124
 static struct efi_well_known_guid efi_well_known_guids[] = {
60
-	{ EFI_BLOCK_IO_PROTOCOL_GUID,		"BlockIo" },
61
-	{ EFI_DISK_IO_PROTOCOL_GUID,		"DiskIo" },
62
-	{ EFI_DEVICE_PATH_PROTOCOL_GUID,	"DevicePath" },
63
-	{ EFI_LOADED_IMAGE_PROTOCOL_GUID,	"LoadedImage" },
64
-	{ EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID, "LoadedImageDevicePath" },
65
-	{ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID,	"SimpleFileSystem" },
66
-	{ EFI_SIMPLE_NETWORK_PROTOCOL_GUID,	"SimpleNetwork" },
125
+	{ &efi_block_io_protocol_guid,
126
+	  "BlockIo" },
127
+	{ &efi_bus_specific_driver_override_protocol_guid,
128
+	  "BusSpecificDriverOverride" },
129
+	{ &efi_component_name2_protocol_guid,
130
+	  "ComponentName2" },
131
+	{ &efi_component_name_protocol_guid,
132
+	  "ComponentName" },
133
+	{ &efi_device_path_protocol_guid,
134
+	  "DevicePath" },
135
+	{ &efi_driver_binding_protocol_guid,
136
+	  "DriverBinding" },
137
+	{ &efi_disk_io_protocol_guid,
138
+	  "DiskIo" },
139
+	{ &efi_load_file_protocol_guid,
140
+	  "LoadFile" },
141
+	{ &efi_load_file2_protocol_guid,
142
+	  "LoadFile2" },
143
+	{ &efi_loaded_image_protocol_guid,
144
+	  "LoadedImage" },
145
+	{ &efi_loaded_image_device_path_protocol_guid,
146
+	  "LoadedImageDevicePath"},
147
+	{ &efi_pci_io_protocol_guid,
148
+	  "PciIo" },
149
+	{ &efi_pci_root_bridge_io_protocol_guid,
150
+	  "PciRootBridgeIo" },
151
+	{ &efi_simple_file_system_protocol_guid,
152
+	  "SimpleFileSystem" },
153
+	{ &efi_simple_network_protocol_guid,
154
+	  "SimpleNetwork" },
67 155
 };
68 156
 
69 157
 /**
@@ -82,7 +170,7 @@ const char * efi_guid_ntoa ( EFI_GUID *guid ) {
82 170
 	/* Check for a match against well-known GUIDs */
83 171
 	for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
84 172
 			    sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
85
-		if ( memcmp ( guid, &efi_well_known_guids[i].guid,
173
+		if ( memcmp ( guid, efi_well_known_guids[i].guid,
86 174
 			      sizeof ( *guid ) ) == 0 ) {
87 175
 			return efi_well_known_guids[i].name;
88 176
 		}

Loading…
取消
儲存