+static int
+tc_identify_option( addr, slot, complain)
+ tc_rommap_t *addr;
+ tc_option_t *slot;
+ int complain;
+{
+ register int i;
+ unsigned char width;
+ char firmwr[TC_ROM_LLEN+1], vendor[TC_ROM_LLEN+1],
+ module[TC_ROM_LLEN+1], host_type[TC_ROM_SLEN+1];
+
+ /*
+ * We do not really use the 'width' info, but take advantage
+ * of the restriction that the spec impose on the portion
+ * of the ROM that maps between +0x3e0 and +0x470, which
+ * is the only piece we need to look at.
+ */
+ width = addr->rom_width.value;
+ switch (width) {
+ case 1:
+ case 2:
+ case 4:
+ break;
+
+ default:
+#ifdef DEBUG
+ if (tc_verbose && complain)
+ printf("%s (x%x) at x%x\n", "Invalid ROM width",
+ width, addr);
+#endif
+ return (0);
+ }
+
+ if (addr->rom_stride.value != 4) {
+#ifdef DEBUG
+ if (tc_verbose && complain)
+ printf("%s (x%x) at x%x\n", "Invalid ROM stride",
+ addr->rom_stride.value, addr);
+#endif
+ return (0);
+ }
+
+ if ((addr->test_data[0] != 0x55) ||
+ (addr->test_data[4] != 0x00) ||
+ (addr->test_data[8] != 0xaa) ||
+ (addr->test_data[12] != 0xff)) {
+#ifdef DEBUG
+ if (tc_verbose && complain)
+ printf("%s x%x\n", "Test pattern failed, option at",
+ addr);
+#endif
+ return (0);
+ }
+
+ for (i = 0; i < TC_ROM_LLEN; i++) {
+ firmwr[i] = addr->firmware_rev[i].value;
+ vendor[i] = addr->vendor_name[i].value;
+ module[i] = addr->module_name[i].value;
+ if (i >= TC_ROM_SLEN)
+ continue;
+ host_type[i] = addr->host_firmware_type[i].value;
+ }
+ firmwr[TC_ROM_LLEN] = vendor[TC_ROM_LLEN] =
+ module[TC_ROM_LLEN] = host_type[TC_ROM_SLEN] = '\0';
+
+#ifdef DEBUG
+ if (tc_verbose)
+ printf("%s %s '%s' at x%x\n %s %s %s '%s'\n %s %d %s %d %s\n",
+ "Found a", vendor, module, addr,
+ "Firmware rev.", firmwr,
+ "diagnostics for a", host_type,
+ "ROM size is", addr->rom_size.value << 3,
+ "Kbytes, uses", addr->slot_size.value, "TC slot(s)");
+#endif
+
+ bcopy(module, slot->module_name, TC_ROM_LLEN);
+ bcopy(vendor, slot->module_id, TC_ROM_LLEN);
+ bcopy(firmwr, &slot->module_id[TC_ROM_LLEN], TC_ROM_LLEN);
+ slot->slot_size = addr->slot_size.value;
+ slot->rom_width = width;
+
+ return (1);
+}
+