📄 dump_cis.c
字号:
{ int i; printf("%scftable_entry_cb 0x%2.2x%s\n", indent, entry->index, (entry->flags & CISTPL_CFTABLE_DEFAULT) ? " [default]" : ""); if (entry->flags & ~CISTPL_CFTABLE_DEFAULT) { printf("%s ", indent); if (entry->flags & CISTPL_CFTABLE_MASTER) printf(" [master]"); if (entry->flags & CISTPL_CFTABLE_INVALIDATE) printf(" [invalidate]"); if (entry->flags & CISTPL_CFTABLE_VGA_PALETTE) printf(" [vga palette]"); if (entry->flags & CISTPL_CFTABLE_PARITY) printf(" [parity]"); if (entry->flags & CISTPL_CFTABLE_WAIT) printf(" [wait]"); if (entry->flags & CISTPL_CFTABLE_SERR) printf(" [serr]"); if (entry->flags & CISTPL_CFTABLE_FAST_BACK) printf(" [fast back]"); if (entry->flags & CISTPL_CFTABLE_BINARY_AUDIO) printf(" [binary audio]"); if (entry->flags & CISTPL_CFTABLE_PWM_AUDIO) printf(" [pwm audio]"); putchar('\n'); } if (entry->vcc.present) print_power("Vcc", &entry->vcc); if (entry->vpp1.present) print_power("Vpp1", &entry->vpp1); if (entry->vpp2.present) print_power("Vpp2", &entry->vpp2); if (entry->io) { printf("%s io_base", indent); for (i = 0; i < 8; i++) if (entry->io & (1<<i)) printf(" %d", i); putchar('\n'); } if (entry->irq.IRQInfo1) { printf("%s irq ", indent); if (entry->irq.IRQInfo1 & IRQ_INFO2_VALID) printf("mask 0x%4.4x", entry->irq.IRQInfo2); else printf("%u", entry->irq.IRQInfo1 & IRQ_MASK); if (entry->irq.IRQInfo1 & IRQ_LEVEL_ID) printf(" [level]"); if (entry->irq.IRQInfo1 & IRQ_PULSE_ID) printf(" [pulse]"); if (entry->irq.IRQInfo1 & IRQ_SHARE_ID) printf(" [shared]"); putchar('\n'); } if (entry->mem) { printf("%s mem_base", indent); for (i = 0; i < 8; i++) if (entry->mem & (1<<i)) printf(" %d", i); putchar('\n'); } if (verbose && entry->subtuples) printf("%s %d bytes in subtuples\n", indent, entry->subtuples); }/*====================================================================*/static void print_jedec(cistpl_jedec_t *j){ int i; for (i = 0; i < j->nid; i++) { if (i != 0) putchar(','); printf(" 0x%02x 0x%02x", j->id[i].mfr, j->id[i].info); } putchar('\n');}/*====================================================================*/static void print_device_geo(cistpl_device_geo_t *geo){ int i; for (i = 0; i < geo->ngeo; i++) { printf("%s width %d erase 0x%x read 0x%x write 0x%x " "partition 0x%x interleave 0x%x\n", indent, geo->geo[i].buswidth, geo->geo[i].erase_block, geo->geo[i].read_block, geo->geo[i].write_block, geo->geo[i].partition, geo->geo[i].interleave); }}/*====================================================================*/static void print_org(cistpl_org_t *org){ printf("%sdata_org ", indent); switch (org->data_org) { case CISTPL_ORG_FS: printf("[filesystem]"); break; case CISTPL_ORG_APPSPEC: printf("[app_specific]"); break; case CISTPL_ORG_XIP: printf("[code]"); break; default: if (org->data_org < 0x80) printf("[reserved]"); else printf("[vendor_specific]"); } printf(", \"%s\"\n", org->desc);}/*====================================================================*/static char *data_mod[] = { "Bell103", "V.21", "V.23", "V.22", "Bell212A", "V.22bis", "V.26", "V.26bis", "V.27bis", "V.29", "V.32", "V.32bis", "V.34", "rfu", "rfu", "rfu"};static char *fax_mod[] = { "V.21-C2", "V.27ter", "V.29", "V.17", "V.33", "rfu", "rfu", "rfu"};static char *fax_features[] = { "T.3", "T.4", "T.6", "error", "voice", "poll", "file", "passwd"};static char *cmd_protocol[] = { "AT1", "AT2", "AT3", "MNP_AT", "V.25bis", "V.25A", "DMCL"};static char *uart[] = { "8250", "16450", "16550", "8251", "8530", "85230"};static char *parity[] = { "space", "mark", "odd", "even" };static char *stop[] = { "1", "1.5", "2" };static char *flow[] = { "XON/XOFF xmit", "XON/XOFF rcv", "hw xmit", "hw rcv", "transparent"};static void print_serial(cistpl_funce_t *funce){ cistpl_serial_t *s; cistpl_data_serv_t *ds; cistpl_fax_serv_t *fs; cistpl_modem_cap_t *cp; int i, j; switch (funce->type & 0x0f) { case CISTPL_FUNCE_SERIAL_IF: case CISTPL_FUNCE_SERIAL_IF_DATA: case CISTPL_FUNCE_SERIAL_IF_FAX: case CISTPL_FUNCE_SERIAL_IF_VOICE: s = (cistpl_serial_t *)(funce->data); printf("%sserial_interface", indent); if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_DATA) printf("_data"); else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_FAX) printf("_fax"); else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_IF_VOICE) printf("_voice"); printf("\n%s uart %s", indent, (s->uart_type < 6) ? uart[s->uart_type] : "reserved"); if (s->uart_cap_0) { printf(" ["); for (i = 0; i < 4; i++) if (s->uart_cap_0 & (1<<i)) printf("%s%s", parity[i], (s->uart_cap_0 >= (2<<i)) ? "/" : "]"); } if (s->uart_cap_1) { int m = s->uart_cap_1 & 0x0f; int n = s->uart_cap_1 >> 4; printf(" ["); for (i = 0; i < 4; i++) if (m & (1<<i)) printf("%d%s", i+5, (m >= (2<<i)) ? "/" : ""); printf("] ["); for (i = 0; i < 3; i++) if (n & (1<<i)) printf("%s%s", stop[i], (n >= (2<<i)) ? "/" : "]"); } printf("\n"); break; case CISTPL_FUNCE_SERIAL_CAP: case CISTPL_FUNCE_SERIAL_CAP_DATA: case CISTPL_FUNCE_SERIAL_CAP_FAX: case CISTPL_FUNCE_SERIAL_CAP_VOICE: cp = (cistpl_modem_cap_t *)(funce->data); printf("%sserial_modem_cap", indent); if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_DATA) printf("_data"); else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_FAX) printf("_fax"); else if ((funce->type & 0x0f) == CISTPL_FUNCE_SERIAL_CAP_VOICE) printf("_voice"); if (cp->flow) { printf("\n%s flow", indent); for (i = 0; i < 5; i++) if (cp->flow & (1<<i)) printf(" [%s]", flow[i]); } printf("\n%s cmd_buf %d rcv_buf %d xmit_buf %d\n", indent, 4*(cp->cmd_buf+1), cp->rcv_buf_0+(cp->rcv_buf_1<<8)+(cp->rcv_buf_2<<16), cp->xmit_buf_0+(cp->xmit_buf_1<<8)+(cp->xmit_buf_2<<16)); break; case CISTPL_FUNCE_SERIAL_SERV_DATA: ds = (cistpl_data_serv_t *)(funce->data); printf("%sserial_data_services\n", indent); printf("%s data_rate %d\n", indent, 75*((ds->max_data_0<<8) + ds->max_data_1)); printf("%s modulation", indent); for (i = j = 0; i < 16; i++) if (((ds->modulation_1<<8) + ds->modulation_0) & (1<<i)) { if (++j % 6 == 0) printf("\n%s ", indent); printf(" [%s]", data_mod[i]); } printf("\n"); if (ds->error_control) { printf("%s error_control", indent); if (ds->error_control & CISTPL_SERIAL_ERR_MNP2_4) printf(" [MNP2-4]"); if (ds->error_control & CISTPL_SERIAL_ERR_V42_LAPM) printf(" [V.42/LAPM]"); printf("\n"); } if (ds->compression) { printf("%s compression", indent); if (ds->compression & CISTPL_SERIAL_CMPR_V42BIS) printf(" [V.42bis]"); if (ds->compression & CISTPL_SERIAL_CMPR_MNP5) printf(" [MNP5]"); printf("\n"); } if (ds->cmd_protocol) { printf("%s cmd_protocol", indent); for (i = 0; i < 7; i++) if (ds->cmd_protocol & (1<<i)) printf(" [%s]", cmd_protocol[i]); printf("\n"); } break; case CISTPL_FUNCE_SERIAL_SERV_FAX: fs = (cistpl_fax_serv_t *)(funce->data); printf("%sserial_fax_services [class=%d]\n", indent, funce->type>>4); printf("%s data_rate %d\n", indent, 75*((fs->max_data_0<<8) + fs->max_data_1)); printf("%s modulation", indent); for (i = 0; i < 8; i++) if (fs->modulation & (1<<i)) printf(" [%s]", fax_mod[i]); printf("\n"); if (fs->features_0) { printf("%s features", indent); for (i = 0; i < 8; i++) if (fs->features_0 & (1<<i)) printf(" [%s]", fax_features[i]); printf("\n"); } break; }}/*====================================================================*/static void print_fixed(cistpl_funce_t *funce){ cistpl_ide_interface_t *i; cistpl_ide_feature_t *f; switch (funce->type) { case CISTPL_FUNCE_IDE_IFACE: i = (cistpl_ide_interface_t *)(funce->data); printf("%sdisk_interface ", indent); if (i->interface == CISTPL_IDE_INTERFACE) printf("[ide]\n"); else printf("[undefined]\n"); break; case CISTPL_FUNCE_IDE_MASTER: case CISTPL_FUNCE_IDE_SLAVE: f = (cistpl_ide_feature_t *)(funce->data); printf("%sdisk_features", indent); if (f->feature1 & CISTPL_IDE_SILICON) printf(" [silicon]"); else printf(" [rotating]"); if (f->feature1 & CISTPL_IDE_UNIQUE) printf(" [unique]"); if (f->feature1 & CISTPL_IDE_DUAL) printf(" [dual]"); else printf(" [single]"); if (f->feature1 && f->feature2) printf("\n%s ", indent); if (f->feature2 & CISTPL_IDE_HAS_SLEEP) printf(" [sleep]"); if (f->feature2 & CISTPL_IDE_HAS_STANDBY) printf(" [standby]"); if (f->feature2 & CISTPL_IDE_HAS_IDLE) printf(" [idle]"); if (f->feature2 & CISTPL_IDE_LOW_POWER) printf(" [low power]"); if (f->feature2 & CISTPL_IDE_REG_INHIBIT) printf(" [reg inhibit]"); if (f->feature2 & CISTPL_IDE_HAS_INDEX) printf(" [index]"); if (f->feature2 & CISTPL_IDE_IOIS16) printf(" [iois16]"); putchar('\n'); break; }}/*====================================================================*/static const char *tech[] = { "undefined", "ARCnet", "ethernet", "token_ring", "localtalk", "FDDI/CDDI", "ATM", "wireless"};static const char *media[] = { "undefined", "unshielded_twisted_pair", "shielded_twisted_pair", "thin_coax", "thick_coax", "fiber", "900_MHz", "2.4_GHz", "5.4_GHz", "diffuse_infrared", "point_to_point_infrared"};static void print_network(cistpl_funce_t *funce){ cistpl_lan_tech_t *t; cistpl_lan_speed_t *s; cistpl_lan_media_t *m; cistpl_lan_node_id_t *n; cistpl_lan_connector_t *c; int i; switch (funce->type) { case CISTPL_FUNCE_LAN_TECH: t = (cistpl_lan_tech_t *)(funce->data); printf("%slan_technology %s\n", indent, tech[t->tech]); break; case CISTPL_FUNCE_LAN_SPEED: s = (cistpl_lan_speed_t *)(funce->data); printf("%slan_speed ", indent); print_speed(s->speed); putchar('\n'); break; case CISTPL_FUNCE_LAN_MEDIA: m = (cistpl_lan_media_t *)(funce->data); printf("%slan_media %s\n", indent, media[m->media]); break; case CISTPL_FUNCE_LAN_NODE_ID: n = (cistpl_lan_node_id_t *)(funce->data); printf("%slan_node_id", indent); for (i = 0; i < n->nb; i++) printf(" %02x", n->id[i]); putchar('\n'); break; case CISTPL_FUNCE_LAN_CONNECTOR: c = (cistpl_lan_connector_t *)(funce->data); printf("%slan_connector ", indent); if (c->code == 0) printf("Open connector standard\n"); else printf("Closed connector standard\n"); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -