瀏覽代碼

[efi] Use efi_handle_name() instead of efi_handle_devpath_text()

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

+ 3
- 3
src/drivers/net/efi/snp.c 查看文件

@@ -49,7 +49,7 @@ static int snp_supported ( EFI_HANDLE device ) {
49 49
 	/* Check that this is not a device we are providing ourselves */
50 50
 	if ( find_snpdev ( device ) != NULL ) {
51 51
 		DBGCP ( device, "SNP %p %s is provided by this binary\n",
52
-			device, efi_handle_devpath_text ( device ) );
52
+			device, efi_handle_name ( device ) );
53 53
 		return -ENOTTY;
54 54
 	}
55 55
 
@@ -59,11 +59,11 @@ static int snp_supported ( EFI_HANDLE device ) {
59 59
 					  NULL, efi_image_handle, device,
60 60
 					  EFI_OPEN_PROTOCOL_TEST_PROTOCOL))!=0){
61 61
 		DBGCP ( device, "SNP %p %s is not an SNP device\n",
62
-			device, efi_handle_devpath_text ( device ) );
62
+			device, efi_handle_name ( device ) );
63 63
 		return -EEFI ( efirc );
64 64
 	}
65 65
 	DBGC ( device, "SNP %p %s is an SNP device\n",
66
-	       device, efi_handle_devpath_text ( device ) );
66
+	       device, efi_handle_name ( device ) );
67 67
 
68 68
 	return 0;
69 69
 }

+ 1
- 1
src/drivers/net/efi/snponly.c 查看文件

@@ -43,7 +43,7 @@ static int snponly_supported ( EFI_HANDLE device ) {
43 43
 		return -ENOTTY;
44 44
 
45 45
 	DBGC ( device, "SNP %p %s is the SNP chainloading device\n",
46
-	       device, efi_handle_devpath_text ( device ) );
46
+	       device, efi_handle_name ( device ) );
47 47
 
48 48
 	return 0;
49 49
 }

+ 0
- 1
src/include/ipxe/efi/efi.h 查看文件

@@ -150,7 +150,6 @@ extern EFI_SYSTEM_TABLE *efi_systab;
150 150
 
151 151
 extern const char * efi_guid_ntoa ( EFI_GUID *guid );
152 152
 extern const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path );
153
-extern const char * efi_handle_devpath_text ( EFI_HANDLE handle );
154 153
 extern const char * efi_handle_name ( EFI_HANDLE handle );
155 154
 
156 155
 extern void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol );

+ 4
- 5
src/interface/efi/efi_bofm.c 查看文件

@@ -175,7 +175,7 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
175 175
 	/* Look for a BOFM driver */
176 176
 	if ( ( rc = bofm_find_driver ( &pci ) ) != 0 ) {
177 177
 		DBGCP ( device, "EFIBOFM %p %s has no driver\n",
178
-			device, efi_handle_devpath_text ( device ) );
178
+			device, efi_handle_name ( device ) );
179 179
 		return rc;
180 180
 	}
181 181
 
@@ -184,7 +184,7 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
184 184
 					    &bofm1.interface ) ) != 0 ) {
185 185
 		rc = -EEFI ( efirc );
186 186
 		DBGC ( device, "EFIBOFM %p %s cannot find BOFM protocol\n",
187
-		       device, efi_handle_devpath_text ( device ) );
187
+		       device, efi_handle_name ( device ) );
188 188
 		return rc;
189 189
 	}
190 190
 
@@ -195,13 +195,12 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
195 195
 						      0x02 /* Version */ ))!=0){
196 196
 		rc = -EEFI ( efirc );
197 197
 		DBGC ( device, "EFIBOFM %p %s could not register support: %s\n",
198
-		       device, efi_handle_devpath_text ( device ),
199
-		       strerror ( rc ) );
198
+		       device, efi_handle_name ( device ), strerror ( rc ) );
200 199
 		return rc;
201 200
 	}
202 201
 
203 202
 	DBGC ( device, "EFIBOFM %p %s has driver \"%s\"\n",
204
-	       device, efi_handle_devpath_text ( device ), pci.id->name );
203
+	       device, efi_handle_name ( device ), pci.id->name );
205 204
 	return 0;
206 205
 }
207 206
 

+ 0
- 34
src/interface/efi/efi_debug.c 查看文件

@@ -550,37 +550,3 @@ const char * efi_handle_name ( EFI_HANDLE handle ) {
550 550
 
551 551
 	return "UNKNOWN";
552 552
 }
553
-
554
-/**
555
- * Get textual representation of device path for a handle
556
- *
557
- * @v handle		EFI handle
558
- * @ret text		Textual representation of device path, or NULL
559
- */
560
-const char * efi_handle_devpath_text ( EFI_HANDLE handle ) {
561
-	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
562
-	union {
563
-		EFI_DEVICE_PATH_PROTOCOL *path;
564
-		void *interface;
565
-	} path;
566
-	const char *text;
567
-	EFI_STATUS efirc;
568
-
569
-	/* Obtain device path, if any */
570
-	if ( ( efirc = bs->OpenProtocol ( handle,
571
-					  &efi_device_path_protocol_guid,
572
-					  &path.interface, efi_image_handle,
573
-					  handle,
574
-					  EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
575
-		return NULL;
576
-	}
577
-
578
-	/* Format device path */
579
-	text = efi_devpath_text ( path.path );
580
-
581
-	/* Close device path */
582
-	bs->CloseProtocol ( handle, &efi_device_path_protocol_guid,
583
-			    efi_image_handle, handle );
584
-
585
-	return text;
586
-}

+ 24
- 25
src/interface/efi/efi_driver.c 查看文件

@@ -134,16 +134,15 @@ int efidev_child_add ( struct efi_device *efidev, EFI_HANDLE device ) {
134 134
 					  ) ) != 0 ) {
135 135
 		rc = -EEFI ( efirc );
136 136
 		DBGC ( efidev->device, "EFIDRV %p %s could not add child",
137
-		       efidev->device, efi_devpath_text ( efidev->path ) );
137
+		       efidev->device, efi_handle_name ( efidev->device ) );
138 138
 		DBGC ( efidev->device, " %p %s: %s\n", device,
139
-		       efi_handle_devpath_text ( device ), strerror ( rc ) );
139
+		       efi_handle_name ( device ), strerror ( rc ) );
140 140
 		return rc;
141 141
 	}
142 142
 
143 143
 	DBGC2 ( efidev->device, "EFIDRV %p %s added child",
144
-		efidev->device, efi_devpath_text ( efidev->path ) );
145
-	DBGC2 ( efidev->device, " %p %s\n",
146
-		device, efi_handle_devpath_text ( device ) );
144
+		efidev->device, efi_handle_name ( efidev->device ) );
145
+	DBGC2 ( efidev->device, " %p %s\n", device, efi_handle_name ( device ));
147 146
 	return 0;
148 147
 }
149 148
 
@@ -161,9 +160,9 @@ void efidev_child_del ( struct efi_device *efidev, EFI_HANDLE device ) {
161 160
 			    &efi_device_path_protocol_guid,
162 161
 			    efi_image_handle, device );
163 162
 	DBGC2 ( efidev->device, "EFIDRV %p %s removed child",
164
-		efidev->device, efi_devpath_text ( efidev->path ) );
163
+		efidev->device, efi_handle_name ( efidev->device ) );
165 164
 	DBGC2 ( efidev->device, " %p %s\n",
166
-		device, efi_handle_devpath_text ( device ) );
165
+		device, efi_handle_name ( device ) );
167 166
 }
168 167
 
169 168
 /**
@@ -181,7 +180,7 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
181 180
 	int rc;
182 181
 
183 182
 	DBGCP ( device, "EFIDRV %p %s DRIVER_SUPPORTED",
184
-		device, efi_handle_devpath_text ( device ) );
183
+		device, efi_handle_name ( device ) );
185 184
 	if ( child )
186 185
 		DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
187 186
 	DBGCP ( device, "\n" );
@@ -189,7 +188,7 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
189 188
 	/* Do nothing if we are already driving this device */
190 189
 	if ( efidev_find ( device ) != NULL ) {
191 190
 		DBGCP ( device, "EFIDRV %p %s is already started\n",
192
-			device, efi_handle_devpath_text ( device ) );
191
+			device, efi_handle_name ( device ) );
193 192
 		return EFI_ALREADY_STARTED;
194 193
 	}
195 194
 
@@ -197,13 +196,13 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
197 196
 	for_each_table_entry ( efidrv, EFI_DRIVERS ) {
198 197
 		if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
199 198
 			DBGC ( device, "EFIDRV %p %s has driver \"%s\"\n",
200
-			       device, efi_handle_devpath_text ( device ),
199
+			       device, efi_handle_name ( device ),
201 200
 			       efidrv->name );
202 201
 			return 0;
203 202
 		}
204 203
 	}
205 204
 	DBGCP ( device, "EFIDRV %p %s has no driver\n",
206
-		device, efi_handle_devpath_text ( device ) );
205
+		device, efi_handle_name ( device ) );
207 206
 
208 207
 	return EFI_UNSUPPORTED;
209 208
 }
@@ -230,7 +229,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
230 229
 	int rc;
231 230
 
232 231
 	DBGC ( device, "EFIDRV %p %s DRIVER_START",
233
-	       device, efi_handle_devpath_text ( device ) );
232
+	       device, efi_handle_name ( device ) );
234 233
 	if ( child )
235 234
 		DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
236 235
 	DBGC ( device, "\n" );
@@ -239,7 +238,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
239 238
 	efidev = efidev_find ( device );
240 239
 	if ( efidev ) {
241 240
 		DBGCP ( device, "EFIDRV %p %s is already started\n",
242
-			device, efi_devpath_text ( efidev->path ) );
241
+			device, efi_handle_name ( device ) );
243 242
 		efirc = EFI_ALREADY_STARTED;
244 243
 		goto err_already_started;
245 244
 	}
@@ -263,7 +262,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
263 262
 					  EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
264 263
 		rc = -EEFI ( efirc );
265 264
 		DBGC ( device, "EFIDRV %p %s could not open device path: %s\n",
266
-		       device, efi_handle_devpath_text ( device ),
265
+		       device, efi_handle_name ( device ),
267 266
 		       strerror ( rc ) );
268 267
 		goto err_no_device_path;
269 268
 	}
@@ -273,20 +272,20 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
273 272
 	for_each_table_entry ( efidrv, EFI_DRIVERS ) {
274 273
 		if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
275 274
 			DBGC ( device, "EFIDEV %p %s is not supported by "
276
-			       "driver \"%s\": %s\n",
277
-			       device, efi_devpath_text ( efidev->path ),
278
-			       efidrv->name, strerror ( rc ) );
275
+			       "driver \"%s\": %s\n", device,
276
+			       efi_handle_name ( device ), efidrv->name,
277
+			       strerror ( rc ) );
279 278
 			continue;
280 279
 		}
281 280
 		if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
282 281
 			efidev->driver = efidrv;
283 282
 			DBGC ( device, "EFIDRV %p %s using driver \"%s\"\n",
284
-			       device, efi_devpath_text ( efidev->path ),
283
+			       device, efi_handle_name ( device ),
285 284
 			       efidev->driver->name );
286 285
 			return 0;
287 286
 		}
288 287
 		DBGC ( device, "EFIDRV %p %s could not start driver \"%s\": "
289
-		       "%s\n", device, efi_devpath_text ( efidev->path ),
288
+		       "%s\n", device, efi_handle_name ( device ),
290 289
 		       efidrv->name, strerror ( rc ) );
291 290
 	}
292 291
 	efirc = EFI_UNSUPPORTED;
@@ -321,10 +320,10 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
321 320
 	UINTN i;
322 321
 
323 322
 	DBGC ( device, "EFIDRV %p %s DRIVER_STOP",
324
-	       device, efi_handle_devpath_text ( device ) );
323
+	       device, efi_handle_name ( device ) );
325 324
 	for ( i = 0 ; i < num_children ; i++ ) {
326 325
 		DBGC ( device, "%s%p %s", ( i ? ", " : " child " ),
327
-		       children[i], efi_handle_devpath_text ( children[i] ) );
326
+		       children[i], efi_handle_name ( children[i] ) );
328 327
 	}
329 328
 	DBGC ( device, "\n" );
330 329
 
@@ -332,7 +331,7 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
332 331
 	efidev = efidev_find ( device );
333 332
 	if ( ! efidev ) {
334 333
 		DBGCP ( device, "EFIDRV %p %s is not started\n",
335
-			device, efi_devpath_text ( efidev->path ) );
334
+			device, efi_handle_name ( device ) );
336 335
 		return 0;
337 336
 	}
338 337
 
@@ -488,17 +487,17 @@ static int efi_driver_connect ( EFI_HANDLE device ) {
488 487
 
489 488
 	/* Disconnect any existing drivers */
490 489
 	DBGC ( device, "EFIDRV %p %s disconnecting existing drivers\n",
491
-	       device, efi_handle_devpath_text ( device ) );
490
+	       device, efi_handle_name ( device ) );
492 491
 	bs->DisconnectController ( device, NULL, NULL );
493 492
 
494 493
 	/* Connect our driver */
495 494
 	DBGC ( device, "EFIDRV %p %s connecting new drivers\n",
496
-	       device, efi_handle_devpath_text ( device ) );
495
+	       device, efi_handle_name ( device ) );
497 496
 	if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
498 497
 					       FALSE ) ) != 0 ) {
499 498
 		rc = -EEFI ( efirc );
500 499
 		DBGC ( device, "EFIDRV %p %s could not connect new drivers: "
501
-		       "%s\n", device, efi_handle_devpath_text ( device ),
500
+		       "%s\n", device, efi_handle_name ( device ),
502 501
 		       strerror ( rc ) );
503 502
 		return rc;
504 503
 	}

+ 9
- 11
src/interface/efi/efi_pci.c 查看文件

@@ -149,8 +149,7 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
149 149
 					  device, attributes ) ) != 0 ) {
150 150
 		rc = -EEFI_PCI ( efirc );
151 151
 		DBGCP ( device, "EFIPCI %p %s cannot open PCI protocols: %s\n",
152
-			device, efi_handle_devpath_text ( device ),
153
-			strerror ( rc ) );
152
+			device, efi_handle_name ( device ), strerror ( rc ) );
154 153
 		goto err_open_protocol;
155 154
 	}
156 155
 
@@ -160,14 +159,13 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
160 159
 						    &pci_fn ) ) != 0 ) {
161 160
 		rc = -EEFI ( efirc );
162 161
 		DBGC ( device, "EFIPCI %p %s could not get PCI location: %s\n",
163
-		       device, efi_handle_devpath_text ( device ),
164
-		       strerror ( rc ) );
162
+		       device, efi_handle_name ( device ), strerror ( rc ) );
165 163
 		goto err_get_location;
166 164
 	}
167
-	DBGC2 ( device, "EFIPCI %p %s is PCI %04lx:%02lx:%02lx.%lx\n",
168
-		device, efi_handle_devpath_text ( device ),
169
-		( ( unsigned long ) pci_segment ), ( ( unsigned long ) pci_bus),
170
-		( ( unsigned long ) pci_dev ), ( ( unsigned long ) pci_fn ) );
165
+	DBGC2 ( device, "EFIPCI %p %s is PCI %04lx:%02lx:%02lx.%lx\n", device,
166
+		efi_handle_name ( device ), ( ( unsigned long ) pci_segment ),
167
+		( ( unsigned long ) pci_bus ), ( ( unsigned long ) pci_dev ),
168
+		( ( unsigned long ) pci_fn ) );
171 169
 
172 170
 	/* Try to enable I/O cycles, memory cycles, and bus mastering.
173 171
 	 * Some platforms will 'helpfully' report errors if these bits
@@ -189,7 +187,7 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
189 187
 	pci_init ( pci, PCI_BUSDEVFN ( pci_bus, pci_dev, pci_fn ) );
190 188
 	if ( ( rc = pci_read_config ( pci ) ) != 0 ) {
191 189
 		DBGC ( device, "EFIPCI %p %s cannot read PCI configuration: "
192
-		       "%s\n", device, efi_handle_devpath_text ( device ),
190
+		       "%s\n", device, efi_handle_name ( device ),
193 191
 		       strerror ( rc ) );
194 192
 		goto err_pci_read_config;
195 193
 	}
@@ -261,11 +259,11 @@ static int efipci_supported ( EFI_HANDLE device ) {
261 259
 	/* Look for a driver */
262 260
 	if ( ( rc = pci_find_driver ( &pci ) ) != 0 ) {
263 261
 		DBGCP ( device, "EFIPCI %p %s has no driver\n",
264
-			device, efi_handle_devpath_text ( device ) );
262
+			device, efi_handle_name ( device ) );
265 263
 		return rc;
266 264
 	}
267 265
 	DBGC ( device, "EFIPCI %p %s has driver \"%s\"\n",
268
-	       device, efi_handle_devpath_text ( device ), pci.id->name );
266
+	       device, efi_handle_name ( device ), pci.id->name );
269 267
 
270 268
 	return 0;
271 269
 }

+ 8
- 8
src/interface/efi/efi_wrap.c 查看文件

@@ -107,7 +107,7 @@ efi_handle_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
107 107
 	EFI_STATUS efirc;
108 108
 
109 109
 	DBGC ( colour, "HandleProtocol ( %p %s, %s, ... ) ", handle,
110
-	       efi_handle_devpath_text ( handle ), efi_guid_ntoa ( protocol ) );
110
+	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
111 111
 	efirc = bs->HandleProtocol ( handle, protocol, interface );
112 112
 	DBGC ( colour, "= %s ( %p ) -> %p\n",
113 113
 	       efi_status ( efirc ), *interface, retaddr );
@@ -153,7 +153,7 @@ efi_locate_device_path_wrapper ( EFI_GUID *protocol,
153 153
 	DBGC ( colour, "= %s ( %p, ",
154 154
 	       efi_status ( efirc ), efi_devpath_text ( *device_path ) );
155 155
 	DBGC ( colour, "%p %s ) -> %p\n",
156
-	       *device, efi_handle_devpath_text ( *device ), retaddr );
156
+	       *device, efi_handle_name ( *device ), retaddr );
157 157
 	return efirc;
158 158
 }
159 159
 
@@ -170,11 +170,11 @@ efi_open_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
170 170
 	EFI_STATUS efirc;
171 171
 
172 172
 	DBGC ( colour, "OpenProtocol ( %p %s, %s, ..., ", handle,
173
-	       efi_handle_devpath_text ( handle ), efi_guid_ntoa ( protocol ) );
173
+	       efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
174 174
 	DBGC ( colour, "%p %s, ", agent_handle,
175
-	       efi_handle_devpath_text ( agent_handle ) );
175
+	       efi_handle_name ( agent_handle ) );
176 176
 	DBGC ( colour, "%p %s, %#x ) ", controller_handle,
177
-	       efi_handle_devpath_text ( controller_handle ), attributes );
177
+	       efi_handle_name ( controller_handle ), attributes );
178 178
 	efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
179 179
 				   controller_handle, attributes );
180 180
 	DBGC ( colour, "= %s ( %p ) -> %p\n",
@@ -228,12 +228,12 @@ void efi_wrap ( EFI_HANDLE handle, EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
228 228
 	/* Provide system table wrapper to image */
229 229
 	loaded->SystemTable = &efi_systab_wrapper;
230 230
 	DBGC ( colour, "Wrapped image %p %s at base %p has protocols:\n",
231
-	       handle, efi_handle_devpath_text ( handle ), loaded->ImageBase );
231
+	       handle, efi_handle_name ( handle ), loaded->ImageBase );
232 232
 	DBGC_EFI_PROTOCOLS ( colour, handle );
233 233
 	DBGC ( colour, "Parent image %p %s\n", loaded->ParentHandle,
234
-	       efi_handle_devpath_text ( loaded->ParentHandle ) );
234
+	       efi_handle_name ( loaded->ParentHandle ) );
235 235
 	DBGC ( colour, "Device %p %s ", loaded->DeviceHandle,
236
-	       efi_handle_devpath_text ( loaded->DeviceHandle ) );
236
+	       efi_handle_name ( loaded->DeviceHandle ) );
237 237
 	DBGC ( colour, "file %p %s\n", loaded->FilePath,
238 238
 	       efi_devpath_text ( loaded->FilePath ) );
239 239
 }

Loading…
取消
儲存