4 /* OpenBIOS NVRAM partition */
5 struct OpenBIOS_nvpart_v1
{
8 uint16_t len
; // BE, length divided by 16
12 #define OPENBIOS_PART_SYSTEM 0x70
13 #define OPENBIOS_PART_FREE 0x7f
16 OpenBIOS_finish_partition(struct OpenBIOS_nvpart_v1
*header
, uint32_t size
)
21 // Length divided by 16
22 header
->len
= cpu_to_be16(size
>> 4);
25 tmpptr
= (uint8_t *)header
;
27 for (i
= 0; i
< 14; i
++) {
29 sum
= (sum
+ ((sum
& 0xff00) >> 8)) & 0xff;
31 header
->checksum
= sum
& 0xff;
34 static inline uint32_t
35 OpenBIOS_set_var(uint8_t *nvram
, uint32_t addr
, const char *str
)
39 len
= strlen(str
) + 1;
40 memcpy(&nvram
[addr
], str
, len
);
45 /* Sun IDPROM structure at the end of NVRAM */
55 Sun_init_header(struct Sun_nvram
*header
, const uint8_t *macaddr
, int machine_id
)
61 header
->machine_id
= machine_id
& 0xff;
62 memcpy(&header
->macaddr
, macaddr
, 6);
63 /* Calculate checksum */
65 tmpptr
= (uint8_t *)header
;
66 for (i
= 0; i
< 15; i
++)
69 header
->checksum
= tmp
;
71 #endif /* FIRMWARE_ABI_H */