at commit 19ed235c

1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * coreboot.h
4 *
5 * Coreboot device and driver interfaces.
6 *
7 * Copyright 2014 Gerd Hoffmann <kraxel@redhat.com>
8 * Copyright 2017 Google Inc.
9 * Copyright 2017 Samuel Holland <samuel@sholland.org>
10 */
11
12 #ifndef _LINUX_COREBOOT_H
13 #define _LINUX_COREBOOT_H
14
15 #include <linux/compiler_attributes.h>
16 #include <linux/stddef.h>
17 #include <linux/types.h>
18
19 typedef __aligned(4) u64 cb_u64;
20
21 /* List of coreboot entry structures that is used */
22
23 #define CB_TAG_FRAMEBUFFER 0x12
24 #define LB_TAG_CBMEM_ENTRY 0x31
25
26 /* Generic */
27 struct coreboot_table_entry {
28 u32 tag;
29 u32 size;
30 };
31
32 /* Points to a CBMEM entry */
33 struct lb_cbmem_ref {
34 u32 tag;
35 u32 size;
36
37 cb_u64 cbmem_addr;
38 };
39
40 /* Corresponds to LB_TAG_CBMEM_ENTRY */
41 struct lb_cbmem_entry {
42 u32 tag;
43 u32 size;
44
45 cb_u64 address;
46 u32 entry_size;
47 u32 id;
48 };
49
50 #define LB_FRAMEBUFFER_ORIENTATION_NORMAL 0
51 #define LB_FRAMEBUFFER_ORIENTATION_BOTTOM_UP 1
52 #define LB_FRAMEBUFFER_ORIENTATION_LEFT_UP 2
53 #define LB_FRAMEBUFFER_ORIENTATION_RIGHT_UP 3
54
55 /* Describes framebuffer setup by coreboot */
56 struct lb_framebuffer {
57 u32 tag;
58 u32 size;
59
60 cb_u64 physical_address;
61 u32 x_resolution;
62 u32 y_resolution;
63 u32 bytes_per_line;
64 u8 bits_per_pixel;
65 u8 red_mask_pos;
66 u8 red_mask_size;
67 u8 green_mask_pos;
68 u8 green_mask_size;
69 u8 blue_mask_pos;
70 u8 blue_mask_size;
71 u8 reserved_mask_pos;
72 u8 reserved_mask_size;
73 u8 orientation;
74 };
75
76 /*
77 * True if the coreboot-provided data is large enough to hold information
78 * on the linear framebuffer. False otherwise.
79 */
80 #define LB_FRAMEBUFFER_HAS_LFB(__fb) \
81 ((__fb)->size >= offsetofend(struct lb_framebuffer, reserved_mask_size))
82
83 /*
84 * True if the coreboot-provided data is large enough to hold information
85 * on the display orientation. False otherwise.
86 */
87 #define LB_FRAMEBUFFER_HAS_ORIENTATION(__fb) \
88 ((__fb)->size >= offsetofend(struct lb_framebuffer, orientation))
89
90 #endif /* _LINUX_COREBOOT_H */