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