diff options
author | Simon Glass <sjg@chromium.org> | 2015-08-10 07:05:03 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-08-14 03:24:21 -0600 |
commit | 66afb4ed924693412f2f4e05fbfae6a642159402 (patch) | |
tree | 786d846f531fcd19a2d2a57b07317a48d78adc32 /include/pci.h | |
parent | da60fb79349320a21fd0b7c1e602fa492291d1f7 (diff) | |
download | u-boot-imx-66afb4ed924693412f2f4e05fbfae6a642159402.zip u-boot-imx-66afb4ed924693412f2f4e05fbfae6a642159402.tar.gz u-boot-imx-66afb4ed924693412f2f4e05fbfae6a642159402.tar.bz2 |
dm: pci: Provide friendly config access functions
At present there are no PCI functions which allow access to PCI
configuration using a struct udevice. This is a sad situation for driver
model as it makes use of PCI harder. Add these functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/pci.h')
-rw-r--r-- | include/pci.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/pci.h b/include/pci.h index 628ede0..d1e2765 100644 --- a/include/pci.h +++ b/include/pci.h @@ -988,6 +988,24 @@ int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset, int pci_bus_write_config(struct udevice *bus, pci_dev_t bdf, int offset, unsigned long value, enum pci_size_t size); +/** + * Driver model PCI config access functions. Use these in preference to others + * when you have a valid device + */ +int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep, + enum pci_size_t size); + +int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep); +int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep); +int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep); + +int dm_pci_write_config(struct udevice *dev, int offset, unsigned long value, + enum pci_size_t size); + +int dm_pci_write_config8(struct udevice *dev, int offset, u8 value); +int dm_pci_write_config16(struct udevice *dev, int offset, u16 value); +int dm_pci_write_config32(struct udevice *dev, int offset, u32 value); + /* * The following functions provide access to the above without needing the * size parameter. We are trying to encourage the use of the 8/16/32-style |