blob: e05ef9f4d6e9be1d9a1a25dfd2736ff4410ce1f5 [file] [log] [blame]
Jordan Crousef6145c32008-03-19 23:56:58 +00001/*
2 * This file is part of the libpayload project.
3 *
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
Uwe Hermannfad8c2b2008-04-11 18:01:50 +000030#ifndef _SYSINFO_H
31#define _SYSINFO_H
Jordan Crousef6145c32008-03-19 23:56:58 +000032
Uwe Hermann6a441bf2008-03-20 19:54:59 +000033/* Allow a maximum of 16 memory range definitions. */
Jordan Crousef6145c32008-03-19 23:56:58 +000034#define SYSINFO_MAX_MEM_RANGES 16
Gabe Blackd3890cc2012-03-11 01:57:53 -080035/* Allow a maximum of 8 GPIOs */
36#define SYSINFO_MAX_GPIOS 8
37
38#include <coreboot_tables.h>
Jordan Crousef6145c32008-03-19 23:56:58 +000039
Gabe Black5ab20052012-08-28 16:38:34 -070040struct cb_serial;
41
Nico Huberd1cc8122013-02-08 12:39:28 +010042/*
43 * All pointers in here shall be virtual.
44 *
45 * If a relocation happens after the last call to lib_get_sysinfo(),
46 * it is up to the user to call lib_get_sysinfo() again.
47 */
Jordan Crousef6145c32008-03-19 23:56:58 +000048struct sysinfo_t {
49 unsigned int cpu_khz;
Gabe Black5ab20052012-08-28 16:38:34 -070050 struct cb_serial *serial;
Jordan Crousef6145c32008-03-19 23:56:58 +000051 unsigned short ser_ioport;
Stefan Reinauer4e677312011-04-16 00:13:17 +000052 unsigned long ser_base; // for mmapped serial
Jordan Crousef6145c32008-03-19 23:56:58 +000053
54 int n_memranges;
55
Stefan Reinauer34b9f862008-08-19 17:51:30 +000056 struct memrange {
Jordan Crousef6145c32008-03-19 23:56:58 +000057 unsigned long long base;
58 unsigned long long size;
Patrick Georgic9a6f0f2009-05-17 20:36:45 +000059 unsigned int type;
Jordan Crousef6145c32008-03-19 23:56:58 +000060 } memrange[SYSINFO_MAX_MEM_RANGES];
Stefan Reinauer95a6e1c2008-08-07 10:21:05 +000061
62 struct cb_cmos_option_table *option_table;
63 u32 cmos_range_start;
64 u32 cmos_range_end;
65 u32 cmos_checksum_location;
Nico Huberdd5979a2012-11-12 16:59:24 +010066#ifdef CONFIG_CHROMEOS
Gabe Blackd3890cc2012-03-11 01:57:53 -080067 u32 vbnv_start;
68 u32 vbnv_size;
69#endif
70
71 char *version;
72 char *extra_version;
73 char *build;
74 char *compile_time;
75 char *compile_by;
76 char *compile_host;
77 char *compile_domain;
78 char *compiler;
79 char *linker;
80 char *assembler;
Jordan Crouse6c6e4332008-11-11 19:51:14 +000081
Mathias Krause08052012011-10-20 14:06:26 +020082 char *cb_version;
83
Stefan Reinauerb7002542010-03-25 18:56:26 +000084 struct cb_framebuffer *framebuffer;
85
Nico Huberdd5979a2012-11-12 16:59:24 +010086#ifdef CONFIG_CHROMEOS
Gabe Blackd3890cc2012-03-11 01:57:53 -080087 int num_gpios;
88 struct cb_gpio gpios[SYSINFO_MAX_GPIOS];
89#endif
90
Jordan Crouse6c6e4332008-11-11 19:51:14 +000091 unsigned long *mbtable; /** Pointer to the multiboot table */
Philip Prindeville9a7c2462011-12-24 22:12:37 -070092
93 struct cb_header *header;
94 struct cb_mainboard *mainboard;
Gabe Blackd3890cc2012-03-11 01:57:53 -080095
Nico Huberdd5979a2012-11-12 16:59:24 +010096#ifdef CONFIG_CHROMEOS
Aaron Durbin5ca4f412013-03-07 23:22:24 -060097 void *vboot_handoff;
98 u32 vboot_handoff_size;
Gabe Blackd3890cc2012-03-11 01:57:53 -080099 void *vdat_addr;
100 u32 vdat_size;
101#endif
102 void *tstamp_table;
103 void *cbmem_cons;
104 void *mrc_cache;
Jordan Crousef6145c32008-03-19 23:56:58 +0000105};
106
107extern struct sysinfo_t lib_sysinfo;
Jordan Crousef6145c32008-03-19 23:56:58 +0000108
109#endif
110