2019-05-29 07:18:01 -07:00
/* SPDX-License-Identifier: GPL-2.0-only */
2017-03-28 18:11:27 +02:00
/*
* coreboot_table . h
*
* Internal header for coreboot table access .
*
2018-01-24 19:41:20 -06:00
* Copyright 2014 Gerd Hoffmann < kraxel @ redhat . com >
2017-03-28 18:11:27 +02:00
* Copyright 2017 Google Inc .
2018-01-24 19:41:16 -06:00
* Copyright 2017 Samuel Holland < samuel @ sholland . org >
2017-03-28 18:11:27 +02:00
*/
# ifndef __COREBOOT_TABLE_H
# define __COREBOOT_TABLE_H
2019-05-10 11:01:47 -07:00
# include <linux/device.h>
2017-03-28 18:11:27 +02:00
/* Coreboot table header structure */
struct coreboot_table_header {
char signature [ 4 ] ;
u32 header_bytes ;
u32 header_checksum ;
u32 table_bytes ;
u32 table_checksum ;
u32 table_entries ;
} ;
2018-01-24 19:41:16 -06:00
/* List of coreboot entry structures that is used */
/* Generic */
struct coreboot_table_entry {
u32 tag ;
u32 size ;
} ;
/* Points to a CBMEM entry */
struct lb_cbmem_ref {
u32 tag ;
u32 size ;
u64 cbmem_addr ;
} ;
2018-01-24 19:41:20 -06:00
/* Describes framebuffer setup by coreboot */
struct lb_framebuffer {
u32 tag ;
u32 size ;
u64 physical_address ;
u32 x_resolution ;
u32 y_resolution ;
u32 bytes_per_line ;
u8 bits_per_pixel ;
u8 red_mask_pos ;
u8 red_mask_size ;
u8 green_mask_pos ;
u8 green_mask_size ;
u8 blue_mask_pos ;
u8 blue_mask_size ;
u8 reserved_mask_pos ;
u8 reserved_mask_size ;
} ;
2018-01-24 19:41:16 -06:00
/* A device, additionally with information from coreboot. */
struct coreboot_device {
struct device dev ;
union {
struct coreboot_table_entry entry ;
struct lb_cbmem_ref cbmem_ref ;
2018-01-24 19:41:20 -06:00
struct lb_framebuffer framebuffer ;
2018-01-24 19:41:16 -06:00
} ;
} ;
/* A driver for handling devices described in coreboot tables. */
struct coreboot_driver {
int ( * probe ) ( struct coreboot_device * ) ;
2021-01-26 22:53:39 +01:00
void ( * remove ) ( struct coreboot_device * ) ;
2018-01-24 19:41:16 -06:00
struct device_driver drv ;
u32 tag ;
} ;
/* Register a driver that uses the data from a coreboot table. */
int coreboot_driver_register ( struct coreboot_driver * driver ) ;
/* Unregister a driver that uses the data from a coreboot table. */
void coreboot_driver_unregister ( struct coreboot_driver * driver ) ;
2019-05-10 11:01:47 -07:00
/* module_coreboot_driver() - Helper macro for drivers that don't do
* anything special in module init / exit . This eliminates a lot of
* boilerplate . Each module may only use this macro once , and
* calling it replaces module_init ( ) and module_exit ( )
*/
# define module_coreboot_driver(__coreboot_driver) \
module_driver ( __coreboot_driver , coreboot_driver_register , \
coreboot_driver_unregister )
2017-03-28 18:11:27 +02:00
# endif /* __COREBOOT_TABLE_H */