Lines Matching +full:count +full:- +full:width

84     const char *bar_count, int width, int verbose);
93 "usage: pciconf -l [-BbcevV] [device]\n" in usage()
94 " pciconf -a device\n" in usage()
95 " pciconf -r [-b | -h] device addr[:addr2]\n" in usage()
96 " pciconf -w [-b | -h] device addr value\n" in usage()
97 " pciconf -D [-b | -h | -x] device bar [start [count]]" in usage()
105 int c, width; in main() local
111 width = 4; in main()
113 while ((c = getopt(argc, argv, "aBbcDehlrwVv")) != -1) { in main()
125 width = 1; in main()
141 width = 2; in main()
165 width = 8; in main()
178 || (width == 8 && !dumpbarmode)) in main()
187 readit(argv[optind], argv[optind + 1], width); in main()
190 width); in main()
195 width, verbose); in main()
236 if (ioctl(fd, PCIOCGETCONF, &pc) == -1) in list_devs()
266 *p->pd_name ? p->pd_name : "none", in list_devs()
267 *p->pd_name ? (int)p->pd_unit : in list_devs()
268 none_count++, p->pc_sel.pc_domain, in list_devs()
269 p->pc_sel.pc_bus, p->pc_sel.pc_dev, in list_devs()
270 p->pc_sel.pc_func, (p->pc_class << 16) | in list_devs()
271 (p->pc_subclass << 8) | p->pc_progif, in list_devs()
272 p->pc_revid, p->pc_hdr, in list_devs()
273 p->pc_vendor, p->pc_device, in list_devs()
274 p->pc_subvendor, p->pc_subdevice); in list_devs()
280 *p->pd_name ? p->pd_name : "none", in list_devs()
281 *p->pd_name ? (int)p->pd_unit : in list_devs()
282 none_count++, p->pc_sel.pc_domain, in list_devs()
283 p->pc_sel.pc_bus, p->pc_sel.pc_dev, in list_devs()
284 p->pc_sel.pc_func, (p->pc_class << 16) | in list_devs()
285 (p->pc_subclass << 8) | p->pc_progif, in list_devs()
286 p->pc_revid, p->pc_hdr, in list_devs()
287 p->pc_vendor, p->pc_device, in list_devs()
288 p->pc_subvendor, p->pc_subdevice); in list_devs()
312 secbus = read_config(fd, &p->pc_sel, secreg, 1); in print_bus_range()
313 subbus = read_config(fd, &p->pc_sel, subreg, 1); in print_bus_range()
314 printf(" bus range = %u-%u\n", secbus, subbus); in print_bus_range()
322 printf(" window[%02x] = type %s, range %2d, addr %#jx-%#jx, %s\n", in print_window()
364 val = read_config(fd, &p->pc_sel, PCIR_IOBASEL_1, 1); in print_bridge_windows()
365 if (val != 0 || read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1) != 0) { in print_bridge_windows()
368 read_config(fd, &p->pc_sel, PCIR_IOBASEH_1, 2), in print_bridge_windows()
371 read_config(fd, &p->pc_sel, PCIR_IOLIMITH_1, 2), in print_bridge_windows()
372 read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1)); in print_bridge_windows()
377 read_config(fd, &p->pc_sel, PCIR_IOLIMITL_1, 1)); in print_bridge_windows()
384 read_config(fd, &p->pc_sel, PCIR_MEMBASE_1, 2)); in print_bridge_windows()
386 read_config(fd, &p->pc_sel, PCIR_MEMLIMIT_1, 2)); in print_bridge_windows()
389 val = read_config(fd, &p->pc_sel, PCIR_PMBASEL_1, 2); in print_bridge_windows()
390 if (val != 0 || read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2) != 0) { in print_bridge_windows()
393 read_config(fd, &p->pc_sel, PCIR_PMBASEH_1, 4), in print_bridge_windows()
396 read_config(fd, &p->pc_sel, PCIR_PMLIMITH_1, 4), in print_bridge_windows()
397 read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2)); in print_bridge_windows()
402 read_config(fd, &p->pc_sel, PCIR_PMLIMITL_1, 2)); in print_bridge_windows()
413 subtractive = p->pc_progif == PCIP_BRIDGE_PCI_SUBTRACTIVE; in print_bridge_windows()
414 switch (p->pc_device << 16 | p->pc_vendor) { in print_bridge_windows()
420 if (p->pc_vendor == 0x8086 && (p->pc_device & 0xff00) == 0x2400) in print_bridge_windows()
423 bctl = read_config(fd, &p->pc_sel, PCIR_BRIDGECTL_1, 2); in print_bridge_windows()
434 PCI_CBBMEMBASE(read_config(fd, &p->pc_sel, basereg, 4)), in print_cardbus_mem_window()
435 PCI_CBBMEMLIMIT(read_config(fd, &p->pc_sel, limitreg, 4))); in print_cardbus_mem_window()
445 val = read_config(fd, &p->pc_sel, basereg, 2); in print_cardbus_io_window()
447 base = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, basereg, 4)); in print_cardbus_io_window()
448 limit = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, limitreg, 4)); in print_cardbus_io_window()
452 limit = PCI_CBBIOBASE(read_config(fd, &p->pc_sel, limitreg, 2)); in print_cardbus_io_window()
463 bctl = read_config(fd, &p->pc_sel, PCIR_BRIDGECTL_2, 2); in print_cardbus_windows()
478 switch (p->pc_hdr & PCIM_HDRTYPE) { in list_bridge()
495 switch (p->pc_hdr & PCIM_HDRTYPE) { in list_bars()
521 bar.pbi_sel = p->pc_sel; in print_bar()
545 range = -1; in print_bar()
563 if (vi->id == p->pc_vendor) { in list_verbose()
564 printf(" vendor = '%s'\n", vi->desc); in list_verbose()
571 TAILQ_FOREACH(di, &vi->devs, link) { in list_verbose()
572 if (di->id == p->pc_device) { in list_verbose()
573 printf(" device = '%s'\n", di->desc); in list_verbose()
590 list.plvi_sel = p->pc_sel; in list_vpd()
605 if (vpd->pve_flags == PVE_FLAG_IDENT) { in list_vpd()
607 (int)vpd->pve_datalen, vpd->pve_data); in list_vpd()
612 if (!(vpd->pve_flags & PVE_FLAG_RW) && in list_vpd()
613 memcmp(vpd->pve_keyword, "RV", 2) == 0) in list_vpd()
616 /* Ignore remaining read-write space. */ in list_vpd()
617 if (vpd->pve_flags & PVE_FLAG_RW && in list_vpd()
618 memcmp(vpd->pve_keyword, "RW", 2) == 0) in list_vpd()
622 if (!(vpd->pve_flags & PVE_FLAG_RW) && in list_vpd()
623 memcmp(vpd->pve_keyword, "CP", 2) == 0) { in list_vpd()
625 (unsigned int)vpd->pve_data[0], in list_vpd()
626 PCIR_BAR((unsigned int)vpd->pve_data[1]), in list_vpd()
627 (unsigned int)vpd->pve_data[3] << 8 | in list_vpd()
628 (unsigned int)vpd->pve_data[2]); in list_vpd()
634 vpd->pve_flags & PVE_FLAG_RW ? "rw" : "ro", in list_vpd()
635 vpd->pve_keyword[0], vpd->pve_keyword[1], in list_vpd()
636 (int)vpd->pve_datalen, vpd->pve_data); in list_vpd()
642 * This is a direct cut-and-paste from the table in sys/dev/pci/pci.c.
650 {PCIC_OLD, -1, "old"},
651 {PCIC_OLD, PCIS_OLD_NONVGA, "non-VGA display device"},
652 {PCIC_OLD, PCIS_OLD_VGA, "VGA-compatible display device"},
653 {PCIC_STORAGE, -1, "mass storage"},
664 {PCIC_NETWORK, -1, "network"},
674 {PCIC_DISPLAY, -1, "display"},
678 {PCIC_MULTIMEDIA, -1, "multimedia"},
683 {PCIC_MEMORY, -1, "memory"},
686 {PCIC_BRIDGE, -1, "bridge"},
687 {PCIC_BRIDGE, PCIS_BRIDGE_HOST, "HOST-PCI"},
688 {PCIC_BRIDGE, PCIS_BRIDGE_ISA, "PCI-ISA"},
689 {PCIC_BRIDGE, PCIS_BRIDGE_EISA, "PCI-EISA"},
690 {PCIC_BRIDGE, PCIS_BRIDGE_MCA, "PCI-MCA"},
691 {PCIC_BRIDGE, PCIS_BRIDGE_PCI, "PCI-PCI"},
692 {PCIC_BRIDGE, PCIS_BRIDGE_PCMCIA, "PCI-PCMCIA"},
693 {PCIC_BRIDGE, PCIS_BRIDGE_NUBUS, "PCI-NuBus"},
694 {PCIC_BRIDGE, PCIS_BRIDGE_CARDBUS, "PCI-CardBus"},
695 {PCIC_BRIDGE, PCIS_BRIDGE_RACEWAY, "PCI-RACEway"},
697 "Semi-transparent PCI-to-PCI"},
698 {PCIC_BRIDGE, PCIS_BRIDGE_INFINIBAND, "InfiniBand-PCI"},
700 "AdvancedSwitching-PCI"},
701 {PCIC_SIMPLECOMM, -1, "simple comms"},
706 {PCIC_BASEPERIPH, -1, "base peripheral"},
711 {PCIC_BASEPERIPH, PCIS_BASEPERIPH_PCIHOT, "PCI hot-plug controller"},
716 {PCIC_INPUTDEV, -1, "input device"},
722 {PCIC_DOCKING, -1, "docking station"},
723 {PCIC_PROCESSOR, -1, "processor"},
724 {PCIC_SERIALBUS, -1, "serial bus"},
736 {PCIC_WIRELESS, -1, "wireless controller"},
748 {PCIC_INTELLIIO, -1, "intelligent I/O controller"},
750 {PCIC_SATCOM, -1, "satellite communication"},
755 {PCIC_CRYPTO, -1, "encrypt/decrypt"},
758 {PCIC_DASP, -1, "dasp"},
763 {PCIC_ACCEL, -1, "processing accelerators"},
765 {PCIC_INSTRUMENT, -1, "non-essential instrumentation"},
775 if (pci_nomatch_tab[i].class == p->pc_class) in guess_class()
787 if ((pci_nomatch_tab[i].class == p->pc_class) && in guess_subclass()
788 (pci_nomatch_tab[i].subclass == p->pc_subclass)) in guess_subclass()
829 ch = strchr(buf, '\0') - 1; in load_vendors()
831 *ch-- = '\0'; in load_vendors()
848 if ((cv->desc = strdup(str)) == NULL) { in load_vendors()
854 cv->id = id; in load_vendors()
855 TAILQ_INIT(&cv->devs); in load_vendors()
873 if ((cd->desc = strdup(str)) == NULL) { in load_vendors()
879 cd->id = id; in load_vendors()
880 TAILQ_INSERT_TAIL(&cv->devs, cd, link); in load_vendors()
894 read_config(int fd, struct pcisel *sel, long reg, int width) in read_config() argument
900 pi.pi_width = width; in read_config()
936 cp--; in getdevice()
937 while (cp != name && isdigit(cp[-1])) in getdevice()
938 cp--; in getdevice()
941 if ((size_t)(cp - name) + 1 > sizeof(patterns[0].pd_name)) in getdevice()
943 memcpy(patterns[0].pd_name, name, cp - name); in getdevice()
952 if (ioctl(fd, PCIOCGETCONF, &pc) == -1) in getdevice()
988 sel.pc_func = (i > 2) ? selarr[--i] : 0; in parsesel()
989 sel.pc_dev = (i > 0) ? selarr[--i] : 0; in parsesel()
990 sel.pc_bus = (i > 0) ? selarr[--i] : 0; in parsesel()
991 sel.pc_domain = (i > 0) ? selarr[--i] : 0; in parsesel()
1013 readone(int fd, struct pcisel *sel, long reg, int width) in readone() argument
1016 printf("%0*x", width*2, read_config(fd, sel, reg, width)); in readone()
1020 readit(const char *name, const char *reg, int width) in readit() argument
1040 for (i = 1, r = rstart; r <= rend; i++, r += width) { in readit()
1041 readone(fd, &sel, r, width); in readit()
1044 putchar(i % (16/width) ? ' ' : '\n'); in readit()
1046 if (i % (16/width) != 1) in readit()
1052 writeit(const char *name, const char *reg, const char *data, int width) in writeit() argument
1059 pi.pi_width = width; in writeit()
1093 const char *bar_count, int width, int verbose) in dump_bar() argument
1099 uint64_t *dx, a, start, count; in dump_bar() local
1111 count = 0; in dump_bar()
1113 count = strtoul(bar_count, &el, 0); in dump_bar()
1115 errx(1, "Invalid count specification %s", in dump_bar()
1133 if (count == 0) in dump_bar()
1134 count = pbm.pbm_bar_length / width; in dump_bar()
1135 if (start + count < start || (start + count) * width < (uint64_t)width) in dump_bar()
1136 errx(1, "(start + count) x width overflow"); in dump_bar()
1137 if ((start + count) * width > pbm.pbm_bar_length) { in dump_bar()
1138 if (start * width > pbm.pbm_bar_length) in dump_bar()
1139 count = 0; in dump_bar()
1141 count = (pbm.pbm_bar_length - start * width) / width; in dump_bar()
1146 "off %#x length %#jx from %#jx count %#jx in %d-bytes\n", in dump_bar()
1150 pbm.pbm_bar_length, start, count, width); in dump_bar()
1152 switch (width) { in dump_bar()
1155 pbm.pbm_bar_off + start * width); in dump_bar()
1156 for (a = 0; a < count; a += width, db++) { in dump_bar()
1157 res = fwrite(db, width, 1, stdout); in dump_bar()
1166 pbm.pbm_bar_off + start * width); in dump_bar()
1167 for (a = 0; a < count; a += width, dh++) { in dump_bar()
1168 res = fwrite(dh, width, 1, stdout); in dump_bar()
1177 pbm.pbm_bar_off + start * width); in dump_bar()
1178 for (a = 0; a < count; a += width, dd++) { in dump_bar()
1179 res = fwrite(dd, width, 1, stdout); in dump_bar()
1188 pbm.pbm_bar_off + start * width); in dump_bar()
1189 for (a = 0; a < count; a += width, dx++) { in dump_bar()
1190 res = fwrite(dx, width, 1, stdout); in dump_bar()
1198 errx(1, "invalid access width"); in dump_bar()