WKern
Loading...
Searching...
No Matches
pci.h File Reference
#include <types/nums.h>

Go to the source code of this file.

Macros

#define PCI_INTERRUPT_LINE   0x3C

Functions

u32 FindVirtionetDev ()
 Search for VirtNet Device.
u32 PciConfigRead (u8 bus, u8 slot, u8 func, u8 offset)
 Reads a 32-bit value from PCI configuration space.

Variables

u32 bar0
u8 virtio_bus
u8 virtio_slot
u8 virtio_func
u8 virtio_irq

Macro Definition Documentation

◆ PCI_INTERRUPT_LINE

#define PCI_INTERRUPT_LINE   0x3C

Definition at line 22 of file pci.h.

Function Documentation

◆ FindVirtionetDev()

u32 FindVirtionetDev ( )

Search for VirtNet Device.

Returns
NULL

Definition at line 59 of file scconfig.c.

◆ PciConfigRead()

u32 PciConfigRead ( u8 bus,
u8 slot,
u8 func,
u8 offset )

Reads a 32-bit value from PCI configuration space.

This function constructs a configuration address based on the given PCI bus, slot (device), function, and offset, and reads the corresponding 32-bit value from the PCI configuration space using I/O ports.

The offset must be aligned to a 4-byte boundary (i.e., bits 1 and 0 are masked out).

Parameters
busPCI bus number (0–255).
slotPCI device number (0–31).
funcPCI function number (0–7).
offsetOffset into the configuration space (must be 4-byte aligned).
Returns
32-bit value read from the PCI configuration register.

Definition at line 48 of file scconfig.c.

Variable Documentation

◆ bar0

u32 bar0
extern

Definition at line 30 of file scconfig.c.

◆ virtio_bus

u8 virtio_bus
extern

Definition at line 26 of file scconfig.c.

◆ virtio_func

u8 virtio_func
extern

Definition at line 28 of file scconfig.c.

◆ virtio_irq

u8 virtio_irq
extern

Definition at line 25 of file scconfig.c.

◆ virtio_slot

u8 virtio_slot
extern

Definition at line 27 of file scconfig.c.