summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/include/arch/romcc_io.h16
-rw-r--r--src/arch/i386/lib/console.c9
2 files changed, 25 insertions, 0 deletions
diff --git a/src/arch/i386/include/arch/romcc_io.h b/src/arch/i386/include/arch/romcc_io.h
index 66e6dc07cd..8366a4d529 100644
--- a/src/arch/i386/include/arch/romcc_io.h
+++ b/src/arch/i386/include/arch/romcc_io.h
@@ -53,6 +53,9 @@ static void wrmsr(unsigned long index, msr_t msr)
(((FN) & 0x07) << 8) | \
((WHERE) & 0xFF))
+#define PCI_ID(VENDOR_ID, DEVICE_ID) \
+ ((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
+
static unsigned char pci_read_config8(unsigned addr)
{
outl(0x80000000 | (addr & ~3), 0xCF8);
@@ -88,3 +91,16 @@ static void pci_write_config32(unsigned addr, unsigned int value)
outl(0x80000000 | (addr & ~3), 0xCF8);
outl(value, 0xCFC);
}
+
+static unsigned pci_locate_device(unsigned pci_id, unsigned addr)
+{
+ addr &= ~0xff;
+ for(; addr <= PCI_ADDR(255, 31, 7, 0); addr += PCI_ADDR(0,0,1,0)) {
+ unsigned int id;
+ id = pci_read_config32(addr);
+ if (id == pci_id) {
+ return addr;
+ }
+ }
+ return ~0U;
+}
diff --git a/src/arch/i386/lib/console.c b/src/arch/i386/lib/console.c
index 83502eafd9..f3594e9786 100644
--- a/src/arch/i386/lib/console.c
+++ b/src/arch/i386/lib/console.c
@@ -136,3 +136,12 @@ static void console_init(void)
" starting...\r\n";
print_info(console_test);
}
+
+
+static void die(const char *str)
+{
+ print_emerg(str);
+ do {
+ hlt();
+ } while(1);
+}