]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - pci/pci-smm.c
add console.h
[netwatch.git] / pci / pci-smm.c
... / ...
CommitLineData
1#include <io.h>
2#include <inttypes.h>
3
4static void __pci_config(int bus, int slot, int fn, int addr)
5{
6 outl(0xCF8, 0x80000000ULL | (bus << 16) | (slot << 11) | (fn << 8) | addr);
7}
8
9void pci_write32(int bus, int slot, int fn, int addr, uint32_t data)
10{
11 __pci_config(bus, slot, fn, addr);
12 outl(0xCFC, data);
13}
14
15void pci_write16(int bus, int slot, int fn, int addr, uint16_t data)
16{
17 __pci_config(bus, slot, fn, addr);
18 outw(0xCFC, data);
19}
20
21void pci_write8(int bus, int slot, int fn, int addr, uint8_t data)
22{
23 __pci_config(bus, slot, fn, addr);
24 outb(0xCFC, data);
25}
26
27uint32_t pci_read32(int bus, int slot, int fn, int addr)
28{
29 __pci_config(bus, slot, fn, addr);
30 return inl(0xCFC);
31}
32
33uint16_t pci_read16(int bus, int slot, int fn, int addr)
34{
35 __pci_config(bus, slot, fn, addr);
36 return inw(0xCFC);
37}
38
39uint8_t pci_read8(int bus, int slot, int fn, int addr)
40{
41 __pci_config(bus, slot, fn, addr);
42 return inb(0xCFC);
43}
This page took 0.026543 seconds and 4 git commands to generate.