tests: Adjust sleeps for migration test
[qemu/ar7.git] / include / hw / nvram / sun_nvram.h
blob68eaa6030895949222d7282e04342252e5a2141c
1 #ifndef SUN_NVRAM_H
2 #define SUN_NVRAM_H
4 /* Sun IDPROM structure at the end of NVRAM */
5 /* from http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html */
6 struct Sun_nvram {
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 */
15 static inline void
16 Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, int machine_id)
18 uint8_t tmp, *tmpptr;
19 unsigned int i;
21 header->type = 1;
22 header->machine_id = machine_id & 0xff;
23 memcpy(&header->macaddr, macaddr, 6);
24 memcpy(&header->hostid , &macaddr[3], 3);
26 /* Calculate checksum */
27 tmp = 0;
28 tmpptr = (uint8_t *)header;
29 for (i = 0; i < 15; i++)
30 tmp ^= tmpptr[i];
32 header->checksum = tmp;
34 #endif /* SUN_NVRAM_H */