GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / firmware / google / coreboot_table.h
1 /*
2  * coreboot_table.h
3  *
4  * Internal header for coreboot table access.
5  *
6  * Copyright 2017 Google Inc.
7  *
8  * 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
10  * the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  */
17
18 #ifndef __COREBOOT_TABLE_H
19 #define __COREBOOT_TABLE_H
20
21 #include <linux/io.h>
22
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 */
32 struct coreboot_table_header {
33         char signature[4];
34         u32 header_bytes;
35         u32 header_checksum;
36         u32 table_bytes;
37         u32 table_checksum;
38         u32 table_entries;
39 };
40
41 /* Retrieve coreboot table entry with tag *tag* and copy it to data */
42 int coreboot_table_find(int tag, void *data, size_t data_size);
43
44 /* Initialize coreboot table module given a pointer to iomem */
45 int coreboot_table_init(void __iomem *ptr);
46
47 /* Cleanup coreboot table module */
48 int coreboot_table_exit(void);
49
50 #endif /* __COREBOOT_TABLE_H */