|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| static int | efipci_discover_one (struct pci_device *pci, EFI_HANDLE handle, struct pci_range *range) |
| | Find closest bus:dev.fn address range within a root bridge. More...
|
| |
| static int | efipci_discover_any (struct pci_device *pci, struct pci_range *range, EFI_HANDLE *handle) |
| | Find closest bus:dev.fn address range within any root bridge. More...
|
| |
| static void | efipci_discover (uint32_t busdevfn, struct pci_range *range) |
| | Find next PCI bus:dev.fn address range in system. More...
|
| |
| static int | efipci_root_open (struct pci_device *pci, EFI_HANDLE *handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **root) |
| | Open EFI PCI root bridge I/O protocol for ephemeral use. More...
|
| |
| static unsigned long | efipci_address (struct pci_device *pci, unsigned long location) |
| | Calculate EFI PCI configuration space address. More...
|
| |
| int | efipci_read (struct pci_device *pci, unsigned long location, void *value) |
| | Read from PCI configuration space. More...
|
| |
| int | efipci_write (struct pci_device *pci, unsigned long location, unsigned long value) |
| | Write to PCI configuration space. More...
|
| |
| void * | efipci_ioremap (struct pci_device *pci, unsigned long bus_addr, size_t len) |
| | Map PCI bus address as an I/O address. More...
|
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_can_probe) |
| |
| | PROVIDE_PCIAPI (efi, pci_discover, efipci_discover) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_read_config_byte) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_read_config_word) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_read_config_dword) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_write_config_byte) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_write_config_word) |
| |
| | PROVIDE_PCIAPI_INLINE (efi, pci_write_config_dword) |
| |
| | PROVIDE_PCIAPI (efi, pci_ioremap, efipci_ioremap) |
| |
| | PROVIDE_PCIAPI_RUNTIME (efi, PCIAPI_PRIORITY_EFI) |
| |
| static int | efipci_dma_map (struct dma_device *dma, struct dma_mapping *map, void *addr, size_t len, int flags) |
| | Map buffer for DMA. More...
|
| |
| static void | efipci_dma_unmap (struct dma_device *dma, struct dma_mapping *map, size_t len __unused) |
| | Unmap buffer. More...
|
| |
| static void * | efipci_dma_alloc (struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align __unused) |
| | Allocate and map DMA-coherent buffer. More...
|
| |
| static void | efipci_dma_free (struct dma_device *dma, struct dma_mapping *map, void *addr, size_t len) |
| | Unmap and free DMA-coherent buffer. More...
|
| |
| static void | efipci_dma_set_mask (struct dma_device *dma, physaddr_t mask) |
| | Set addressable space mask. More...
|
| |
| int | efipci_info (EFI_HANDLE device, struct efi_pci_device *efipci) |
| | Get EFI PCI device information. More...
|
| |
| static int | efipci_supported (EFI_HANDLE device) |
| | Check to see if driver supports a device. More...
|
| |
| static int | efipci_exclude (EFI_HANDLE device) |
| | Exclude existing drivers. More...
|
| |
| static int | efipci_start (struct efi_device *efidev) |
| | Attach driver to device. More...
|
| |
| static void | efipci_stop (struct efi_device *efidev) |
| | Detach driver from device. More...
|
| |
| struct efi_driver efipci_driver | __efi_driver (EFI_DRIVER_HARDWARE) |
| | EFI PCI driver. More...
|
| |
iPXE PCI I/O API for EFI
Definition in file efi_pci.c.
Find closest bus:dev.fn address range within a root bridge.
- Parameters
-
| pci | Starting PCI device |
| handle | EFI PCI root bridge handle |
| range | PCI bus:dev.fn address range to fill in |
- Return values
-
Definition at line 74 of file efi_pci.c.
96 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot open %s: %s\n",
103 if ( ( efirc =
root->Configuration (
root, &
acpi.raw ) ) != 0 ) {
105 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration for " 128 DBGC2 ( pci,
"EFIPCI " PCI_FMT " found %04x:[%02x-%02x] via " uint32_t start
Starting bus:dev.fn address.
#define PCI_BUS(busdevfn)
struct arbelprm_rc_send_wqe rc
struct pci_range range
PCI bus:dev.fn address range.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct stp_switch root
Root switch.
#define ACPI_QWORD_ADDRESS_SPACE_RESOURCE
An ACPI QWORD address space resource descriptor.
static union acpi_resource * acpi_resource_next(union acpi_resource *res)
Get next ACPI resource descriptor.
uint32_t start
Starting offset.
static unsigned int acpi_resource_tag(union acpi_resource *res)
Get ACPI resource tag.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
static unsigned int count
Number of entries.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
#define ACPI_ADDRESS_TYPE_BUS
A bus number address space type.
#define PCI_BUSDEVFN(segment, bus, slot, func)
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
#define ACPI_END_RESOURCE
An ACPI end resource descriptor.
An ACPI resource descriptor.
unsigned int count
Number of bus:dev.fn addresses within this range.
Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are used to abstract acces...
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
EFI_GUID efi_pci_root_bridge_io_protocol_guid
PCI root bridge I/O protocol GUID.
#define le64_to_cpu(value)
uint64_t tag
Identity tag.
References acpi, ACPI_ADDRESS_TYPE_BUS, ACPI_END_RESOURCE, ACPI_QWORD_ADDRESS_SPACE_RESOURCE, acpi_resource_next(), acpi_resource_tag(), pci_device::busdevfn, pci_range::count, count, DBGC, DBGC2, EEFI, efi_handle_name(), efi_open, efi_pci_root_bridge_io_protocol_guid, handle, index, le64_to_cpu, PCI_ARGS, PCI_BUS, PCI_BUSDEVFN, PCI_FMT, range, raw, rc, root, start, pci_range::start, strerror(), and tag.
Referenced by efipci_discover_any().
Find closest bus:dev.fn address range within any root bridge.
- Parameters
-
| pci | Starting PCI device |
| range | PCI bus:dev.fn address range to fill in |
| handle | PCI root bridge I/O handle to fill in |
- Return values
-
Definition at line 165 of file efi_pci.c.
186 NULL, &num_handles, &handles ) ) != 0 ) {
188 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot locate root bridges: " 194 for ( i = 0 ; i < num_handles ; i++ ) {
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
uint32_t start
Starting bus:dev.fn address.
struct arbelprm_rc_send_wqe rc
struct pci_range range
PCI bus:dev.fn address range.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
#define ENOENT
No such file or directory.
A PCI bus:dev.fn address range.
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
UINT64 UINTN
Unsigned value of native width.
unsigned int count
Number of bus:dev.fn addresses within this range.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
EFI_GUID efi_pci_root_bridge_io_protocol_guid
PCI root bridge I/O protocol GUID.
static int efipci_discover_one(struct pci_device *pci, EFI_HANDLE handle, struct pci_range *range)
Find closest bus:dev.fn address range within a root bridge.
Retrieve the set of handles from the handle database that support a specified protocol.
EFI_SYSTEM_TABLE * efi_systab
#define NULL
NULL pointer (VOID *)
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
References EFI_SYSTEM_TABLE::BootServices, pci_device::busdevfn, ByProtocol, pci_range::count, DBGC, EEFI, efi_pci_root_bridge_io_protocol_guid, efi_systab, efipci_discover_one(), ENOENT, EFI_BOOT_SERVICES::FreePool, handle, index, EFI_BOOT_SERVICES::LocateHandleBuffer, NULL, PCI_ARGS, PCI_FMT, range, rc, pci_range::start, strerror(), and tmp.
Referenced by efipci_discover(), and efipci_root_open().
Open EFI PCI root bridge I/O protocol for ephemeral use.
- Parameters
-
- Return values
-
| handle | EFI PCI root bridge handle |
| root | EFI PCI root bridge I/O protocol, or NULL if not found |
| rc | Return status code |
Definition at line 255 of file efi_pci.c.
267 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot open %s: %s\n",
struct arbelprm_rc_send_wqe rc
struct stp_switch root
Root switch.
static int efipci_discover_any(struct pci_device *pci, struct pci_range *range, EFI_HANDLE *handle)
Find closest bus:dev.fn address range within any root bridge.
A PCI bus:dev.fn address range.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
#define PCI_ARGS(pci)
PCI device debug message arguments.
EFI_GUID efi_pci_root_bridge_io_protocol_guid
PCI root bridge I/O protocol GUID.
References DBGC, efi_handle_name(), efi_open, efi_pci_root_bridge_io_protocol_guid, efipci_discover_any(), handle, PCI_ARGS, PCI_FMT, rc, root, strerror(), and tmp.
Referenced by efipci_ioremap(), efipci_read(), and efipci_write().
| int efipci_read |
( |
struct pci_device * |
pci, |
|
|
unsigned long |
location, |
|
|
void * |
value |
|
) |
| |
Read from PCI configuration space.
- Parameters
-
| pci | PCI device |
| location | Encoded offset and width |
- Return values
-
| value | Value |
| rc | Return status code |
Definition at line 300 of file efi_pci.c.
316 DBGC ( pci,
"EFIPCI " PCI_FMT " config read from offset %02lx " struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct stp_switch root
Root switch.
static int efipci_root_open(struct pci_device *pci, EFI_HANDLE *handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **root)
Open EFI PCI root bridge I/O protocol for ephemeral use.
#define EFIPCI_OFFSET(_location)
pseudo_bit_t value[0x00020]
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are used to abstract acces...
#define EFIPCI_WIDTH(_location)
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
static unsigned long efipci_address(struct pci_device *pci, unsigned long location)
Calculate EFI PCI configuration space address.
References DBGC, EEFI, efipci_address(), EFIPCI_OFFSET, efipci_root_open(), EFIPCI_WIDTH, handle, PCI_ARGS, PCI_FMT, rc, root, strerror(), and value.
| int efipci_write |
( |
struct pci_device * |
pci, |
|
|
unsigned long |
location, |
|
|
unsigned long |
value |
|
) |
| |
Write to PCI configuration space.
- Parameters
-
| pci | PCI device |
| location | Encoded offset and width |
| value | Value |
- Return values
-
Definition at line 333 of file efi_pci.c.
349 DBGC ( pci,
"EFIPCI " PCI_FMT " config write to offset %02lx " struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct stp_switch root
Root switch.
static int efipci_root_open(struct pci_device *pci, EFI_HANDLE *handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **root)
Open EFI PCI root bridge I/O protocol for ephemeral use.
#define EFIPCI_OFFSET(_location)
pseudo_bit_t value[0x00020]
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are used to abstract acces...
#define EFIPCI_WIDTH(_location)
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
static unsigned long efipci_address(struct pci_device *pci, unsigned long location)
Calculate EFI PCI configuration space address.
References DBGC, EEFI, efipci_address(), EFIPCI_OFFSET, efipci_root_open(), EFIPCI_WIDTH, handle, PCI_ARGS, PCI_FMT, rc, root, strerror(), and value.
| void* efipci_ioremap |
( |
struct pci_device * |
pci, |
|
|
unsigned long |
bus_addr, |
|
|
size_t |
len |
|
) |
| |
Map PCI bus address as an I/O address.
- Parameters
-
| bus_addr | PCI bus address |
| len | Length of region |
- Return values
-
| io_addr | I/O address, or NULL on error |
Definition at line 365 of file efi_pci.c.
385 if ( ( efirc =
root->Configuration (
root, &
u.raw ) ) != 0 ) {
387 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration: " 406 DBGC2 ( pci,
"EFIPCI " PCI_FMT " found range [%08llx,%08llx) " 420 DBGC ( pci,
"EFIPCI " PCI_FMT " %08lx+%zx is not within " 421 "root bridge address space\n",
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct stp_switch root
Root switch.
static int efipci_root_open(struct pci_device *pci, EFI_HANDLE *handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **root)
Open EFI PCI root bridge I/O protocol for ephemeral use.
#define ACPI_QWORD_ADDRESS_SPACE_RESOURCE
An ACPI QWORD address space resource descriptor.
unsigned long long uint64_t
static __always_inline void unsigned long bus_addr
static union acpi_resource * acpi_resource_next(union acpi_resource *res)
Get next ACPI resource descriptor.
uint32_t start
Starting offset.
static unsigned int acpi_resource_tag(union acpi_resource *res)
Get ACPI resource tag.
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
#define ACPI_END_RESOURCE
An ACPI end resource descriptor.
An ACPI resource descriptor.
Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are used to abstract acces...
#define ACPI_ADDRESS_TYPE_MEM
A memory address space type.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
uint32_t end
Ending offset.
uint16_t offset
Offset to command line.
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
#define le64_to_cpu(value)
uint64_t tag
Identity tag.
References ACPI_ADDRESS_TYPE_MEM, ACPI_END_RESOURCE, ACPI_QWORD_ADDRESS_SPACE_RESOURCE, acpi_resource_next(), acpi_resource_tag(), bus_addr, DBGC, DBGC2, EEFI, efipci_root_open(), end, handle, ioremap(), le64_to_cpu, len, offset, PCI_ARGS, PCI_FMT, raw, rc, root, start, strerror(), tag, and u.
Map buffer for DMA.
- Parameters
-
| dma | DMA device |
| map | DMA mapping to fill in |
| addr | Buffer address |
| len | Length of buffer |
| flags | Mapping flags |
- Return values
-
Definition at line 458 of file efi_pci.c.
495 &mapping ) ) != 0 ) {
497 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot map %p+%zx: " 513 DBGC ( pci,
"EFIPCI " PCI_FMT " attempted split mapping for " 531 pci_io->
Unmap ( pci_io, mapping );
struct arbelprm_rc_send_wqe rc
#define DMA_TX
Device will read data from host memory.
struct dma_device dma
DMA device.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct dma_device * dma
DMA device (if unmapping is required)
struct pci_device pci
PCI device.
A read operation from system memory by a bus master.
#define DMA_RX
Device will write data to host memory.
EFI_PCI_IO_PROTOCOL_MAP Map
UINT64 EFI_PHYSICAL_ADDRESS
64-bit physical memory address.
#define ENOTSUP
Operation not supported.
static signed char phys[4]
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
static unsigned int count
Number of entries.
EFI_PCI_IO_PROTOCOL_UNMAP Unmap
char * strerror(int errno)
Retrieve string representation of error number.
physaddr_t offset
Address offset.
#define PCI_FMT
PCI device debug message format.
uint32_t addr
Buffer address.
UINT64 UINTN
Unsigned value of native width.
Provides both read and write access to system memory by both the processor and a bus master.
#define VOID
Undeclared type.
EFI_PCI_IO_PROTOCOL_OPERATION
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
static uint16_t struct vmbus_xfer_pages_operations * op
static __always_inline int struct dma_mapping * map
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
void * token
Platform mapping token.
#define PCI_ARGS(pci)
PCI device debug message arguments.
A write operation from system memory by a bus master.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
References addr, assert(), bus, container_of, count, DBG_LOG, DBGC, dma_mapping::dma, pci_device::dma, dma(), DMA_RX, DMA_TX, EEFI, EfiPciIoOperationBusMasterCommonBuffer, EfiPciIoOperationBusMasterRead, EfiPciIoOperationBusMasterWrite, ENOTSUP, flags, efi_pci_device::io, len, map, _EFI_PCI_IO_PROTOCOL::Map, NULL, dma_mapping::offset, op, efi_pci_device::pci, PCI_ARGS, PCI_FMT, phys, rc, strerror(), dma_mapping::token, _EFI_PCI_IO_PROTOCOL::Unmap, and VOID.
Referenced by efipci_dma_alloc().
Allocate and map DMA-coherent buffer.
- Parameters
-
| dma | DMA device |
| map | DMA mapping to fill in |
| len | Length of buffer |
| align | Physical alignment |
- Return values
-
| addr | Buffer address, or NULL on error |
Definition at line 572 of file efi_pci.c.
590 &
addr, 0 ) ) != 0 ) {
592 DBGC ( pci,
"EFIPCI " PCI_FMT " could not allocate %zd bytes: "
struct arbelprm_rc_send_wqe rc
struct dma_device dma
DMA device.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static int efipci_dma_map(struct dma_device *dma, struct dma_mapping *map, void *addr, size_t len, int flags)
Map buffer for DMA.
struct pci_device pci
PCI device.
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer
#define DMA_BI
Device will both read data from and write data to host memory.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
uint32_t addr
Buffer address.
#define VOID
Undeclared type.
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
static __always_inline int struct dma_mapping * map
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
Allocate any available range of pages that satisfies the request.
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer
static void efipci_dma_unmap(struct dma_device *dma, struct dma_mapping *map, size_t len __unused)
Unmap buffer.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
void * memset(void *dest, int character, size_t len) __nonnull
References addr, AllocateAnyPages, _EFI_PCI_IO_PROTOCOL::AllocateBuffer, container_of, DBG_LOG, DBGC, pci_device::dma, dma(), DMA_BI, EEFI, EFI_PAGE_SIZE, EfiBootServicesData, efipci_dma_map(), efipci_dma_unmap(), _EFI_PCI_IO_PROTOCOL::FreeBuffer, efi_pci_device::io, len, map, memset(), NULL, efi_pci_device::pci, PCI_ARGS, PCI_FMT, rc, strerror(), and VOID.
Set addressable space mask.
- Parameters
-
| dma | DMA device |
| mask | Addressable space mask |
Definition at line 653 of file efi_pci.c.
665 is64 = ( ( ( (
uint64_t ) mask ) + 1 ) == 0 );
671 DBGC ( pci,
"EFIPCI " PCI_FMT " could not %sable DAC: %s\n",
672 PCI_ARGS ( pci ), ( is64 ?
"en" :
"dis" ),
struct arbelprm_rc_send_wqe rc
struct dma_device dma
DMA device.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct pci_device pci
PCI device.
unsigned long long uint64_t
#define container_of(ptr, type, field)
Get containing structure.
EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE
Clear for PCI controllers that can not genrate a DAC.
Disable the attributes specified by the bits that are set in Attributes for this PCI controller.
unsigned long long UINT64
Enable the attributes specified by the bits that are set in Attributes for this PCI controller.
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
static uint16_t struct vmbus_xfer_pages_operations * op
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
References _EFI_PCI_IO_PROTOCOL::Attributes, container_of, DBGC, pci_device::dma, dma(), EEFI, EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE, EfiPciIoAttributeOperationDisable, EfiPciIoAttributeOperationEnable, efi_pci_device::io, NULL, op, efi_pci_device::pci, PCI_ARGS, PCI_FMT, rc, and strerror().
Get EFI PCI device information.
- Parameters
-
| device | EFI device handle |
| efipci | EFI PCI device to fill in |
- Return values
-
Definition at line 704 of file efi_pci.c.
706 UINTN pci_segment, pci_bus, pci_dev, pci_fn;
714 DBGCP (
device,
"EFIPCI %s cannot open PCI protocols: %s\n",
721 if ( ( efirc = pci_io->
GetLocation ( pci_io, &pci_segment, &pci_bus,
722 &pci_dev, &pci_fn ) ) != 0 ) {
724 DBGC (
device,
"EFIPCI %s could not get PCI location: %s\n",
750 "configuration: %s\n",
struct arbelprm_rc_send_wqe rc
struct dma_device dma
DMA device.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct pci_device pci
PCI device.
EFI_GUID efi_pci_io_protocol_guid
PCI I/O protocol GUID.
uint16_t busdevfn
PCI bus:dev.fn address.
#define EFI_PCI_IO_ATTRIBUTE_MEMORY
Enable the Memory decode bit in the PCI Config Header.
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes
EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER
Enable the DMA bit in the PCI Config Header.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
#define PCI_BUSDEVFN(segment, bus, slot, func)
char * strerror(int errno)
Retrieve string representation of error number.
#define PCI_FMT
PCI device debug message format.
int pci_read_config(struct pci_device *pci)
Read PCI device configuration.
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
UINT64 UINTN
Unsigned value of native width.
#define EFI_PCI_IO_ATTRIBUTE_IO
Enable the I/O decode bit in the PCI Config Header.
Enable the attributes specified by the bits that are set in Attributes for this PCI controller.
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
static __always_inline void dma_init(struct dma_device *dma, struct dma_operations *op)
Initialise DMA device.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
static struct dma_operations efipci_dma_operations
EFI PCI DMA operations.
static void pci_init(struct pci_device *pci, unsigned int busdevfn)
Initialise PCI device.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
References _EFI_PCI_IO_PROTOCOL::Attributes, busdevfn, DBGC, DBGCP, pci_device::dma, dma_init(), EEFI, efi_handle_name(), efi_open, EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, EFI_PCI_IO_ATTRIBUTE_IO, EFI_PCI_IO_ATTRIBUTE_MEMORY, efi_pci_io_protocol_guid, efipci_dma_operations, EfiPciIoAttributeOperationEnable, _EFI_PCI_IO_PROTOCOL::GetLocation, efi_pci_device::io, NULL, efi_pci_device::pci, PCI_ARGS, PCI_BUSDEVFN, PCI_FMT, pci_init(), pci_read_config(), rc, and strerror().
Referenced by efi_bofm_start(), efi_bofm_supported(), efi_device_info_pci(), efipci_start(), and efipci_supported().
Check to see if driver supports a device.
- Parameters
-
- Return values
-
Definition at line 771 of file efi_pci.c.
781 hdrtype = efipci.pci.hdrtype;
792 "has no driver\n",
PCI_ARGS ( &efipci.pci ),
793 efipci.pci.vendor, efipci.pci.device,
798 "\"%s\"\n",
PCI_ARGS ( &efipci.pci ), efipci.pci.vendor,
799 efipci.pci.device, efipci.pci.class, efipci.pci.id->name );
struct arbelprm_rc_send_wqe rc
int efipci_info(EFI_HANDLE device, struct efi_pci_device *efipci)
Get EFI PCI device information.
int pci_find_driver(struct pci_device *pci)
Find driver for PCI device.
#define PCI_HEADER_TYPE_MASK
Header type mask.
#define PCI_HEADER_TYPE_NORMAL
Normal header.
#define PCI_FMT
PCI device debug message format.
#define ENOTTY
Inappropriate I/O control operation.
#define PCI_ARGS(pci)
PCI device debug message arguments.
References pci_device::class, DBGC, pci_device::device, efipci_info(), ENOTTY, pci_device::hdrtype, pci_device::id, pci_device_id::name, efi_pci_device::pci, PCI_ARGS, pci_find_driver(), PCI_FMT, PCI_HEADER_TYPE_MASK, PCI_HEADER_TYPE_NORMAL, rc, and pci_device::vendor.
| static int efipci_start |
( |
struct efi_device * |
efidev | ) |
|
|
static |
Attach driver to device.
- Parameters
-
- Return values
-
Definition at line 830 of file efi_pci.c.
836 efipci =
zalloc (
sizeof ( *efipci ) );
848 &efipci->
io ) ) != 0 ) {
849 DBGC (
device,
"EFIPCI %s could not open PCI device: %s\n",
859 goto err_find_driver;
struct arbelprm_rc_send_wqe rc
int efipci_info(EFI_HANDLE device, struct efi_pci_device *efipci)
Get EFI PCI device information.
int pci_find_driver(struct pci_device *pci)
Find driver for PCI device.
struct pci_device pci
PCI device.
#define list_add(new, head)
Add a new entry to the head of a list.
EFI_GUID efi_pci_io_protocol_guid
PCI I/O protocol GUID.
#define DBGC_EFI_OPENERS(...)
EFI_HANDLE device
EFI device handle.
struct device * parent
Bus device.
struct device dev
Generic device.
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
void efi_close_by_driver(EFI_HANDLE handle, EFI_GUID *protocol)
Close protocol opened for persistent use by a driver.
#define efi_open_by_driver(handle, protocol, interface)
Open protocol for persistent use by a driver.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
#define PCI_FMT
PCI device debug message format.
struct list_head siblings
Devices on the same bus.
void pci_remove(struct pci_device *pci)
Remove a PCI device.
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
struct list_head children
Devices attached to this device.
#define PCI_ARGS(pci)
PCI device debug message arguments.
struct pci_device_id * id
Driver device ID.
static void efidev_set_drvdata(struct efi_device *efidev, void *priv)
Set EFI driver-private data.
struct device dev
Generic device.
int pci_probe(struct pci_device *pci)
Probe a PCI device.
References device::children, DBGC, DBGC_EFI_OPENERS, efi_device::dev, pci_device::dev, efi_device::device, efi_close_by_driver(), efi_handle_name(), efi_open_by_driver, efi_pci_io_protocol_guid, efidev_set_drvdata(), efipci_info(), ENOMEM, free, pci_device::id, efi_pci_device::io, list_add, list_del, pci_device_id::name, device::parent, efi_pci_device::pci, PCI_ARGS, pci_find_driver(), PCI_FMT, pci_probe(), pci_remove(), rc, device::siblings, strerror(), and zalloc().
| static void efipci_stop |
( |
struct efi_device * |
efidev | ) |
|
|
static |
Detach driver from device.
- Parameters
-
Definition at line 896 of file efi_pci.c.
struct dma_device dma
DMA device.
struct pci_device pci
PCI device.
EFI_GUID efi_pci_io_protocol_guid
PCI I/O protocol GUID.
EFI_HANDLE device
EFI device handle.
struct device dev
Generic device.
#define list_del(list)
Delete an entry from a list.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void efi_close_by_driver(EFI_HANDLE handle, EFI_GUID *protocol)
Close protocol opened for persistent use by a driver.
static void(* free)(struct refcnt *refcnt))
struct list_head siblings
Devices on the same bus.
static void * efidev_get_drvdata(struct efi_device *efidev)
Get EFI driver-private data.
void pci_remove(struct pci_device *pci)
Remove a PCI device.
unsigned int mapped
Total number of mappings (for debugging)
unsigned int allocated
Total number of allocations (for debugging)
References dma_device::allocated, assert(), pci_device::dev, efi_device::device, pci_device::dma, efi_close_by_driver(), efi_pci_io_protocol_guid, efidev_get_drvdata(), free, list_del, dma_device::mapped, efi_pci_device::pci, pci_remove(), and device::siblings.