Lines Matching +full:6 +full:e
36 u8 date[6]; /* 0x15 - 0x1a Build Date */
45 u8 mac[MAX_NUM_PORTS][6]; /* 0x42 - x MAC addresses */
47 } e; variable
53 #define is_valid ((e.id[0] == 'N') || (e.id[1] == 'X') || \
54 (e.id[2] == 'I') || (e.id[3] == 'D'))
82 printf("ID: %c%c%c%c v%u\n", e.id[0], e.id[1], e.id[2], e.id[3], in show_eeprom()
83 be32_to_cpu(e.version)); in show_eeprom()
86 printf("SN: %s\n", e.sn); in show_eeprom()
94 printf("Errata: %s\n", e.errata); in show_eeprom()
98 e.date[0], e.date[1], e.date[2], in show_eeprom()
99 e.date[3] & 0x7F, e.date[4], e.date[5], in show_eeprom()
100 e.date[3] & 0x80 ? "PM" : ""); in show_eeprom()
103 for (i = 0; i < min(e.mac_count, (u8)MAX_NUM_PORTS); i++) { in show_eeprom()
104 u8 *p = e.mac[i]; in show_eeprom()
110 crc = crc32(0, (void *)&e, sizeof(e) - 4); in show_eeprom()
112 if (crc == be32_to_cpu(e.crc)) in show_eeprom()
113 printf("CRC: %08x\n", be32_to_cpu(e.crc)); in show_eeprom()
116 be32_to_cpu(e.crc), crc); in show_eeprom()
119 printf("EEPROM dump: (0x%x bytes)\n", sizeof(e)); in show_eeprom()
120 for (i = 0; i < sizeof(e); i++) { in show_eeprom()
123 printf("%02X ", ((u8 *)&e)[i]); in show_eeprom()
124 if (((i % 16) == 15) || (i == sizeof(e) - 1)) in show_eeprom()
150 (void *)&e, sizeof(e)); in read_eeprom()
177 crc = crc32(0, (void *)&e, crc_offset); in update_crc()
178 e.crc = cpu_to_be32(crc); in update_crc()
197 e.res_0 = 0xFF; in prog_eeprom()
198 memset(e.res_1, 0xFF, sizeof(e.res_1)); in prog_eeprom()
209 for (i = 0, p = &e; i < sizeof(e); i += 8, p += 8) { in prog_eeprom()
211 p, min((int)(sizeof(e) - i), 8)); in prog_eeprom()
223 if (!ret && memcmp(&e, &e2, sizeof(e))) in prog_eeprom()
242 * This function takes a hexadecimal character (e.g. '7' or 'C') and returns
263 * (2-digit year, 2-digit month, etc), converts it to a 6-byte BCD string,
275 for (i = 0; i < 6; i++) in set_date()
276 e.date[i] = h2i(string[2 * i]) << 4 | h2i(string[2 * i + 1]); in set_date()
285 * (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and
298 for (i = 0; *p && (i < 6); i++) { in set_mac_address()
299 e.mac[index][i] = simple_strtoul(p, &p, 16); in set_mac_address()
324 memcpy(e.id, "NXID", sizeof(e.id)); in do_mac()
325 e.version = NXID_VERSION; in do_mac()
351 memset(e.sn, 0, sizeof(e.sn)); in do_mac()
352 strncpy((char *)e.sn, argv[2], sizeof(e.sn) - 1); in do_mac()
355 case 'e': /* errata */ in do_mac()
356 memset(e.errata, 0, 5); in do_mac()
357 strncpy((char *)e.errata, argv[2], 4); in do_mac()
364 e.mac_count = simple_strtoul(argv[2], NULL, 16); in do_mac()
383 unsigned char mac[6]; in mac_read_from_generic_eeprom()
389 ret = i2c_read(chip, address, 1, mac, 6); in mac_read_from_generic_eeprom()
451 e.id[0], e.id[1], e.id[2], e.id[3]); in mac_read_from_eeprom_common()
455 crc = crc32(0, (void *)&e, crc_offset); in mac_read_from_eeprom_common()
456 crcp = (void *)&e + crc_offset; in mac_read_from_eeprom_common()
459 be32_to_cpu(e.crc)); in mac_read_from_eeprom_common()
468 if (e.version == 0) in mac_read_from_eeprom_common()
469 memset(e.mac[8], 0xff, 6); in mac_read_from_eeprom_common()
471 for (i = 0; i < min(e.mac_count, (u8)MAX_NUM_PORTS); i++) { in mac_read_from_eeprom_common()
472 if (memcmp(&e.mac[i], "\0\0\0\0\0\0", 6) && in mac_read_from_eeprom_common()
473 memcmp(&e.mac[i], "\xFF\xFF\xFF\xFF\xFF\xFF", 6)) { in mac_read_from_eeprom_common()
478 e.mac[i][0], in mac_read_from_eeprom_common()
479 e.mac[i][1], in mac_read_from_eeprom_common()
480 e.mac[i][2], in mac_read_from_eeprom_common()
481 e.mac[i][3], in mac_read_from_eeprom_common()
482 e.mac[i][4], in mac_read_from_eeprom_common()
483 e.mac[i][5]); in mac_read_from_eeprom_common()
486 * (i.e. have not yet been set) in mac_read_from_eeprom_common()
493 printf("%c%c%c%c v%u\n", e.id[0], e.id[1], e.id[2], e.id[3], in mac_read_from_eeprom_common()
494 be32_to_cpu(e.version)); in mac_read_from_eeprom_common()