6 #include <device/device.h>
7 #include <arch/pci_ops.h>
9 #ifndef __SIMPLE_DEVICE__
10 u8
pci_read_config8(struct device
*dev
, unsigned int where
);
11 u16
pci_read_config16(struct device
*dev
, unsigned int where
);
12 u32
pci_read_config32(struct device
*dev
, unsigned int where
);
13 void pci_write_config8(struct device
*dev
, unsigned int where
, u8 val
);
14 void pci_write_config16(struct device
*dev
, unsigned int where
, u16 val
);
15 void pci_write_config32(struct device
*dev
, unsigned int where
, u32 val
);
20 * Use device_t here as the functions are to be used with either
21 * __SIMPLE_DEVICE__ defined or undefined.
23 static __always_inline
24 void pci_or_config8(device_t dev
, unsigned int where
, u8 ormask
)
26 u8 value
= pci_read_config8(dev
, where
);
27 pci_write_config8(dev
, where
, value
| ormask
);
30 static __always_inline
31 void pci_or_config16(device_t dev
, unsigned int where
, u16 ormask
)
33 u16 value
= pci_read_config16(dev
, where
);
34 pci_write_config16(dev
, where
, value
| ormask
);
37 static __always_inline
38 void pci_or_config32(device_t dev
, unsigned int where
, u32 ormask
)
40 u32 value
= pci_read_config32(dev
, where
);
41 pci_write_config32(dev
, where
, value
| ormask
);
44 static __always_inline
45 void pci_update_config8(device_t dev
, int reg
, u8 mask
, u8
or)
49 reg8
= pci_read_config8(dev
, reg
);
52 pci_write_config8(dev
, reg
, reg8
);
55 static __always_inline
56 void pci_update_config16(device_t dev
, int reg
, u16 mask
, u16
or)
60 reg16
= pci_read_config16(dev
, reg
);
63 pci_write_config16(dev
, reg
, reg16
);
66 static __always_inline
67 void pci_update_config32(device_t dev
, int reg
, u32 mask
, u32
or)
71 reg32
= pci_read_config32(dev
, reg
);
74 pci_write_config32(dev
, reg
, reg32
);
77 const struct pci_bus_operations
*pci_bus_default_ops(struct device
*dev
);
79 #endif /* PCI_OPS_H */