| 60 | } |
| 61 | |
| 62 | int options_checksum_valid(const struct nvram_accessor *nvram) |
| 63 | { |
| 64 | int i; |
| 65 | int range_start = lib_sysinfo.cmos_range_start / 8; |
| 66 | int range_end = lib_sysinfo.cmos_range_end / 8; |
| 67 | int checksum_location = lib_sysinfo.cmos_checksum_location / 8; |
| 68 | u16 checksum = 0, checksum_old; |
| 69 | |
| 70 | for(i = range_start; i <= range_end; i++) { |
| 71 | checksum += nvram->read(i); |
| 72 | } |
| 73 | |
| 74 | checksum_old = ((nvram->read(checksum_location)<<8) | nvram->read(checksum_location+1)); |
| 75 | |
| 76 | return (checksum_old == checksum); |
| 77 | } |
| 78 | |
| 79 | void fix_options_checksum_with(const struct nvram_accessor *nvram) |
| 80 | { |