4 /* Sun IDPROM structure at the end of NVRAM */
5 /* from http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html */
7 uint8_t type
; /* always 01 */
8 uint8_t machine_id
; /* first byte of host id (machine type) */
9 uint8_t macaddr
[6]; /* 6 byte ethernet address (first 3 bytes 08, 00, 20) */
10 uint8_t date
[4]; /* date of manufacture */
11 uint8_t hostid
[3]; /* remaining 3 bytes of host id (serial number) */
12 uint8_t checksum
; /* bitwise xor of previous bytes */
16 Sun_init_header(struct Sun_nvram
*header
, const uint8_t *macaddr
, int machine_id
)
22 header
->machine_id
= machine_id
& 0xff;
23 memcpy(&header
->macaddr
, macaddr
, 6);
24 memcpy(&header
->hostid
, &macaddr
[3], 3);
26 /* Calculate checksum */
28 tmpptr
= (uint8_t *)header
;
29 for (i
= 0; i
< 15; i
++)
32 header
->checksum
= tmp
;
34 #endif /* SUN_NVRAM_H */