blob: 4575f7599590644fb580bb6a7be980398a0208cc [file] [log] [blame]
Stefan Reinauer6540ae52007-07-12 16:35:42 +00001/*****************************************************************************\
2 * layout.h
3 * $Id: layout.h,v 1.2 2006/01/24 00:25:40 dsp_llnl Exp $
4 *****************************************************************************
5 * Copyright (C) 2002-2005 The Regents of the University of California.
6 * Produced at the Lawrence Livermore National Laboratory.
7 * Written by Dave Peterson <dsp@llnl.gov> <dave_peterson@pobox.com>.
8 * UCRL-CODE-2003-012
9 * All rights reserved.
10 *
Stefan Reinauerf527e702008-01-18 15:33:49 +000011 * This file is part of lxbios, a utility for reading/writing coreboot
12 * parameters and displaying information from the coreboot table.
Stefan Reinauer6540ae52007-07-12 16:35:42 +000013 * For details, see <http://www.llnl.gov/linux/lxbios/>.
14 *
15 * Please also read the file DISCLAIMER which is included in this software
16 * distribution.
17 *
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License (as published by the
20 * Free Software Foundation) version 2, dated June 1991.
21 *
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
25 * conditions of the GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
30\*****************************************************************************/
31
32#ifndef LXBIOS_LAYOUT_H
33#define LXBIOS_LAYOUT_H
34
35#include "common.h"
Stefan Reinauer7223ab72008-01-18 16:17:44 +000036#include "coreboot_tables.h"
Stefan Reinauer6540ae52007-07-12 16:35:42 +000037
38#define LAYOUT_ENTRY_OVERLAP (LAYOUT_RESULT_START + 0)
39#define LAYOUT_ENTRY_BAD_LENGTH (LAYOUT_RESULT_START + 1)
40#define LAYOUT_DUPLICATE_ENUM (LAYOUT_RESULT_START + 2)
41#define LAYOUT_SUMMED_AREA_START_NOT_ALIGNED (LAYOUT_RESULT_START + 3)
42#define LAYOUT_SUMMED_AREA_END_NOT_ALIGNED (LAYOUT_RESULT_START + 4)
43#define LAYOUT_CHECKSUM_LOCATION_NOT_ALIGNED (LAYOUT_RESULT_START + 5)
44#define LAYOUT_INVALID_SUMMED_AREA (LAYOUT_RESULT_START + 6)
45#define LAYOUT_CHECKSUM_OVERLAPS_SUMMED_AREA (LAYOUT_RESULT_START + 7)
46#define LAYOUT_SUMMED_AREA_OUT_OF_RANGE (LAYOUT_RESULT_START + 8)
47#define LAYOUT_CHECKSUM_LOCATION_OUT_OF_RANGE (LAYOUT_RESULT_START + 9)
48
49typedef enum
50 { CMOS_ENTRY_ENUM,
51 CMOS_ENTRY_HEX,
52 CMOS_ENTRY_RESERVED
53 }
54cmos_entry_config_t;
55
56/* This represents a CMOS parameter. */
57typedef struct
58 { unsigned bit;
59 unsigned length;
60 cmos_entry_config_t config;
61 unsigned config_id;
62 char name[CMOS_MAX_NAME_LENGTH];
63 }
64cmos_entry_t;
65
66/* This represents a possible value for a CMOS parameter of type
67 * CMOS_ENTRY_ENUM.
68 */
69typedef struct
70 { unsigned config_id;
71 unsigned long long value;
72 char text[CMOS_MAX_TEXT_LENGTH];
73 }
74cmos_enum_t;
75
76/* This represents the location of the CMOS checksum and the area over which
77 * it is computed. Depending on the context, the values may be represented as
78 * either bit positions or byte positions.
79 */
80typedef struct
81 { unsigned summed_area_start; /* first checksummed location */
82 unsigned summed_area_end; /* last checksummed location */
83 unsigned checksum_at; /* location of checksum */
84 }
85cmos_checksum_layout_t;
86
87extern const char checksum_param_name[];
88
89extern unsigned cmos_checksum_start;
90
91extern unsigned cmos_checksum_end;
92
93extern unsigned cmos_checksum_index;
94
95typedef void (*cmos_layout_get_fn_t) (void);
96
97void register_cmos_layout_get_fn (cmos_layout_get_fn_t fn);
98void get_cmos_layout (void);
99int add_cmos_entry (const cmos_entry_t *e, const cmos_entry_t **conflict);
100const cmos_entry_t * find_cmos_entry (const char name[]);
101const cmos_entry_t * first_cmos_entry (void);
102const cmos_entry_t * next_cmos_entry (const cmos_entry_t *last);
103int add_cmos_enum (const cmos_enum_t *e);
104const cmos_enum_t * find_cmos_enum (unsigned config_id,
105 unsigned long long value);
106const cmos_enum_t * first_cmos_enum (void);
107const cmos_enum_t * next_cmos_enum (const cmos_enum_t *last);
108const cmos_enum_t * first_cmos_enum_id (unsigned config_id);
109const cmos_enum_t * next_cmos_enum_id (const cmos_enum_t *last);
110int is_checksum_name (const char name[]);
111int checksum_layout_to_bytes (cmos_checksum_layout_t *layout);
112void checksum_layout_to_bits (cmos_checksum_layout_t *layout);
113
114#endif /* LXBIOS_LAYOUT_H */