summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/include/arch/pci_io_cfg.h38
-rw-r--r--src/arch/x86/pci_ops_conf1.c12
-rw-r--r--src/device/pci_ops_mmconf.c12
-rw-r--r--src/include/device/pci.h12
-rw-r--r--src/include/device/pci_mmio_cfg.h24
-rw-r--r--src/include/device/pci_ops.h36
6 files changed, 67 insertions, 67 deletions
diff --git a/src/arch/x86/include/arch/pci_io_cfg.h b/src/arch/x86/include/arch/pci_io_cfg.h
index 017e661f14..45ca381d09 100644
--- a/src/arch/x86/include/arch/pci_io_cfg.h
+++ b/src/arch/x86/include/arch/pci_io_cfg.h
@@ -19,7 +19,7 @@
#include <device/pci_type.h>
static __always_inline
-unsigned int pci_io_encode_addr(pci_devfn_t dev, unsigned int where)
+uint32_t pci_io_encode_addr(pci_devfn_t dev, uint16_t where)
{
if (CONFIG(PCI_IO_CFG_EXT)) {
// seg == 0
@@ -30,49 +30,49 @@ unsigned int pci_io_encode_addr(pci_devfn_t dev, unsigned int where)
}
static __always_inline
-uint8_t pci_io_read_config8(pci_devfn_t dev, unsigned int where)
+uint8_t pci_io_read_config8(pci_devfn_t dev, uint16_t where)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inb(0xCFC + (addr & 3));
}
static __always_inline
-uint16_t pci_io_read_config16(pci_devfn_t dev, unsigned int where)
+uint16_t pci_io_read_config16(pci_devfn_t dev, uint16_t where)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inw(0xCFC + (addr & 2));
}
static __always_inline
-uint32_t pci_io_read_config32(pci_devfn_t dev, unsigned int where)
+uint32_t pci_io_read_config32(pci_devfn_t dev, uint16_t where)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inl(0xCFC);
}
static __always_inline
-void pci_io_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value)
+void pci_io_write_config8(pci_devfn_t dev, uint16_t where, uint8_t value)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outb(value, 0xCFC + (addr & 3));
}
static __always_inline
-void pci_io_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value)
+void pci_io_write_config16(pci_devfn_t dev, uint16_t where, uint16_t value)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outw(value, 0xCFC + (addr & 2));
}
static __always_inline
-void pci_io_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value)
+void pci_io_write_config32(pci_devfn_t dev, uint16_t where, uint32_t value)
{
- unsigned int addr = pci_io_encode_addr(dev, where);
+ uint32_t addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outl(value, 0xCFC);
}
@@ -85,37 +85,37 @@ void pci_io_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value)
*/
static __always_inline
-uint8_t pci_s_read_config8(pci_devfn_t dev, unsigned int where)
+uint8_t pci_s_read_config8(pci_devfn_t dev, uint16_t where)
{
return pci_io_read_config8(dev, where);
}
static __always_inline
-uint16_t pci_s_read_config16(pci_devfn_t dev, unsigned int where)
+uint16_t pci_s_read_config16(pci_devfn_t dev, uint16_t where)
{
return pci_io_read_config16(dev, where);
}
static __always_inline
-uint32_t pci_s_read_config32(pci_devfn_t dev, unsigned int where)
+uint32_t pci_s_read_config32(pci_devfn_t dev, uint16_t where)
{
return pci_io_read_config32(dev, where);
}
static __always_inline
-void pci_s_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value)
+void pci_s_write_config8(pci_devfn_t dev, uint16_t where, uint8_t value)
{
pci_io_write_config8(dev, where, value);
}
static __always_inline
-void pci_s_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value)
+void pci_s_write_config16(pci_devfn_t dev, uint16_t where, uint16_t value)
{
pci_io_write_config16(dev, where, value);
}
static __always_inline
-void pci_s_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value)
+void pci_s_write_config32(pci_devfn_t dev, uint16_t where, uint32_t value)
{
pci_io_write_config32(dev, where, value);
}
diff --git a/src/arch/x86/pci_ops_conf1.c b/src/arch/x86/pci_ops_conf1.c
index 7d82507fd2..3cd1ed5f18 100644
--- a/src/arch/x86/pci_ops_conf1.c
+++ b/src/arch/x86/pci_ops_conf1.c
@@ -27,39 +27,39 @@
((where & 0xf00)<<16))
#endif
-static uint8_t pci_conf1_read_config8(struct device *dev, int where)
+static uint8_t pci_conf1_read_config8(const struct device *dev, uint16_t where)
{
outl(CONF_CMD(dev, where), 0xCF8);
return inb(0xCFC + (where & 3));
}
-static uint16_t pci_conf1_read_config16(struct device *dev, int where)
+static uint16_t pci_conf1_read_config16(const struct device *dev, uint16_t where)
{
outl(CONF_CMD(dev, where), 0xCF8);
return inw(0xCFC + (where & 2));
}
-static uint32_t pci_conf1_read_config32(struct device *dev, int where)
+static uint32_t pci_conf1_read_config32(const struct device *dev, uint16_t where)
{
outl(CONF_CMD(dev, where), 0xCF8);
return inl(0xCFC);
}
-static void pci_conf1_write_config8(struct device *dev, int where,
+static void pci_conf1_write_config8(const struct device *dev, uint16_t where,
uint8_t value)
{
outl(CONF_CMD(dev, where), 0xCF8);
outb(value, 0xCFC + (where & 3));
}
-static void pci_conf1_write_config16(struct device *dev, int where,
+static void pci_conf1_write_config16(const struct device *dev, uint16_t where,
uint16_t value)
{
outl(CONF_CMD(dev, where), 0xCF8);
outw(value, 0xCFC + (where & 2));
}
-static void pci_conf1_write_config32(struct device *dev, int where,
+static void pci_conf1_write_config32(const struct device *dev, uint16_t where,
uint32_t value)
{
outl(CONF_CMD(dev, where), 0xCF8);
diff --git a/src/device/pci_ops_mmconf.c b/src/device/pci_ops_mmconf.c
index 9b03068169..bfa75cedbc 100644
--- a/src/device/pci_ops_mmconf.c
+++ b/src/device/pci_ops_mmconf.c
@@ -29,34 +29,34 @@
(((dev)->path.pci.devfn & 0xFF) << 12) |\
((where) & 0xFFF)) & ~mask))
-static uint8_t pci_mmconf_read_config8(struct device *dev, int where)
+static uint8_t pci_mmconf_read_config8(const struct device *dev, uint16_t where)
{
return read8(PCI_MMIO_ADDR(dev, where, 0));
}
-static uint16_t pci_mmconf_read_config16(struct device *dev, int where)
+static uint16_t pci_mmconf_read_config16(const struct device *dev, uint16_t where)
{
return read16(PCI_MMIO_ADDR(dev, where, 1));
}
-static uint32_t pci_mmconf_read_config32(struct device *dev, int where)
+static uint32_t pci_mmconf_read_config32(const struct device *dev, uint16_t where)
{
return read32(PCI_MMIO_ADDR(dev, where, 3));
}
-static void pci_mmconf_write_config8(struct device *dev, int where,
+static void pci_mmconf_write_config8(const struct device *dev, uint16_t where,
uint8_t value)
{
write8(PCI_MMIO_ADDR(dev, where, 0), value);
}
-static void pci_mmconf_write_config16(struct device *dev, int where,
+static void pci_mmconf_write_config16(const struct device *dev, uint16_t where,
uint16_t value)
{
write16(PCI_MMIO_ADDR(dev, where, 1), value);
}
-static void pci_mmconf_write_config32(struct device *dev, int where,
+static void pci_mmconf_write_config32(const struct device *dev, uint16_t where,
uint32_t value)
{
write32(PCI_MMIO_ADDR(dev, where, 3), value);
diff --git a/src/include/device/pci.h b/src/include/device/pci.h
index 2fefb39a92..aa2dd99685 100644
--- a/src/include/device/pci.h
+++ b/src/include/device/pci.h
@@ -35,12 +35,12 @@ struct pci_operations {
/* Common pci bus operations */
struct pci_bus_operations {
- uint8_t (*read8)(struct device *dev, int where);
- uint16_t (*read16)(struct device *dev, int where);
- uint32_t (*read32)(struct device *dev, int where);
- void (*write8)(struct device *dev, int where, uint8_t val);
- void (*write16)(struct device *dev, int where, uint16_t val);
- void (*write32)(struct device *dev, int where, uint32_t val);
+ uint8_t (*read8)(const struct device *dev, uint16_t where);
+ uint16_t (*read16)(const struct device *dev, uint16_t where);
+ uint32_t (*read32)(const struct device *dev, uint16_t where);
+ void (*write8)(const struct device *dev, uint16_t where, uint8_t val);
+ void (*write16)(const struct device *dev, uint16_t where, uint16_t val);
+ void (*write32)(const struct device *dev, uint16_t where, uint32_t val);
};
struct pci_driver {
diff --git a/src/include/device/pci_mmio_cfg.h b/src/include/device/pci_mmio_cfg.h
index aaa21813ce..64406a728e 100644
--- a/src/include/device/pci_mmio_cfg.h
+++ b/src/include/device/pci_mmio_cfg.h
@@ -22,7 +22,7 @@
static __always_inline
-u8 pci_mmio_read_config8(pci_devfn_t dev, unsigned int where)
+uint8_t pci_mmio_read_config8(pci_devfn_t dev, uint16_t where)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | where);
@@ -30,7 +30,7 @@ u8 pci_mmio_read_config8(pci_devfn_t dev, unsigned int where)
}
static __always_inline
-u16 pci_mmio_read_config16(pci_devfn_t dev, unsigned int where)
+uint16_t pci_mmio_read_config16(pci_devfn_t dev, uint16_t where)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | (where & ~1));
@@ -38,7 +38,7 @@ u16 pci_mmio_read_config16(pci_devfn_t dev, unsigned int where)
}
static __always_inline
-u32 pci_mmio_read_config32(pci_devfn_t dev, unsigned int where)
+uint32_t pci_mmio_read_config32(pci_devfn_t dev, uint16_t where)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | (where & ~3));
@@ -46,7 +46,7 @@ u32 pci_mmio_read_config32(pci_devfn_t dev, unsigned int where)
}
static __always_inline
-void pci_mmio_write_config8(pci_devfn_t dev, unsigned int where, u8 value)
+void pci_mmio_write_config8(pci_devfn_t dev, uint16_t where, uint8_t value)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | where);
@@ -54,7 +54,7 @@ void pci_mmio_write_config8(pci_devfn_t dev, unsigned int where, u8 value)
}
static __always_inline
-void pci_mmio_write_config16(pci_devfn_t dev, unsigned int where, u16 value)
+void pci_mmio_write_config16(pci_devfn_t dev, uint16_t where, uint16_t value)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | (where & ~1));
@@ -62,7 +62,7 @@ void pci_mmio_write_config16(pci_devfn_t dev, unsigned int where, u16 value)
}
static __always_inline
-void pci_mmio_write_config32(pci_devfn_t dev, unsigned int where, u32 value)
+void pci_mmio_write_config32(pci_devfn_t dev, uint16_t where, uint32_t value)
{
void *addr;
addr = (void *)(uintptr_t)(CONFIG_MMCONF_BASE_ADDRESS | dev | (where & ~3));
@@ -77,37 +77,37 @@ void pci_mmio_write_config32(pci_devfn_t dev, unsigned int where, u32 value)
*/
static __always_inline
-uint8_t pci_s_read_config8(pci_devfn_t dev, unsigned int where)
+uint8_t pci_s_read_config8(pci_devfn_t dev, uint16_t where)
{
return pci_mmio_read_config8(dev, where);
}
static __always_inline
-uint16_t pci_s_read_config16(pci_devfn_t dev, unsigned int where)
+uint16_t pci_s_read_config16(pci_devfn_t dev, uint16_t where)
{
return pci_mmio_read_config16(dev, where);
}
static __always_inline
-uint32_t pci_s_read_config32(pci_devfn_t dev, unsigned int where)
+uint32_t pci_s_read_config32(pci_devfn_t dev, uint16_t where)
{
return pci_mmio_read_config32(dev, where);
}
static __always_inline
-void pci_s_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value)
+void pci_s_write_config8(pci_devfn_t dev, uint16_t where, uint8_t value)
{
pci_mmio_write_config8(dev, where, value);
}
static __always_inline
-void pci_s_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value)
+void pci_s_write_config16(pci_devfn_t dev, uint16_t where, uint16_t value)
{
pci_mmio_write_config16(dev, where, value);
}
static __always_inline
-void pci_s_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value)
+void pci_s_write_config32(pci_devfn_t dev, uint16_t where, uint32_t value)
{
pci_mmio_write_config32(dev, where, value);
}
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h
index 1c9f3cc0d0..618e3a1cbd 100644
--- a/src/include/device/pci_ops.h
+++ b/src/include/device/pci_ops.h
@@ -55,42 +55,42 @@ static __always_inline void pcidev_assert(const struct device *dev)
}
static __always_inline
-u8 pci_read_config8(struct device *dev, unsigned int where)
+u8 pci_read_config8(const struct device *dev, u16 where)
{
pcidev_assert(dev);
return pci_bus_ops()->read8(dev, where);
}
static __always_inline
-u16 pci_read_config16(struct device *dev, unsigned int where)
+u16 pci_read_config16(const struct device *dev, u16 where)
{
pcidev_assert(dev);
return pci_bus_ops()->read16(dev, where);
}
static __always_inline
-u32 pci_read_config32(struct device *dev, unsigned int where)
+u32 pci_read_config32(const struct device *dev, u16 where)
{
pcidev_assert(dev);
return pci_bus_ops()->read32(dev, where);
}
static __always_inline
-void pci_write_config8(struct device *dev, unsigned int where, u8 val)
+void pci_write_config8(const struct device *dev, u16 where, u8 val)
{
pcidev_assert(dev);
pci_bus_ops()->write8(dev, where, val);
}
static __always_inline
-void pci_write_config16(struct device *dev, unsigned int where, u16 val)
+void pci_write_config16(const struct device *dev, u16 where, u16 val)
{
pcidev_assert(dev);
pci_bus_ops()->write16(dev, where, val);
}
static __always_inline
-void pci_write_config32(struct device *dev, unsigned int where, u32 val)
+void pci_write_config32(const struct device *dev, u16 where, u32 val)
{
pcidev_assert(dev);
pci_bus_ops()->write32(dev, where, val);
@@ -100,10 +100,10 @@ void pci_write_config32(struct device *dev, unsigned int where, u32 val)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_or_config8(pci_devfn_t dev, unsigned int where, u8 ormask)
+void pci_or_config8(pci_devfn_t dev, u16 where, u8 ormask)
#else
static __always_inline
-void pci_or_config8(struct device *dev, unsigned int where, u8 ormask)
+void pci_or_config8(const struct device *dev, u16 where, u8 ormask)
#endif
{
u8 value = pci_read_config8(dev, where);
@@ -112,10 +112,10 @@ void pci_or_config8(struct device *dev, unsigned int where, u8 ormask)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_or_config16(pci_devfn_t dev, unsigned int where, u16 ormask)
+void pci_or_config16(pci_devfn_t dev, u16 where, u16 ormask)
#else
static __always_inline
-void pci_or_config16(struct device *dev, unsigned int where, u16 ormask)
+void pci_or_config16(const struct device *dev, u16 where, u16 ormask)
#endif
{
u16 value = pci_read_config16(dev, where);
@@ -124,10 +124,10 @@ void pci_or_config16(struct device *dev, unsigned int where, u16 ormask)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_or_config32(pci_devfn_t dev, unsigned int where, u32 ormask)
+void pci_or_config32(pci_devfn_t dev, u16 where, u32 ormask)
#else
static __always_inline
-void pci_or_config32(struct device *dev, unsigned int where, u32 ormask)
+void pci_or_config32(const struct device *dev, u16 where, u32 ormask)
#endif
{
u32 value = pci_read_config32(dev, where);
@@ -136,10 +136,10 @@ void pci_or_config32(struct device *dev, unsigned int where, u32 ormask)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_update_config8(pci_devfn_t dev, int reg, u8 mask, u8 or)
+void pci_update_config8(pci_devfn_t dev, u16 reg, u8 mask, u8 or)
#else
static __always_inline
-void pci_update_config8(struct device *dev, int reg, u8 mask, u8 or)
+void pci_update_config8(const struct device *dev, u16 reg, u8 mask, u8 or)
#endif
{
u8 reg8;
@@ -152,10 +152,10 @@ void pci_update_config8(struct device *dev, int reg, u8 mask, u8 or)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_update_config16(pci_devfn_t dev, int reg, u16 mask, u16 or)
+void pci_update_config16(pci_devfn_t dev, u16 reg, u16 mask, u16 or)
#else
static __always_inline
-void pci_update_config16(struct device *dev, int reg, u16 mask, u16 or)
+void pci_update_config16(const struct device *dev, u16 reg, u16 mask, u16 or)
#endif
{
u16 reg16;
@@ -168,10 +168,10 @@ void pci_update_config16(struct device *dev, int reg, u16 mask, u16 or)
#ifdef __SIMPLE_DEVICE__
static __always_inline
-void pci_update_config32(pci_devfn_t dev, int reg, u32 mask, u32 or)
+void pci_update_config32(pci_devfn_t dev, u16 reg, u32 mask, u32 or)
#else
static __always_inline
-void pci_update_config32(struct device *dev, int reg, u32 mask, u32 or)
+void pci_update_config32(const struct device *dev, u16 reg, u32 mask, u32 or)
#endif
{
u32 reg32;