UEFIStarter
a simple UEFI framework
Data Structures | Functions
pci.h File Reference

Functions for accessing PCI devices. More...

#include <Uefi.h>
#include <Protocol/PciIo.h>
#include <IndustryStandard/Pci.h>
#include "core/logger.h"

Go to the source code of this file.

Data Structures

struct  pci_subclass_name_t
 data type for PCI device subclass names More...
 
struct  pci_class_names_t
 data type for PCI device class names More...
 

Functions

CHAR16 * find_pci_device_name (UINT16 vendor_id, UINT16 device_id, UINT16 subvendor_id, UINT16 subdevice_id)
 Looks up a PCI device's name by vendor ID and device ID. More...
 
CHAR16 * find_pci_class_name (UINT8 class_code[3])
 Finds a PCI class and subclass name by 3-byte class code. More...
 
void print_pci_devices ()
 Prints a short description of all connected PCI devices.
 
void print_known_pci_classes ()
 Prints a list of known PCI classes and subclasses. More...
 
EFI_PCI_IO_PROTOCOL * find_pci_device (UINT16 vendor_id, UINT16 device_id)
 Fetches a PCI device's protocol handle. More...
 
void init_pci_lib ()
 Initializes the PCI library. More...
 
void shutdown_pci_lib ()
 Shuts down the PCI library. More...
 

Detailed Description

Functions for accessing PCI devices.

Author
Richard Nusser
License
GPLv3 (see http://www.gnu.org/licenses/)
See also
https://github.com/rinusser/UEFIStarter

Function Documentation

◆ find_pci_device_name()

CHAR16* find_pci_device_name ( UINT16  vendor_id,
UINT16  device_id,
UINT16  subvendor_id,
UINT16  subdevice_id 
)

Looks up a PCI device's name by vendor ID and device ID.

Subvendor and subdevice IDs are not implemented yet, they will be ignored.

Parameters
vendor_idthe device's vendor ID
device_idthe device's device ID
subvendor_idignored
subdevice_idignored
Returns
the device's name, as UTF-16; returns "(unknown)" if the requested device wasn't found
Todo:
later: implement sub IDs.

◆ find_pci_class_name()

CHAR16* find_pci_class_name ( UINT8  class_code[3])

Finds a PCI class and subclass name by 3-byte class code.

Parameters
class_codethe PCI class code to look up
Returns
the class name; uses "unknown" to replace unhandled classes or subclasses

◆ print_known_pci_classes()

void print_known_pci_classes ( )

Prints a list of known PCI classes and subclasses.

This is mostly for debugging.

◆ find_pci_device()

EFI_PCI_IO_PROTOCOL* find_pci_device ( UINT16  vendor_id,
UINT16  device_id 
)

Fetches a PCI device's protocol handle.

This is currently the easiest way to access a specific PCI device.

Parameters
vendor_idthe device's vendor ID
device_idthe device's device ID
Returns
the protocol handle if the device was found, NULL otherwise

◆ init_pci_lib()

void init_pci_lib ( )

Initializes the PCI library.

Call this before using the other library functions.

◆ shutdown_pci_lib()

void shutdown_pci_lib ( )

Shuts down the PCI library.

Call this when you're done with PCI functions.