aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/boot/compressed/eboot.c111
1 files changed, 26 insertions, 85 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 011d5c289449..ac8e442db71f 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -318,81 +318,54 @@ static void setup_quirks(struct boot_params *boot_params)
318 } 318 }
319} 319}
320 320
321/*
322 * See if we have Universal Graphics Adapter (UGA) protocol
323 */
321static efi_status_t 324static efi_status_t
322setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height) 325setup_uga(struct screen_info *si, efi_guid_t *uga_proto, unsigned long size)
323{ 326{
327 efi_status_t status;
328 u32 width, height;
329 void **uga_handle = NULL;
324 efi_uga_draw_protocol_t *uga = NULL, *first_uga; 330 efi_uga_draw_protocol_t *uga = NULL, *first_uga;
325 efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
326 unsigned long nr_ugas; 331 unsigned long nr_ugas;
327 u32 *handles = (u32 *)uga_handle;
328 efi_status_t status = EFI_INVALID_PARAMETER;
329 int i; 332 int i;
330 333
331 first_uga = NULL; 334 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
332 nr_ugas = size / sizeof(u32); 335 size, (void **)&uga_handle);
333 for (i = 0; i < nr_ugas; i++) { 336 if (status != EFI_SUCCESS)
334 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; 337 return status;
335 u32 w, h, depth, refresh;
336 void *pciio;
337 u32 handle = handles[i];
338
339 status = efi_call_early(handle_protocol, handle,
340 &uga_proto, (void **)&uga);
341 if (status != EFI_SUCCESS)
342 continue;
343
344 efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
345
346 status = efi_early->call((unsigned long)uga->get_mode, uga,
347 &w, &h, &depth, &refresh);
348 if (status == EFI_SUCCESS && (!first_uga || pciio)) {
349 *width = w;
350 *height = h;
351
352 /*
353 * Once we've found a UGA supporting PCIIO,
354 * don't bother looking any further.
355 */
356 if (pciio)
357 break;
358
359 first_uga = uga;
360 }
361 }
362 338
363 return status; 339 status = efi_call_early(locate_handle,
364} 340 EFI_LOCATE_BY_PROTOCOL,
341 uga_proto, NULL, &size, uga_handle);
342 if (status != EFI_SUCCESS)
343 goto free_handle;
365 344
366static efi_status_t 345 height = 0;
367setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height) 346 width = 0;
368{
369 efi_uga_draw_protocol_t *uga = NULL, *first_uga;
370 efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
371 unsigned long nr_ugas;
372 u64 *handles = (u64 *)uga_handle;
373 efi_status_t status = EFI_INVALID_PARAMETER;
374 int i;
375 347
376 first_uga = NULL; 348 first_uga = NULL;
377 nr_ugas = size / sizeof(u64); 349 nr_ugas = size / (efi_is_64bit() ? sizeof(u64) : sizeof(u32));
378 for (i = 0; i < nr_ugas; i++) { 350 for (i = 0; i < nr_ugas; i++) {
379 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; 351 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
380 u32 w, h, depth, refresh; 352 u32 w, h, depth, refresh;
381 void *pciio; 353 void *pciio;
382 u64 handle = handles[i]; 354 unsigned long handle = efi_is_64bit() ? ((u64 *)uga_handle)[i]
355 : ((u32 *)uga_handle)[i];
383 356
384 status = efi_call_early(handle_protocol, handle, 357 status = efi_call_early(handle_protocol, handle,
385 &uga_proto, (void **)&uga); 358 uga_proto, (void **)&uga);
386 if (status != EFI_SUCCESS) 359 if (status != EFI_SUCCESS)
387 continue; 360 continue;
388 361
389 efi_call_early(handle_protocol, handle, &pciio_proto, &pciio); 362 efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
390 363
391 status = efi_early->call((unsigned long)uga->get_mode, uga, 364 status = efi_call_proto(efi_uga_draw_protocol, get_mode, uga,
392 &w, &h, &depth, &refresh); 365 &w, &h, &depth, &refresh);
393 if (status == EFI_SUCCESS && (!first_uga || pciio)) { 366 if (status == EFI_SUCCESS && (!first_uga || pciio)) {
394 *width = w; 367 width = w;
395 *height = h; 368 height = h;
396 369
397 /* 370 /*
398 * Once we've found a UGA supporting PCIIO, 371 * Once we've found a UGA supporting PCIIO,
@@ -405,38 +378,6 @@ setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height)
405 } 378 }
406 } 379 }
407 380
408 return status;
409}
410
411/*
412 * See if we have Universal Graphics Adapter (UGA) protocol
413 */
414static efi_status_t
415setup_uga(struct screen_info *si, efi_guid_t *uga_proto, unsigned long size)
416{
417 efi_status_t status;
418 u32 width, height;
419 void **uga_handle = NULL;
420
421 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
422 size, (void **)&uga_handle);
423 if (status != EFI_SUCCESS)
424 return status;
425
426 status = efi_call_early(locate_handle,
427 EFI_LOCATE_BY_PROTOCOL,
428 uga_proto, NULL, &size, uga_handle);
429 if (status != EFI_SUCCESS)
430 goto free_handle;
431
432 height = 0;
433 width = 0;
434
435 if (efi_early->is64)
436 status = setup_uga64(uga_handle, size, &width, &height);
437 else
438 status = setup_uga32(uga_handle, size, &width, &height);
439
440 if (!width && !height) 381 if (!width && !height)
441 goto free_handle; 382 goto free_handle;
442 383