+static int set_cmos_value(u32 bitnum, u32 len, void *valptr)
+{
+ u8 *value = (u8 *)valptr;
+ int offs = 0;
+ u32 addr, bit;
+ u8 reg8;
+
+ /* Convert to byte borders */
+ addr=(bitnum / 8);
+ bit=(bitnum % 8);
+
+ /* Handle single byte or less */
+ if (len <= 8) {
+ reg8 = nvram_read(addr);
+ reg8 &= ~(((1 << len) - 1) << bit);
+ reg8 |= (value[0] & ((1 << len) - 1)) << bit;
+ nvram_write(reg8, addr);
+ return 0;
+ }
+
+ /* When handling more than a byte, copy whole bytes */
+ while (len > 0) {
+ len -= 8;
+ nvram_write(value[offs++], addr++);
+ }
+
+ return 0;
+}
+
+static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *option_table, char *name)