diff options
Diffstat (limited to 'drivers/firmware/google/coreboot_table.h')
-rw-r--r-- | drivers/firmware/google/coreboot_table.h | 72 |
1 files changed, 61 insertions, 11 deletions
diff --git a/drivers/firmware/google/coreboot_table.h b/drivers/firmware/google/coreboot_table.h index 6eff1ae0c5d3..8ad95a94481b 100644 --- a/drivers/firmware/google/coreboot_table.h +++ b/drivers/firmware/google/coreboot_table.h | |||
@@ -3,7 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Internal header for coreboot table access. | 4 | * Internal header for coreboot table access. |
5 | * | 5 | * |
6 | * Copyright 2014 Gerd Hoffmann <kraxel@redhat.com> | ||
6 | * Copyright 2017 Google Inc. | 7 | * Copyright 2017 Google Inc. |
8 | * Copyright 2017 Samuel Holland <samuel@sholland.org> | ||
7 | * | 9 | * |
8 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License v2.0 as published by | 11 | * it under the terms of the GNU General Public License v2.0 as published by |
@@ -20,14 +22,6 @@ | |||
20 | 22 | ||
21 | #include <linux/io.h> | 23 | #include <linux/io.h> |
22 | 24 | ||
23 | /* List of coreboot entry structures that is used */ | ||
24 | struct lb_cbmem_ref { | ||
25 | uint32_t tag; | ||
26 | uint32_t size; | ||
27 | |||
28 | uint64_t cbmem_addr; | ||
29 | }; | ||
30 | |||
31 | /* Coreboot table header structure */ | 25 | /* Coreboot table header structure */ |
32 | struct coreboot_table_header { | 26 | struct coreboot_table_header { |
33 | char signature[4]; | 27 | char signature[4]; |
@@ -38,11 +32,67 @@ struct coreboot_table_header { | |||
38 | u32 table_entries; | 32 | u32 table_entries; |
39 | }; | 33 | }; |
40 | 34 | ||
41 | /* Retrieve coreboot table entry with tag *tag* and copy it to data */ | 35 | /* List of coreboot entry structures that is used */ |
42 | int coreboot_table_find(int tag, void *data, size_t data_size); | 36 | /* Generic */ |
37 | struct coreboot_table_entry { | ||
38 | u32 tag; | ||
39 | u32 size; | ||
40 | }; | ||
41 | |||
42 | /* Points to a CBMEM entry */ | ||
43 | struct lb_cbmem_ref { | ||
44 | u32 tag; | ||
45 | u32 size; | ||
46 | |||
47 | u64 cbmem_addr; | ||
48 | }; | ||
49 | |||
50 | /* Describes framebuffer setup by coreboot */ | ||
51 | struct lb_framebuffer { | ||
52 | u32 tag; | ||
53 | u32 size; | ||
54 | |||
55 | u64 physical_address; | ||
56 | u32 x_resolution; | ||
57 | u32 y_resolution; | ||
58 | u32 bytes_per_line; | ||
59 | u8 bits_per_pixel; | ||
60 | u8 red_mask_pos; | ||
61 | u8 red_mask_size; | ||
62 | u8 green_mask_pos; | ||
63 | u8 green_mask_size; | ||
64 | u8 blue_mask_pos; | ||
65 | u8 blue_mask_size; | ||
66 | u8 reserved_mask_pos; | ||
67 | u8 reserved_mask_size; | ||
68 | }; | ||
69 | |||
70 | /* A device, additionally with information from coreboot. */ | ||
71 | struct coreboot_device { | ||
72 | struct device dev; | ||
73 | union { | ||
74 | struct coreboot_table_entry entry; | ||
75 | struct lb_cbmem_ref cbmem_ref; | ||
76 | struct lb_framebuffer framebuffer; | ||
77 | }; | ||
78 | }; | ||
79 | |||
80 | /* A driver for handling devices described in coreboot tables. */ | ||
81 | struct coreboot_driver { | ||
82 | int (*probe)(struct coreboot_device *); | ||
83 | int (*remove)(struct coreboot_device *); | ||
84 | struct device_driver drv; | ||
85 | u32 tag; | ||
86 | }; | ||
87 | |||
88 | /* Register a driver that uses the data from a coreboot table. */ | ||
89 | int coreboot_driver_register(struct coreboot_driver *driver); | ||
90 | |||
91 | /* Unregister a driver that uses the data from a coreboot table. */ | ||
92 | void coreboot_driver_unregister(struct coreboot_driver *driver); | ||
43 | 93 | ||
44 | /* Initialize coreboot table module given a pointer to iomem */ | 94 | /* Initialize coreboot table module given a pointer to iomem */ |
45 | int coreboot_table_init(void __iomem *ptr); | 95 | int coreboot_table_init(struct device *dev, void __iomem *ptr); |
46 | 96 | ||
47 | /* Cleanup coreboot table module */ | 97 | /* Cleanup coreboot table module */ |
48 | int coreboot_table_exit(void); | 98 | int coreboot_table_exit(void); |