|
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
|
static int | efipci_root_match (struct pci_device *pci, EFI_HANDLE handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *root) |
| Check for a matching PCI root bridge I/O protocol. 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_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.
Check for a matching PCI root bridge I/O protocol.
- Parameters
-
pci | PCI device |
handle | EFI PCI root bridge handle |
root | EFI PCI root bridge I/O protocol |
- Return values
-
Definition at line 73 of file efi_pci.c.
92 if ( ( efirc =
root->Configuration (
root, &
u.raw ) ) != 0 ) {
94 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration for " #define PCI_BUS(busdevfn)
uint16_t segment
Code segment.
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.
#define ENOENT
No such file or directory.
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.
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.
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.
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.
uint32_t end
Ending offset.
#define le64_to_cpu(value)
uint64_t tag
Identity tag.
#define PCI_SEG(busdevfn)
References ACPI_ADDRESS_TYPE_BUS, ACPI_END_RESOURCE, ACPI_QWORD_ADDRESS_SPACE_RESOURCE, acpi_resource_next(), acpi_resource_tag(), bus, pci_device::busdevfn, DBGC, EEFI, efi_handle_name(), end, ENOENT, handle, le64_to_cpu, PCI_ARGS, PCI_BUS, PCI_FMT, PCI_SEG, raw, rc, root, segment, start, strerror(), tag, and u.
Referenced by 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 137 of file efi_pci.c.
153 NULL, &num_handles, &handles ) ) != 0 ) {
155 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot locate root bridges: " 161 for ( i = 0 ; i < num_handles ; i++ ) {
168 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot open %s: %s\n",
182 DBGC ( pci,
"EFIPCI " PCI_FMT " found no root bridge\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.
#define ENOENT
No such file or directory.
EFI_CLOSE_PROTOCOL CloseProtocol
static int efipci_root_match(struct pci_device *pci, EFI_HANDLE handle, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *root)
Check for a matching PCI root bridge I/O protocol.
#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.
UINT64 UINTN
Unsigned value of native width.
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.
Retrieve the set of handles from the handle database that support a specified protocol.
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
#define NULL
NULL pointer (VOID *)
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
References EFI_SYSTEM_TABLE::BootServices, ByProtocol, EFI_BOOT_SERVICES::CloseProtocol, DBGC, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_pci_root_bridge_io_protocol_guid, efi_systab, efipci_root_match(), ENOENT, EFI_BOOT_SERVICES::FreePool, handle, EFI_BOOT_SERVICES::LocateHandleBuffer, NULL, EFI_BOOT_SERVICES::OpenProtocol, PCI_ARGS, PCI_FMT, rc, root, strerror(), 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 228 of file efi_pci.c.
244 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 264 of file efi_pci.c.
280 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 299 of file efi_pci.c.
319 if ( ( efirc =
root->Configuration (
root, &
u.raw ) ) != 0 ) {
321 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot get configuration: " 340 DBGC2 ( pci,
"EFIPCI " PCI_FMT " found range [%08llx,%08llx) " 354 DBGC ( pci,
"EFIPCI " PCI_FMT " %08lx+%zx is not within " 355 "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 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 userptr_t size_t offset
Offset of the first segment within the content.
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.
void * ioremap(unsigned long bus_addr, size_t len)
Map bus address as an I/O address.
#define le64_to_cpu(value)
static __always_inline void unsigned long bus_addr
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 391 of file efi_pci.c.
428 DBGC ( pci,
"EFIPCI " PCI_FMT " cannot map %08lx+%zx: " 444 DBGC ( pci,
"EFIPCI " PCI_FMT " attempted split mapping for " 462 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.
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.
uint16_t count
Number of entries.
#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 502 of file efi_pci.c.
520 &
addr, 0 ) ) != 0 ) {
522 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 557 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 616 of file efi_pci.c.
628 is64 = ( ( ( (
uint64_t ) mask ) + 1 ) == 0 );
634 DBGC ( pci,
"EFIPCI " PCI_FMT " could not %sable DAC: %s\n",
635 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 668 of file efi_pci.c.
675 UINTN pci_segment, pci_bus, pci_dev, pci_fn;
683 device, attributes ) ) != 0 ) {
685 DBGCP (
device,
"EFIPCI %s cannot open PCI protocols: %s\n",
687 goto err_open_protocol;
689 efipci->
io = pci_io.pci_io;
692 if ( ( efirc = pci_io.pci_io->GetLocation ( pci_io.pci_io, &pci_segment,
696 DBGC (
device,
"EFIPCI %s could not get PCI location: %s\n",
698 goto err_get_location;
712 pci_io.pci_io->Attributes ( pci_io.pci_io,
715 pci_io.pci_io->Attributes ( pci_io.pci_io,
718 pci_io.pci_io->Attributes ( pci_io.pci_io,
725 "configuration: %s\n",
727 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 786 of file efi_pci.c.
796 hdrtype = efipci.pci.hdrtype;
807 "has no driver\n",
PCI_ARGS ( &efipci.pci ),
808 efipci.pci.vendor, efipci.pci.device,
813 "\"%s\"\n",
PCI_ARGS ( &efipci.pci ), efipci.pci.vendor,
814 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 825 of file efi_pci.c.
831 efipci =
zalloc (
sizeof ( *efipci ) );
841 DBGC (
device,
"EFIPCI %s could not open PCI device: %s\n",
851 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().