module metal.pci

Code Map

module metal.pci;


enum CapNames;

enum Offset
{
	VENDOR,
	DEVICE,
	CLASS,
	SUBCLASS,
	HEADER,
	SECONDARY_BUS,
	CAPABILITY_LIST,
}

enum CapId
{
	PM,
	AGP,
	VPD,
	SLOT_ID,
	MSI,
	CHSWP,
	PCIX,
	HT,
	VNDR,
	DBG,
	CCRC,
	SHPC,
	SSVID,
	AGP3,
	SECDEV,
	EXP,
	MSIX,
	SATA,
	AF,
	EA,
}

enum CapOffset
{
	LIST_ID,
	LIST_NEXT,
	FLAGS,
	SIZEOF,
}

struct Header
{
public:
	vendor: u16;
	device: u16;
	command: u16;
	status: u16;
	rev: u8;
	progIF: u8;
	subClass: u8;
	baseClass: u8;
	cacheLineSize: u8;
	latencyTimer: u8;
	headerType: u8;
	BIST: u8;
}

struct Device
{
public:
	bus: u8;
	slot: u8;
	func: u8;
	headerType: u8;
	vendor: u16;
	device: u16;
	rev: u8;
	progIF: u8;
	subClass: u8;
	baseClass: u8;
	cap: u32;
}

struct Info
{
public:
	devs: Device[256];
	num: u32;
}

global info: Info;

fn loadDevice(dev: Device*) { }
fn isValidDevice(bus: u8, slot: u8, func: u8) bool { }
fn checkFunction(bus: u8, slot: u8, func: u8) { }
fn checkDevice(bus: u8, slot: u8) { }
fn checkBus(bus: u8) { }
fn checkAllBuses() { }
fn readHeader(bus: u8, slot: u8, func: u8, h: Header) { }
fn readU32(bus: u8, slot: u8, func: u8, offset: u8) u32 { }
fn readU16(bus: u8, slot: u8, func: u8, offset: u8) u16 { }
fn readU8(bus: u8, slot: u8, func: u8, offset: u8) u8 { }
fn dumpDevices() { }