mic: vop: Fix use-after-free on remove
[linux/fpc-iii.git] / drivers / firmware / google / coreboot_table.h
blob71a9de6b15fab4b908aaacbdb9e4869b862535cc
1 /*
2 * coreboot_table.h
4 * Internal header for coreboot table access.
6 * Copyright 2014 Gerd Hoffmann <kraxel@redhat.com>
7 * Copyright 2017 Google Inc.
8 * Copyright 2017 Samuel Holland <samuel@sholland.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License v2.0 as published by
12 * the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #ifndef __COREBOOT_TABLE_H
21 #define __COREBOOT_TABLE_H
23 #include <linux/io.h>
25 /* Coreboot table header structure */
26 struct coreboot_table_header {
27 char signature[4];
28 u32 header_bytes;
29 u32 header_checksum;
30 u32 table_bytes;
31 u32 table_checksum;
32 u32 table_entries;
35 /* List of coreboot entry structures that is used */
36 /* Generic */
37 struct coreboot_table_entry {
38 u32 tag;
39 u32 size;
42 /* Points to a CBMEM entry */
43 struct lb_cbmem_ref {
44 u32 tag;
45 u32 size;
47 u64 cbmem_addr;
50 /* Describes framebuffer setup by coreboot */
51 struct lb_framebuffer {
52 u32 tag;
53 u32 size;
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;
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;
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;
88 /* Register a driver that uses the data from a coreboot table. */
89 int coreboot_driver_register(struct coreboot_driver *driver);
91 /* Unregister a driver that uses the data from a coreboot table. */
92 void coreboot_driver_unregister(struct coreboot_driver *driver);
94 #endif /* __COREBOOT_TABLE_H */