Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

efi/libstub: gop: Initialize screen_info in helper function

Move initialization of screen_info into a single helper function.
Frees up space in the main setup helper for adding EDID support.
No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by

Thomas Zimmermann and committed by
Ard Biesheuvel
ae42b9c5 9d805709

+33 -43
+33 -43
drivers/firmware/efi/libstub/gop.c
··· 367 367 *size = __fls(mask) - *pos + 1; 368 368 } 369 369 370 - static void 371 - setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line, 372 - efi_pixel_bitmask_t pixel_info, int pixel_format) 370 + static void setup_screen_info(struct screen_info *si, const efi_graphics_output_protocol_t *gop) 373 371 { 374 - if (pixel_format == PIXEL_BIT_MASK) { 375 - find_bits(pixel_info.red_mask, 376 - &si->red_pos, &si->red_size); 377 - find_bits(pixel_info.green_mask, 378 - &si->green_pos, &si->green_size); 379 - find_bits(pixel_info.blue_mask, 380 - &si->blue_pos, &si->blue_size); 381 - find_bits(pixel_info.reserved_mask, 382 - &si->rsvd_pos, &si->rsvd_size); 383 - si->lfb_depth = si->red_size + si->green_size + 384 - si->blue_size + si->rsvd_size; 385 - si->lfb_linelength = (pixels_per_scan_line * si->lfb_depth) / 8; 372 + const efi_graphics_output_protocol_mode_t *mode = efi_table_attr(gop, mode); 373 + const efi_graphics_output_mode_info_t *info = efi_table_attr(mode, info); 374 + 375 + si->orig_video_isVGA = VIDEO_TYPE_EFI; 376 + 377 + si->lfb_width = info->horizontal_resolution; 378 + si->lfb_height = info->vertical_resolution; 379 + 380 + efi_set_u64_split(efi_table_attr(mode, frame_buffer_base), 381 + &si->lfb_base, &si->ext_lfb_base); 382 + if (si->ext_lfb_base) 383 + si->capabilities |= VIDEO_CAPABILITY_64BIT_BASE; 384 + si->pages = 1; 385 + 386 + if (info->pixel_format == PIXEL_BIT_MASK) { 387 + find_bits(info->pixel_information.red_mask, &si->red_pos, &si->red_size); 388 + find_bits(info->pixel_information.green_mask, &si->green_pos, &si->green_size); 389 + find_bits(info->pixel_information.blue_mask, &si->blue_pos, &si->blue_size); 390 + find_bits(info->pixel_information.reserved_mask, &si->rsvd_pos, &si->rsvd_size); 391 + si->lfb_depth = si->red_size + si->green_size + si->blue_size + si->rsvd_size; 392 + si->lfb_linelength = (info->pixels_per_scan_line * si->lfb_depth) / 8; 386 393 } else { 387 - if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) { 394 + if (info->pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) { 388 395 si->red_pos = 0; 389 396 si->blue_pos = 16; 390 397 } else /* PIXEL_BGR_RESERVED_8BIT_PER_COLOR */ { ··· 401 394 402 395 si->green_pos = 8; 403 396 si->rsvd_pos = 24; 404 - si->red_size = si->green_size = 405 - si->blue_size = si->rsvd_size = 8; 406 - 397 + si->red_size = 8; 398 + si->green_size = 8; 399 + si->blue_size = 8; 400 + si->rsvd_size = 8; 407 401 si->lfb_depth = 32; 408 - si->lfb_linelength = pixels_per_scan_line * 4; 402 + si->lfb_linelength = info->pixels_per_scan_line * 4; 409 403 } 404 + 405 + si->lfb_size = si->lfb_linelength * si->lfb_height; 406 + si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; 410 407 } 411 408 412 409 static efi_handle_t find_handle_with_primary_gop(unsigned long num, const efi_handle_t handles[], ··· 473 462 { 474 463 efi_handle_t *handles __free(efi_pool) = NULL; 475 464 efi_handle_t handle; 476 - efi_graphics_output_protocol_mode_t *mode; 477 - efi_graphics_output_mode_info_t *info; 478 465 efi_graphics_output_protocol_t *gop; 479 466 efi_status_t status; 480 467 unsigned long num; ··· 491 482 set_mode(gop); 492 483 493 484 /* EFI framebuffer */ 494 - mode = efi_table_attr(gop, mode); 495 - info = efi_table_attr(mode, info); 496 - 497 - si->orig_video_isVGA = VIDEO_TYPE_EFI; 498 - 499 - si->lfb_width = info->horizontal_resolution; 500 - si->lfb_height = info->vertical_resolution; 501 - 502 - efi_set_u64_split(efi_table_attr(mode, frame_buffer_base), 503 - &si->lfb_base, &si->ext_lfb_base); 504 - if (si->ext_lfb_base) 505 - si->capabilities |= VIDEO_CAPABILITY_64BIT_BASE; 506 - 507 - si->pages = 1; 508 - 509 - setup_pixel_info(si, info->pixels_per_scan_line, 510 - info->pixel_information, info->pixel_format); 511 - 512 - si->lfb_size = si->lfb_linelength * si->lfb_height; 513 - 514 - si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; 485 + if (si) 486 + setup_screen_info(si, gop); 515 487 516 488 return EFI_SUCCESS; 517 489 }