Skip to content

Commit

Permalink
efi/gop: Convert GOP structures to typedef and clean up some types
Browse files Browse the repository at this point in the history
Use typedef for the GOP structures, in anticipation of unifying
32/64-bit code. Also use more appropriate types in the non-bitness
specific structures for the framebuffer address and pointers.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: James Morse <james.morse@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191224151025.32482-4-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Arvind Sankar authored and Ingo Molnar committed Dec 25, 2019
1 parent 6c895c2 commit 44c84b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
26 changes: 13 additions & 13 deletions drivers/firmware/efi/libstub/gop.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size)

static void
setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line,
struct efi_pixel_bitmask pixel_info, int pixel_format)
efi_pixel_bitmask_t pixel_info, int pixel_format)
{
if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) {
si->lfb_depth = 32;
Expand Down Expand Up @@ -87,13 +87,13 @@ static efi_status_t
setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,
efi_guid_t *proto, unsigned long size, void **gop_handle)
{
struct efi_graphics_output_protocol_32 *gop32, *first_gop;
efi_graphics_output_protocol_32_t *gop32, *first_gop;
unsigned long nr_gops;
u16 width, height;
u32 pixels_per_scan_line;
u32 ext_lfb_base;
u64 fb_base;
struct efi_pixel_bitmask pixel_info;
efi_physical_addr_t fb_base;
efi_pixel_bitmask_t pixel_info;
int pixel_format;
efi_status_t status;
u32 *handles = (u32 *)(unsigned long)gop_handle;
Expand All @@ -104,13 +104,13 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,

nr_gops = size / sizeof(u32);
for (i = 0; i < nr_gops; i++) {
struct efi_graphics_output_protocol_mode_32 *mode;
struct efi_graphics_output_mode_info *info = NULL;
efi_graphics_output_protocol_mode_32_t *mode;
efi_graphics_output_mode_info_t *info = NULL;
efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
bool conout_found = false;
void *dummy = NULL;
efi_handle_t h = (efi_handle_t)(unsigned long)handles[i];
u64 current_fb_base;
efi_physical_addr_t current_fb_base;

status = efi_call_early(handle_protocol, h,
proto, (void **)&gop32);
Expand Down Expand Up @@ -184,13 +184,13 @@ static efi_status_t
setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,
efi_guid_t *proto, unsigned long size, void **gop_handle)
{
struct efi_graphics_output_protocol_64 *gop64, *first_gop;
efi_graphics_output_protocol_64_t *gop64, *first_gop;
unsigned long nr_gops;
u16 width, height;
u32 pixels_per_scan_line;
u32 ext_lfb_base;
u64 fb_base;
struct efi_pixel_bitmask pixel_info;
efi_physical_addr_t fb_base;
efi_pixel_bitmask_t pixel_info;
int pixel_format;
efi_status_t status;
u64 *handles = (u64 *)(unsigned long)gop_handle;
Expand All @@ -201,13 +201,13 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,

nr_gops = size / sizeof(u64);
for (i = 0; i < nr_gops; i++) {
struct efi_graphics_output_protocol_mode_64 *mode;
struct efi_graphics_output_mode_info *info = NULL;
efi_graphics_output_protocol_mode_64_t *mode;
efi_graphics_output_mode_info_t *info = NULL;
efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
bool conout_found = false;
void *dummy = NULL;
efi_handle_t h = (efi_handle_t)(unsigned long)handles[i];
u64 current_fb_base;
efi_physical_addr_t current_fb_base;

status = efi_call_early(handle_protocol, h,
proto, (void **)&gop64);
Expand Down
46 changes: 23 additions & 23 deletions include/linux/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1415,69 +1415,69 @@ struct efi_simple_text_output_protocol {
#define PIXEL_BLT_ONLY 3
#define PIXEL_FORMAT_MAX 4

struct efi_pixel_bitmask {
typedef struct {
u32 red_mask;
u32 green_mask;
u32 blue_mask;
u32 reserved_mask;
};
} efi_pixel_bitmask_t;

struct efi_graphics_output_mode_info {
typedef struct {
u32 version;
u32 horizontal_resolution;
u32 vertical_resolution;
int pixel_format;
struct efi_pixel_bitmask pixel_information;
efi_pixel_bitmask_t pixel_information;
u32 pixels_per_scan_line;
};
} efi_graphics_output_mode_info_t;

struct efi_graphics_output_protocol_mode_32 {
typedef struct {
u32 max_mode;
u32 mode;
u32 info;
u32 size_of_info;
u64 frame_buffer_base;
u32 frame_buffer_size;
};
} efi_graphics_output_protocol_mode_32_t;

struct efi_graphics_output_protocol_mode_64 {
typedef struct {
u32 max_mode;
u32 mode;
u64 info;
u64 size_of_info;
u64 frame_buffer_base;
u64 frame_buffer_size;
};
} efi_graphics_output_protocol_mode_64_t;

struct efi_graphics_output_protocol_mode {
typedef struct {
u32 max_mode;
u32 mode;
unsigned long info;
efi_graphics_output_mode_info_t *info;
unsigned long size_of_info;
u64 frame_buffer_base;
efi_physical_addr_t frame_buffer_base;
unsigned long frame_buffer_size;
};
} efi_graphics_output_protocol_mode_t;

struct efi_graphics_output_protocol_32 {
typedef struct {
u32 query_mode;
u32 set_mode;
u32 blt;
u32 mode;
};
} efi_graphics_output_protocol_32_t;

struct efi_graphics_output_protocol_64 {
typedef struct {
u64 query_mode;
u64 set_mode;
u64 blt;
u64 mode;
};
} efi_graphics_output_protocol_64_t;

struct efi_graphics_output_protocol {
unsigned long query_mode;
unsigned long set_mode;
unsigned long blt;
struct efi_graphics_output_protocol_mode *mode;
};
typedef struct {
void *query_mode;
void *set_mode;
void *blt;
efi_graphics_output_protocol_mode_t *mode;
} efi_graphics_output_protocol_t;

extern struct list_head efivar_sysfs_list;

Expand Down

0 comments on commit 44c84b4

Please sign in to comment.