50 unsigned int best = 0;
64 DBGC ( &
ecam,
"ECAM found no MCFG table\n" );
80 DBGC2 ( &
ecam,
"ECAM %04x:[%02x-%02x] has base %08llx\n",
91 memcpy ( alloc, &
tmp,
sizeof ( *alloc ) );
102 return ( best ? 0 : -
ENOENT );
156 if (
base != ( (
unsigned long )
base ) ) {
157 DBGC ( &
ecam,
"ECAM %04x:[%02x-%02x] could not map " 158 "[%08llx,%08llx) outside CPU range\n",
166 DBGC ( &
ecam,
"ECAM %04x:[%02x-%02x] could not map " 174 DBGC ( &
ecam,
"ECAM %04x:[%02x-%02x] mapped [%08llx,%08llx) -> %p\n",
239 unsigned long value ) {
static int ecam_access(struct pci_device *pci)
Access configuration space for PCI device.
uint32_t start
Starting bus:dev.fn address.
struct arbelprm_rc_send_wqe rc
struct ecam_allocation alloc
Allocation.
uint8_t readb(volatile uint8_t *io_addr)
Read byte from memory-mapped device.
struct pci_range range
PCI bus:dev.fn address range.
#define le32_to_cpu(value)
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
A mapped Enhanced Configuration Access Mechanism allocation.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
#define ECAM_SIGNATURE
Enhanced Configuration Access Mechanism table signature.
int pci_can_probe(void)
Check if PCI bus probing is allowed.
userptr_t acpi_table(uint32_t signature, unsigned int index)
Locate ACPI table.
#define ENOENT
No such file or directory.
static struct ecam_mapping ecam
Cached mapped ECAM allocation.
unsigned long long uint64_t
PROVIDE_PCIAPI_INLINE(ecam, pci_can_probe)
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
#define offsetof(type, field)
Get offset of a field within a structure.
Access to external ("user") memory.
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
#define ENOTSUP
Operation not supported.
uint32_t start
Starting offset.
uint16_t busdevfn
PCI bus:dev.fn address.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t userptr_t
A pointer to a user buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define PCIAPI_RUNTIME(_subsys)
Provide a runtime selectable PCI I/O API.
pseudo_bit_t value[0x00020]
int ecam_read(struct pci_device *pci, unsigned int location, void *value)
Read from PCI configuration space.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
A PCI bus:dev.fn address range.
uint16_t count
Number of entries.
uint64_t base
Base address.
static __always_inline void struct pci_range * range
#define PCI_BUSDEVFN(segment, bus, slot, func)
#define ERANGE
Result too large.
char * strerror(int errno)
Retrieve string representation of error number.
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
#define PCI_FMT
PCI device debug message format.
A runtime selectable PCI I/O API.
PCI I/O API for Enhanced Configuration Access Mechanism (ECAM)
#define ENODEV
No such device.
void * regs
MMIO base address.
#define ECAM_LEN(location)
Extract length from ECAM location.
#define le16_to_cpu(value)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int count
Number of bus:dev.fn addresses within this range.
void pci_discover(uint32_t busdevfn, struct pci_range *range)
Find next PCI bus:dev.fn address range in system.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
int ecam_write(struct pci_device *pci, unsigned int location, unsigned long value)
Write to PCI configuration space.
uint16_t segment
PCI segment number.
#define ECAM_SIZE
Enhanced Configuration Access Mechanism per-device size.
An Enhanced Configuration Access Mechanism allocation.
uint8_t start
Start PCI bus number.
#define PCI_ARGS(pci)
PCI device debug message arguments.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
static __always_inline int unsigned int where
uint8_t end
End PCI bus number.
An Enhanced Configuration Access Mechanism table.
uint16_t offset
Offset to command line.
static int ecam_find(uint32_t busdevfn, struct pci_range *range, struct ecam_allocation *alloc)
Find lowest ECAM allocation not below a given PCI bus:dev.fn address.
void mb(void)
Memory barrier.
PROVIDE_PCIAPI(ecam, pci_discover, ecam_discover)
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define ECAM_WHERE(location)
Extract offset from ECAM location.
#define le64_to_cpu(value)
#define NULL
NULL pointer (VOID *)
static void ecam_discover(uint32_t busdevfn, struct pci_range *range)
Find next PCI bus:dev.fn address range in system.
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.