pci: add simple pci driver

this driver only prints devices on the pci bus.
This commit is contained in:
Michael Shaw 2023-05-03 22:10:20 -04:00
commit 605507a688
7 changed files with 113 additions and 32 deletions

23
init/pio.c Normal file
View file

@ -0,0 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <kernel/pio.h>
#define genio(suffix, type) \
inline void out##suffix(uint16_t port, type value) \
{ \
__asm__ volatile("out" #suffix " %0, %1" : : "a"(value), "Nd"(port)); \
} \
inline type in##suffix(uint16_t port) \
{ \
type ret; \
__asm__ volatile("in" #suffix " %1, %0" : "=a"(ret) : "Nd"(port)); \
return ret; \
}
inline void iowait()
{
outb(0x80, 0);
}
genio(b, uint8_t);
genio(w, uint16_t);
genio(l, uint32_t);