kernel/misc/pci.c
/**
 * @brief Read from a PCI device configuration space field.
 */
@brief Read from a PCI device configuration space field.
@brief Read from a PCI device configuration space field .
uint32_t pci_read_field(uint32_t device, int field, int size) {
	outportl(PCI_ADDRESS_PORT, pci_get_addr(device, field));
	if (size == 4) {
		uint32_t t = inportl(PCI_VALUE_PORT);
		return t;
	} else if (size == 2) {
		uint16_t t = inports(PCI_VALUE_PORT + (field & 2));
		return t;
	} else if (size == 1) {
		uint8_t t = inportb(PCI_VALUE_PORT + (field & 3));
		return t;
	}
	return 0xFFFF;
}
uint32_t pci_read_field ( uint32_t device , int field , int size ) { outportl ( PCI_ADDRESS_PORT , pci_get_addr ( device , field ) ) ; if ( size == 4 ) { uint32_t t = inportl ( PCI_VALUE_PORT ) ; return t ; } else if ( size == 2 ) { uint16_t t = inports ( PCI_VALUE_PORT + ( field & 2 ) ) ; return t ; } else if ( size == 1 ) { uint8_t t = inportb ( PCI_VALUE_PORT + ( field & 3 ) ) ; return t ; } return 0xFFFF ; }
@brief Read from a PCI device configuration space field.
@brief Read from a PCI device configuration space field .