2 * Definitions for PCI access
3 * NetWatch system management mode administration console
5 * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved.
6 * This program is free software; you can redistribute and/or modify it under
7 * the terms found in the file LICENSE in the root of this source tree.
17 /* General PCI functions. This is implemented by pci-linux.c and pci-raw.c; the
18 * former uses Linux's /proc/bus/pci interface for access from userspace, while
19 * the latter accesses the PCI hardware directly.
22 void pci_write32(int bus, int slot, int fn, int addr, uint32_t data);
23 void pci_write16(int bus, int slot, int fn, int addr, uint16_t data);
24 void pci_write8(int bus, int slot, int fn, int addr, uint8_t data);
26 uint32_t pci_read32(int bus, int slot, int fn, int addr);
27 uint16_t pci_read16(int bus, int slot, int fn, int addr);
28 uint8_t pci_read8(int bus, int slot, int fn, int addr);
30 /* Hardware-agnostic functions implemented by pci.c */
38 typedef struct pci_bar {
40 unsigned char prefetchable;
44 typedef struct pci_dev {
45 unsigned short vid, did;
50 typedef int (*pci_probe_fn_t)(pci_dev_t *, void *data);
53 int pci_probe(pci_probe_fn_t probe, void *data);
55 typedef struct pci_id {
56 unsigned short vid, did;
57 const char *name, *friendlyname;
60 #define PCI_ROM(a,b,c,d) {(a),(b),(c),(d)}
62 typedef struct pci_driver {
69 int pci_probe_driver(pci_driver_t *driver);