|
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
|
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. More...
|
|
static void | ecam_discover (uint32_t busdevfn, struct pci_range *range) |
| Find next PCI bus:dev.fn address range in system. More...
|
|
static int | ecam_access (struct pci_device *pci) |
| Access configuration space for PCI device. More...
|
|
int | ecam_read (struct pci_device *pci, unsigned int location, void *value) |
| Read from PCI configuration space. More...
|
|
int | ecam_write (struct pci_device *pci, unsigned int location, unsigned long value) |
| Write to PCI configuration space. More...
|
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_can_probe) |
|
| PROVIDE_PCIAPI (ecam, pci_discover, ecam_discover) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_read_config_byte) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_read_config_word) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_read_config_dword) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_write_config_byte) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_write_config_word) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_write_config_dword) |
|
| PROVIDE_PCIAPI_INLINE (ecam, pci_ioremap) |
|
PCI Enhanced Configuration Access Mechanism (ECAM)
Definition in file ecam.c.
Find lowest ECAM allocation not below a given PCI bus:dev.fn address.
- Parameters
-
busdevfn | PCI bus:dev.fn address |
range | PCI device address range to fill in |
alloc | ECAM allocation to fill in, or NULL |
- Return values
-
Definition at line 47 of file ecam.c.
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 );
uint32_t start
Starting bus:dev.fn address.
#define le32_to_cpu(value)
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
#define ECAM_SIGNATURE
Enhanced Configuration Access Mechanism table signature.
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.
#define offsetof(type, field)
Get offset of a field within a structure.
#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.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
uint16_t count
Number of entries.
static __always_inline void struct pci_range * range
#define PCI_BUSDEVFN(segment, bus, slot, func)
#define le16_to_cpu(value)
unsigned int count
Number of bus:dev.fn addresses within this range.
An Enhanced Configuration Access Mechanism allocation.
An Enhanced Configuration Access Mechanism table.
uint16_t offset
Offset to command line.
#define le64_to_cpu(value)
References acpi, acpi_table(), busdevfn, copy_from_user(), count, pci_range::count, DBGC, DBGC2, ecam, ECAM_SIGNATURE, ENOENT, ENOTSUP, index, le16_to_cpu, le32_to_cpu, le64_to_cpu, length, memcpy(), offset, offsetof, PCI_BUSDEVFN, range, start, pci_range::start, and tmp.
Referenced by ecam_access(), and ecam_discover().
Access configuration space for PCI device.
- Parameters
-
- Return values
-
Definition at line 123 of file ecam.c.
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",
uint32_t start
Starting bus:dev.fn address.
struct arbelprm_rc_send_wqe rc
struct ecam_allocation alloc
Allocation.
struct pci_range range
PCI bus:dev.fn address range.
#define ENOENT
No such file or directory.
static struct ecam_mapping ecam
Cached mapped ECAM allocation.
unsigned long long uint64_t
uint64_t base
Base address.
#define PCI_BUSDEVFN(segment, bus, slot, func)
#define ERANGE
Result too large.
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
#define ENODEV
No such device.
void * regs
MMIO base address.
#define le16_to_cpu(value)
unsigned int count
Number of bus:dev.fn addresses within this range.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
uint16_t segment
PCI segment number.
#define ECAM_SIZE
Enhanced Configuration Access Mechanism per-device size.
uint8_t start
Start PCI bus number.
#define PCI_ARGS(pci)
PCI device debug message arguments.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t end
End PCI bus number.
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 * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
#define le64_to_cpu(value)
#define NULL
NULL pointer (VOID *)
References ecam_mapping::alloc, ecam_allocation::base, base, pci_device::busdevfn, pci_range::count, DBGC, ecam, ecam_find(), ECAM_SIZE, ecam_allocation::end, ENODEV, ENOENT, ERANGE, ioremap(), iounmap(), le16_to_cpu, le64_to_cpu, len, NULL, PCI_ARGS, PCI_BUSDEVFN, PCI_FMT, ecam_mapping::range, ecam_mapping::rc, rc, ecam_mapping::regs, ecam_allocation::segment, pci_range::start, ecam_allocation::start, and strerror().
Referenced by ecam_read(), and ecam_write().
int ecam_read |
( |
struct pci_device * |
pci, |
|
|
unsigned int |
location, |
|
|
void * |
value |
|
) |
| |
Read from PCI configuration space.
- Parameters
-
pci | PCI device |
location | Offset and length within PCI configuration space |
value | Value read |
- Return values
-
Definition at line 196 of file ecam.c.
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
uint8_t readb(volatile uint8_t *io_addr)
Read byte from memory-mapped device.
struct pci_range range
PCI bus:dev.fn address range.
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
static struct ecam_mapping ecam
Cached mapped ECAM allocation.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
pseudo_bit_t value[0x00020]
void * regs
MMIO base address.
#define ECAM_LEN(location)
Extract length from ECAM location.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
#define ECAM_SIZE
Enhanced Configuration Access Mechanism per-device size.
static __always_inline int unsigned int where
#define ECAM_WHERE(location)
Extract offset from ECAM location.
void * memset(void *dest, int character, size_t len) __nonnull
References addr, assert(), pci_device::busdevfn, ecam, ecam_access(), ECAM_LEN, ECAM_SIZE, ECAM_WHERE, index, len, memset(), ecam_mapping::range, rc, readb(), readl(), readw(), ecam_mapping::regs, pci_range::start, value, and where.
Referenced by ecam_write().
int ecam_write |
( |
struct pci_device * |
pci, |
|
|
unsigned int |
location, |
|
|
unsigned long |
value |
|
) |
| |
Write to PCI configuration space.
- Parameters
-
pci | PCI device |
location | Offset and length within PCI configuration space |
value | Value to write |
- Return values
-
Definition at line 238 of file ecam.c.
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 pci_range range
PCI bus:dev.fn address range.
static struct ecam_mapping ecam
Cached mapped ECAM allocation.
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
pseudo_bit_t value[0x00020]
int ecam_read(struct pci_device *pci, unsigned int location, void *value)
Read from PCI configuration space.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
void * regs
MMIO base address.
#define ECAM_LEN(location)
Extract length from ECAM location.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
#define ECAM_SIZE
Enhanced Configuration Access Mechanism per-device size.
static __always_inline int unsigned int where
void mb(void)
Memory barrier.
#define ECAM_WHERE(location)
Extract offset from ECAM location.
References addr, assert(), pci_device::busdevfn, ecam, ecam_access(), ECAM_LEN, ecam_read(), ECAM_SIZE, ECAM_WHERE, index, len, mb(), ecam_mapping::range, rc, ecam_mapping::regs, pci_range::start, value, where, writeb(), writel(), and writew.