util/nvramtool: Remove "this file is part of" lines
[coreboot.git] / util / nvramtool / cmos_lowlevel.h
blob9a7f670c13f157db8a43c12822ab0129c22eeb10
1 /*****************************************************************************\
2 * cmos_lowlevel.h
3 *****************************************************************************
4 * Please also read the file DISCLAIMER which is included in this software
5 * distribution.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License (as published by the
9 * Free Software Foundation) version 2, dated June 1991.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
14 * conditions of the GNU General Public License for more details.
15 \*****************************************************************************/
17 #ifndef NVRAMTOOL_CMOS_LOWLEVEL_H
18 #define NVRAMTOOL_CMOS_LOWLEVEL_H
20 #include "common.h"
21 #include "layout.h"
23 typedef struct {
24 void (*init)(void* data);
25 unsigned char (*read)(unsigned addr);
26 void (*write)(unsigned addr, unsigned char value);
27 void (*set_iopl)(int level);
28 } cmos_access_t;
30 typedef enum { HAL_CMOS, HAL_MEMORY } hal_t;
31 void select_hal(hal_t hal, void *data);
33 #define CMOS_AREA_OUT_OF_RANGE (CMOS_RESULT_START + 0)
34 #define CMOS_AREA_OVERLAPS_RTC (CMOS_RESULT_START + 1)
35 #define CMOS_AREA_TOO_WIDE (CMOS_RESULT_START + 2)
37 unsigned long long cmos_read(const cmos_entry_t * e);
38 void cmos_write(const cmos_entry_t * e, unsigned long long value);
39 unsigned char cmos_read_byte(unsigned index);
40 void cmos_write_byte(unsigned index, unsigned char value);
41 void cmos_read_all(unsigned char data[]);
42 void cmos_write_all(unsigned char data[]);
43 void set_iopl(int level);
44 int verify_cmos_op(unsigned bit, unsigned length, cmos_entry_config_t config);
46 #define CMOS_SIZE 256 /* size of CMOS memory in bytes */
47 #define CMOS_RTC_AREA_SIZE 14 /* first 14 bytes control real time clock */
49 /****************************************************************************
50 * verify_cmos_byte_index
52 * Return 1 if 'index' does NOT specify a valid CMOS memory location. Else
53 * return 0.
54 ****************************************************************************/
55 static inline int verify_cmos_byte_index(unsigned index)
57 return (index < CMOS_RTC_AREA_SIZE) || (index >= CMOS_SIZE);
60 #endif /* NVRAMTOOL_CMOS_LOWLEVEL_H */