The GT library provides access to the GT chip's PCI functionality. It allows you to access the configuration registers and also handles demultiplexing interrupts. You shouldn't need to directly use libgt, the provided code should take care of it.
struct chipset * gt_init(host_handle_t host)
gt_init
initalises the state of the gt driver and
returns a handle to the driver. For your uses the host argument can
be NULL.
For various reasons (this code is used in other projects), rather than directly calling GT functions, they should all be accessed through a function pointer table. This is like invoking methods on an object in object-oriented programming languages.
void conf_write_<n>(void *pvt, int bus, int device, int
function, int register_num, uint<n>);
There are versions of this function for n = 8, 16, or 32. This function will write a value to a specific PCI configuration register.
void conf_read_<n>(void *pvt, int bus, int device, int
function, int register_num, uint<n>);
There are versions of this function for n = 8, 16, or 32. This function will read a value to a specific PCI configuration register.
bus_space_t pci_iospace_map(void *pvt, bus_addr_t addr,
uintptr_t size, int flags);
This function will map a section of PCI memory into the address space and provide a handle to it.
int pci_register_interrupt(void *pvt, int irq,
exec_handle_t handler);
This function registers a handler for a given PCI interrupt.