4 int main(int argc, char **argv)
6 unsigned int bus, dev, fn, addr;
7 unsigned char type = 'b';
16 if ((argc < 5) || (argc > 7))
19 printf("usage: %s bus dev fn addr [b|w|l [datum]]\n", argv[0]);
23 bus = strtoul(argv[1], NULL, 0);
24 dev = strtoul(argv[2], NULL, 0);
25 fn = strtoul(argv[3], NULL, 0);
26 addr = strtoul(argv[4], NULL, 0);
33 datum = strtoul(argv[6], NULL, 0);
38 pci_write8(bus, dev, fn, addr, datum);
39 printf("Wrote byte 0x%02x to %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);
43 pci_write16(bus, dev, fn, addr, datum);
44 printf("Wrote word 0x%04x to %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);
47 pci_write32(bus, dev, fn, addr, datum);
48 printf("Wrote long 0x%08x to %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);
57 datum = pci_read8(bus, dev, fn, addr);
58 printf("Read byte 0x%02x from %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);
61 datum = pci_read16(bus, dev, fn, addr);
62 printf("Read word 0x%04x from %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);
65 datum = pci_read32(bus, dev, fn, addr);
66 printf("Read long 0x%08x from %02x:%02x.%x[%02x]\n", datum, bus, dev, fn, addr);