1 /*****************************************************************************\
3 *****************************************************************************
4 * Copyright (C) 2002-2005 The Regents of the University of California.
5 * Produced at the Lawrence Livermore National Laboratory.
6 * Written by Dave Peterson <dsp@llnl.gov> <dave_peterson@pobox.com>.
10 * This file is part of nvramtool, a utility for reading/writing coreboot
11 * parameters and displaying information from the coreboot table.
12 * For details, see https://coreboot.org/nvramtool.
14 * Please also read the file DISCLAIMER which is included in this software
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License (as published by the
19 * Free Software Foundation) version 2, dated June 1991.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
24 * conditions of the GNU General Public License for more details.
25 \*****************************************************************************/
31 #include "coreboot_tables.h"
33 #define LAYOUT_ENTRY_OVERLAP (LAYOUT_RESULT_START + 0)
34 #define LAYOUT_ENTRY_BAD_LENGTH (LAYOUT_RESULT_START + 1)
35 #define LAYOUT_DUPLICATE_ENUM (LAYOUT_RESULT_START + 2)
36 #define LAYOUT_SUMMED_AREA_START_NOT_ALIGNED (LAYOUT_RESULT_START + 3)
37 #define LAYOUT_SUMMED_AREA_END_NOT_ALIGNED (LAYOUT_RESULT_START + 4)
38 #define LAYOUT_CHECKSUM_LOCATION_NOT_ALIGNED (LAYOUT_RESULT_START + 5)
39 #define LAYOUT_INVALID_SUMMED_AREA (LAYOUT_RESULT_START + 6)
40 #define LAYOUT_CHECKSUM_OVERLAPS_SUMMED_AREA (LAYOUT_RESULT_START + 7)
41 #define LAYOUT_SUMMED_AREA_OUT_OF_RANGE (LAYOUT_RESULT_START + 8)
42 #define LAYOUT_CHECKSUM_LOCATION_OUT_OF_RANGE (LAYOUT_RESULT_START + 9)
43 #define LAYOUT_MULTIBYTE_ENTRY_NOT_ALIGNED (LAYOUT_RESULT_START + 10)
46 CMOS_ENTRY_ENUM
= 'e',
48 CMOS_ENTRY_STRING
= 's',
49 CMOS_ENTRY_RESERVED
= 'r',
50 } cmos_entry_config_t
;
52 /* This represents a CMOS parameter. */
56 cmos_entry_config_t config
;
58 char name
[CMOS_MAX_NAME_LENGTH
+ 1];
61 /* This represents a possible value for a CMOS parameter of type
66 unsigned long long value
;
67 char text
[CMOS_MAX_TEXT_LENGTH
+ 1];
70 /* This represents the location of the CMOS checksum and the area over
71 * which it is computed. Depending on the context, the values may be
72 * represented as either bit positions or byte positions.
75 unsigned summed_area_start
; /* first checksummed location */
76 unsigned summed_area_end
; /* last checksummed location */
77 unsigned checksum_at
; /* location of checksum */
78 } cmos_checksum_layout_t
;
80 extern const char checksum_param_name
[];
82 extern unsigned cmos_checksum_start
;
84 extern unsigned cmos_checksum_end
;
86 extern unsigned cmos_checksum_index
;
88 typedef void (*cmos_layout_get_fn_t
) (void);
90 void register_cmos_layout_get_fn(cmos_layout_get_fn_t fn
);
91 void get_cmos_layout(void);
92 int add_cmos_entry(const cmos_entry_t
* e
, const cmos_entry_t
** conflict
);
93 const cmos_entry_t
*find_cmos_entry(const char name
[]);
94 const cmos_entry_t
*first_cmos_entry(void);
95 const cmos_entry_t
*next_cmos_entry(const cmos_entry_t
* last
);
96 int add_cmos_enum(const cmos_enum_t
* e
);
97 const cmos_enum_t
*find_cmos_enum(unsigned config_id
, unsigned long long value
);
98 const cmos_enum_t
*first_cmos_enum(void);
99 const cmos_enum_t
*next_cmos_enum(const cmos_enum_t
* last
);
100 const cmos_enum_t
*first_cmos_enum_id(unsigned config_id
);
101 const cmos_enum_t
*next_cmos_enum_id(const cmos_enum_t
* last
);
102 int is_checksum_name(const char name
[]);
103 int checksum_layout_to_bytes(cmos_checksum_layout_t
* layout
);
104 void checksum_layout_to_bits(cmos_checksum_layout_t
* layout
);
106 #endif /* LAYOUT_H */