|
| 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. More...
|
|
static void | efipci_root_close (EFI_HANDLE handle) |
| Close EFI PCI root bridge I/O protocol. 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) |
|
static int | efipci_dma_map (struct dma_device *dma, struct dma_mapping *map, physaddr_t addr, size_t len, int flags) |
| Map buffer for DMA. More...
|
|
static void | efipci_dma_unmap (struct dma_device *dma, struct dma_mapping *map) |
| 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 userptr_t | efipci_dma_umalloc (struct dma_device *dma, struct dma_mapping *map, size_t len, size_t align) |
| Allocate and map DMA-coherent buffer from external (user) memory. More...
|
|
static void | efipci_dma_ufree (struct dma_device *dma, struct dma_mapping *map, userptr_t addr, size_t len) |
| Unmap and free DMA-coherent buffer from external (user) memory. More...
|
|
static void | efipci_dma_set_mask (struct dma_device *dma, physaddr_t mask) |
| Set addressable space mask. More...
|
|
int | efipci_open (EFI_HANDLE device, UINT32 attributes, struct efi_pci_device *efipci) |
| Open EFI PCI device. More...
|
|
void | efipci_close (EFI_HANDLE device) |
| Close EFI PCI device. 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_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_NORMAL) |
| 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 73 of file efi_pci.c.
102 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot open %s: %s\n",
109 if ( ( efirc =
root.root->Configuration (
root.root,
110 &
acpi.raw ) ) != 0 ) {
112 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration for " 135 DBGC2 ( pci,
"EFIPCI " PCI_FMT " found %04x:[%02x-%02x] via " EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
uint32_t start
Starting bus:dev.fn address.
#define PCI_BUS(busdevfn)
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.
#define ACPI_QWORD_ADDRESS_SPACE_RESOURCE
An ACPI QWORD address space resource descriptor.
EFI_CLOSE_PROTOCOL CloseProtocol
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.
uint16_t count
Number of entries.
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
static __always_inline void struct pci_range * range
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.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
#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.
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
#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(), EFI_SYSTEM_TABLE::BootServices, pci_device::busdevfn, EFI_BOOT_SERVICES::CloseProtocol, count, pci_range::count, DBGC, DBGC2, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_pci_root_bridge_io_protocol_guid, efi_systab, handle, index, le64_to_cpu, EFI_BOOT_SERVICES::OpenProtocol, 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 180 of file efi_pci.c.
201 NULL, &num_handles, &handles ) ) != 0 ) {
203 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot locate root bridges: " 209 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
#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.
static __always_inline void struct pci_range * 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.
- 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 270 of file efi_pci.c.
291 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot open %s: %s\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
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_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.
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
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.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are used to abstract acces...
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.
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
References EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_pci_root_bridge_io_protocol_guid, efi_systab, efipci_discover_any(), handle, EFI_BOOT_SERVICES::OpenProtocol, PCI_ARGS, PCI_FMT, rc, root, strerror(), tmp, and u.
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 340 of file efi_pci.c.
356 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.
static void efipci_root_close(EFI_HANDLE handle)
Close EFI PCI root bridge I/O protocol.
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.
#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_close(), 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 376 of file efi_pci.c.
392 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.
static void efipci_root_close(EFI_HANDLE handle)
Close EFI PCI root bridge I/O protocol.
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.
#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_close(), 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 411 of file efi_pci.c.
431 if ( ( efirc =
root->Configuration (
root, &
u.raw ) ) != 0 ) {
433 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration: " 452 DBGC2 ( pci,
"EFIPCI " PCI_FMT " found range [%08llx,%08llx) " 466 DBGC ( pci,
"EFIPCI " PCI_FMT " %08lx+%zx is not within " 467 "root bridge address space\n",
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void efipci_root_close(EFI_HANDLE handle)
Close EFI PCI root bridge I/O protocol.
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.
#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_close(), 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 504 of file efi_pci.c.
541 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot map %08lx+%zx: " 557 DBGC ( pci,
"EFIPCI " PCI_FMT " attempted split mapping for " 575 pci_io->
Unmap ( pci_io, mapping );
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 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.
EFI_PCI_IO_PROTOCOL_MAP Map
UINT64 EFI_PHYSICAL_ADDRESS
64-bit physical memory address.
#define ENOTSUP
Operation not supported.
static __always_inline void * phys_to_virt(unsigned long phys_addr)
Convert physical address to a virtual address.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
#define DMA_TX
Device will read data from host memory.
uint16_t 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.
UINT64 UINTN
Unsigned value of native width.
Provides both read and write access to system memory by both the processor and a bus master.
static __always_inline int struct dma_mapping * map
#define VOID
Undeclared type.
EFI_PCI_IO_PROTOCOL_OPERATION
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
#define DMA_RX
Device will write data to host memory.
static uint16_t struct vmbus_xfer_pages_operations * op
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.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
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_to_virt(), 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 615 of file efi_pci.c.
633 &
addr, 0 ) ) != 0 ) {
635 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.
struct pci_device pci
PCI device.
static int efipci_dma_map(struct dma_device *dma, struct dma_mapping *map, physaddr_t addr, size_t len, int flags)
Map buffer for DMA.
#define DMA_BI
Device will both read data from and write data to host memory.
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
static void efipci_dma_unmap(struct dma_device *dma, struct dma_mapping *map)
Unmap buffer.
#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.
static __always_inline int struct dma_mapping * map
#define VOID
Undeclared type.
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
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 __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
#define NULL
NULL pointer (VOID *)
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(), virt_to_phys(), and VOID.
Referenced by efipci_dma_umalloc().
Unmap and free DMA-coherent buffer.
- Parameters
-
dma | DMA device |
map | DMA mapping |
addr | Buffer address |
len | Length of buffer |
Definition at line 670 of file efi_pci.c.
struct dma_device dma
DMA device.
struct pci_device pci
PCI device.
static void efipci_dma_unmap(struct dma_device *dma, struct dma_mapping *map)
Unmap buffer.
#define container_of(ptr, type, field)
Get containing structure.
static __always_inline int struct dma_mapping * map
EFI_PCI_IO_PROTOCOL * io
PCI I/O protocol.
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration, and DMA interfaces used to...
References addr, container_of, DBG_LOG, pci_device::dma, dma(), EFI_PAGE_SIZE, efipci_dma_unmap(), _EFI_PCI_IO_PROTOCOL::FreeBuffer, efi_pci_device::io, len, map, and efi_pci_device::pci.
Referenced by efipci_dma_ufree().
Set addressable space mask.
- Parameters
-
dma | DMA device |
mask | Addressable space mask |
Definition at line 729 of file efi_pci.c.
741 is64 = ( ( ( (
uint64_t ) mask ) + 1 ) == 0 );
747 DBGC ( pci,
"EFIPCI " PCI_FMT " could not %sable DAC: %s\n",
748 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
uint32_t attrs
Extended attributes (optional)
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.
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
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, attrs, 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().
Open EFI PCI device.
- Parameters
-
device | EFI device handle |
attributes | Protocol opening attributes |
efipci | EFI PCI device to fill in |
- Return values
-
Definition at line 781 of file efi_pci.c.
788 UINTN pci_segment, pci_bus, pci_dev, pci_fn;
796 device, attributes ) ) != 0 ) {
798 DBGCP (
device,
"EFIPCI %s cannot open PCI protocols: %s\n",
800 goto err_open_protocol;
802 efipci->
io = pci_io.pci_io;
805 if ( ( efirc = pci_io.pci_io->GetLocation ( pci_io.pci_io, &pci_segment,
809 DBGC (
device,
"EFIPCI %s could not get PCI location: %s\n",
811 goto err_get_location;
825 pci_io.pci_io->Attributes ( pci_io.pci_io,
828 pci_io.pci_io->Attributes ( pci_io.pci_io,
831 pci_io.pci_io->Attributes ( pci_io.pci_io,
838 "configuration: %s\n",
840 goto err_pci_read_config;
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
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.
static __always_inline void dma_init(struct dma_device *dma, struct dma_operations *op)
Initialise DMA device.
EFI_CLOSE_PROTOCOL CloseProtocol
uint16_t busdevfn
PCI bus:dev.fn address.
#define EFI_PCI_IO_ATTRIBUTE_MEMORY
Enable the Memory decode bit in the PCI Config Header.
#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.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
int pci_read_config(struct pci_device *pci)
Read PCI device configuration.
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.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define PCI_ARGS(pci)
PCI device debug message arguments.
EFI_SYSTEM_TABLE * efi_systab
static struct dma_operations efipci_dma_operations
EFI PCI DMA operations.
EFI_OPEN_PROTOCOL OpenProtocol
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_SYSTEM_TABLE::BootServices, busdevfn, EFI_BOOT_SERVICES::CloseProtocol, DBGC, DBGCP, pci_device::dma, dma_init(), EEFI, EEFI_PCI, efi_handle_name(), efi_image_handle, EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, EFI_PCI_IO_ATTRIBUTE_IO, EFI_PCI_IO_ATTRIBUTE_MEMORY, efi_pci_io_protocol_guid, efi_systab, efipci_dma_operations, EfiPciIoAttributeOperationEnable, efi_pci_device::io, NULL, EFI_BOOT_SERVICES::OpenProtocol, efi_pci_device::pci, PCI_ARGS, PCI_BUSDEVFN, PCI_FMT, pci_init(), pci_read_config(), rc, and strerror().
Referenced by efi_bofm_start(), efipci_info(), and efipci_start().
Check to see if driver supports a device.
- Parameters
-
- Return values
-
Definition at line 899 of file efi_pci.c.
909 hdrtype = efipci.pci.hdrtype;
920 "has no driver\n",
PCI_ARGS ( &efipci.pci ),
921 efipci.pci.vendor, efipci.pci.device,
926 "\"%s\"\n",
PCI_ARGS ( &efipci.pci ), efipci.pci.vendor,
927 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 938 of file efi_pci.c.
944 efipci =
zalloc (
sizeof ( *efipci ) );
954 DBGC (
device,
"EFIPCI %s could not open PCI device: %s\n",
964 goto err_find_driver;
struct arbelprm_rc_send_wqe rc
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.
int efipci_open(EFI_HANDLE device, UINT32 attributes, struct efi_pci_device *efipci)
Open EFI PCI device.
#define EFI_OPEN_PROTOCOL_BY_DRIVER
#define EFI_OPEN_PROTOCOL_EXCLUSIVE
#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.
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.
void efipci_close(EFI_HANDLE device)
Close EFI PCI device.
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_handle_name(), EFI_OPEN_PROTOCOL_BY_DRIVER, EFI_OPEN_PROTOCOL_EXCLUSIVE, efi_pci_io_protocol_guid, efidev_set_drvdata(), efipci_close(), efipci_open(), ENOMEM, free, pci_device::id, 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().