MCPcopy Create free account
hub / github.com/coreboot/coreboot / get_cmos_value

Function get_cmos_value

payloads/libpayload/drivers/options.c:100–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static int get_cmos_value(const struct nvram_accessor *nvram, u32 bitnum, u32 len, void *valptr)
101{
102 u8 *value = valptr;
103 int offs = 0;
104 u32 addr, bit;
105 u8 reg8;
106
107 /* Convert to byte borders */
108 addr=(bitnum / 8);
109 bit=(bitnum % 8);
110
111 /* Handle single byte or less */
112 if(len <= 8) {
113 reg8 = nvram->read(addr);
114 reg8 >>= bit;
115 value[0] = reg8 & ((1 << len) -1);
116 return 0;
117 }
118
119 /* When handling more than a byte, copy whole bytes */
120 while (len > 0) {
121 len -= 8;
122 value[offs++]=nvram->read(addr++);
123 }
124
125 return 0;
126}
127
128static int set_cmos_value(const struct nvram_accessor *nvram, u32 bitnum, u32 len, const void *valptr)
129{

Callers 1

get_option_withFunction · 0.70

Calls 1

readMethod · 0.80

Tested by

no test coverage detected