MonkOS  v0.1
A simple 64-bit operating system (x86_64)
pci.c File Reference

PCI controller. More...

#include <core.h>
#include <kernel/device/pci.h>
#include <kernel/device/tty.h>
#include <kernel/x86/cpu.h>

Go to the source code of this file.

Macros

#define DEBUG_PCI   1
 
#define PCI_CONFIG_ADDR   0x0cf8
 
#define PCI_CONFIG_DATA   0x0cfc
 

Functions

static uint32_t read (uint32_t bus, uint32_t device, uint32_t func, uint32_t offset)
 
static uint32_t read_hdrtype (uint32_t bus, uint32_t device, uint32_t func)
 
static uint32_t read_deviceid (uint32_t bus, uint32_t device, uint32_t func)
 
static uint32_t read_vendor (uint32_t bus, uint32_t device, uint32_t func)
 
static uint32_t read_class (uint32_t bus, uint32_t device, uint32_t func)
 
static uint32_t read_subclass (uint32_t bus, uint32_t device, uint32_t func)
 
static uint32_t read_secondary_bus (uint32_t bus, uint32_t device, uint32_t func)
 
static void probe_bus (uint32_t bus)
 
static bool probe_function (uint32_t bus, uint32_t device, uint32_t func)
 
static void probe_device (uint32_t bus, uint32_t device)
 
void pci_init ()
 

Detailed Description

PCI controller.

Definition in file pci.c.

Macro Definition Documentation

#define DEBUG_PCI   1

Definition at line 15 of file pci.c.

#define PCI_CONFIG_ADDR   0x0cf8

Definition at line 17 of file pci.c.

Referenced by read().

#define PCI_CONFIG_DATA   0x0cfc

Definition at line 18 of file pci.c.

Referenced by read().

Function Documentation

static uint32_t read ( uint32_t  bus,
uint32_t  device,
uint32_t  func,
uint32_t  offset 
)
inlinestatic
static uint32_t read_hdrtype ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 34 of file pci.c.

Referenced by pci_init(), and probe_device().

static uint32_t read_deviceid ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 41 of file pci.c.

Referenced by probe_function().

static uint32_t read_vendor ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 48 of file pci.c.

Referenced by pci_init(), and probe_function().

static uint32_t read_class ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 55 of file pci.c.

Referenced by probe_function().

static uint32_t read_subclass ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 62 of file pci.c.

Referenced by probe_function().

static uint32_t read_secondary_bus ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
inlinestatic

Definition at line 69 of file pci.c.

Referenced by probe_function().

static void probe_bus ( uint32_t  bus)
static

Definition at line 126 of file pci.c.

Referenced by pci_init(), probe_function(), and read_secondary_bus().

static bool probe_function ( uint32_t  bus,
uint32_t  device,
uint32_t  func 
)
static

Definition at line 78 of file pci.c.

Referenced by probe_device().

static void probe_device ( uint32_t  bus,
uint32_t  device 
)
static

Definition at line 111 of file pci.c.

Referenced by probe_bus().

void pci_init ( )

Definition at line 134 of file pci.c.

Referenced by cmd_display_pci().