This allows me to keep going while the details of where code lives gets
worked out. I removed printk references and copied the definitions of the
PCI functions.
No need to commit ever.
Signed-off-by: Myles Watson <[EMAIL PROTECTED]>
Thanks,
Myles
Index: util/x86emu/vm86.c
===================================================================
--- util/x86emu/vm86.c (revision 929)
+++ util/x86emu/vm86.c (working copy)
@@ -29,6 +29,7 @@
#include <string.h>
#include <io.h>
+#define CONFIG_CMD(bdf, where) (0x80000000 | (bdf) | ((where & 0xff) & ~3) | ((where & 0xf00)<<16) )
/* The address arguments to this function are PHYSICAL ADDRESSES */
static void real_mode_switch_call_vga(unsigned long devfn)
@@ -240,19 +241,7 @@
);
}
-void run_bios(struct device *dev, unsigned long addr)
-{
- int i;
-
- /* clear vga bios data area */
- for (i = 0x400; i < 0x500; i++) {
- *(unsigned char *) i = 0;
- }
- real_mode_switch_call_vga((dev->bus->secondary << 8) | dev->path.pci.devfn);
-}
-
-
// we had hoped to avoid this.
// this is a stub IDT only. It's main purpose is to ignore calls
// to the BIOS.
@@ -432,28 +421,16 @@
cs = cs_ip >> 16;
flags = stackflags;
- printk(BIOS_DEBUG, "biosint: INT# 0x%lx\n", intnumber);
- printk(BIOS_DEBUG, "biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n",
- eax, ebx, ecx, edx);
- printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
- ebp, esp, edi, esi);
- printk(BIOS_DEBUG, "biosint: ip 0x%lx cs 0x%lx flags 0x%lx\n",
- ip, cs, flags);
// cases in a good compiler are just as good as your own tables.
switch (intnumber) {
case 0 ... 15:
// These are not BIOS service, but the CPU-generated exceptions
- printk(BIOS_INFO, "biosint: Oops, exception %lu\n", intnumber);
if (esp < 0x1000) {
- printk(BIOS_DEBUG, "Stack contents: ");
while (esp < 0x1000) {
- printk(BIOS_DEBUG, "0x%04x ", *(unsigned short *) esp);
esp += 2;
}
- printk(BIOS_DEBUG, "\n");
}
- printk(BIOS_DEBUG, "biosint: Bailing out\n");
// "longjmp"
vga_exit();
break;
@@ -472,8 +449,6 @@
&ebx, &edx, &ecx, &eax, &flags);
break;
default:
- printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%lx\n",
- intnumber);
break;
}
if (ret)
@@ -548,7 +523,20 @@
}
+void run_bios(struct device *dev, unsigned long addr)
+{
+ int i;
+
+ /* clear vga bios data area */
+ for (i = 0x400; i < 0x500; i++) {
+ *(unsigned char *) i = 0;
+ }
+ setup_realmode_idt();
+ real_mode_switch_call_vga((dev->bus->secondary << 8) | dev->path.pci.devfn);
+}
+
+
enum {
CHECK = 0xb001,
FINDDEV = 0xb102,
@@ -604,7 +592,6 @@
// devfn is an int, so we mask it off.
busdevfn = (dev->bus->secondary << 8)
| (dev->path.pci.devfn & 0xff);
- printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
*pebx = busdevfn;
retval = 0;
} else {
@@ -624,54 +611,74 @@
unsigned short word;
unsigned char byte;
unsigned char reg;
+ struct bus *pbus;
devfn = *pebx & 0xff;
bus = *pebx >> 8;
reg = *pedi;
dev = dev_find_slot(bus, devfn);
if (! dev) {
- printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
// idiots. the pcibios guys assumed you'd never pass a bad bus/devfn!
*peax = PCIBIOS_BADREG;
retval = -1;
}
+ pbus = dev->bus;
+ while (pbus && pbus->dev && !ops_pci_bus(pbus)) {
+ pbus = pbus->dev->bus;
+ }
switch(func) {
case READCONFBYTE:
- byte = pci_read_config8(dev, reg);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn),
+ reg),
+ 0xCF8);
+ byte = inb(0xCFC + (reg & 3));
*pecx = byte;
break;
case READCONFWORD:
- word = pci_read_config16(dev, reg);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn), reg),
+ 0xCF8);
+ word = inw(0xCFC + (reg & 2));
*pecx = word;
break;
case READCONFDWORD:
- dword = pci_read_config32(dev, reg);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn), reg),
+ 0xCF8);
+ dword = inl(0xCFC);
*pecx = dword;
break;
case WRITECONFBYTE:
byte = *pecx;
- pci_write_config8(dev, reg, byte);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn), reg),
+ 0xCF8);
+ outb(byte, 0xCFC + (reg & 3));
break;
case WRITECONFWORD:
word = *pecx;
- pci_write_config16(dev, reg, word);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn), reg),
+ 0xCF8);
+ outw(word, 0xCFC + (reg & 2));
break;
case WRITECONFDWORD:
dword = *pecx;
- pci_write_config32(dev, reg, dword);
+ outl(CONFIG_CMD(PCI_BDEVFN(dev->bus->secondary,
+ dev->path.pci.devfn), reg),
+ 0xCF8);
+ outl(dword, 0xCFC);
break;
}
if (retval)
retval = PCIBIOS_BADREG;
- printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n",
- func, bus, devfn, reg, *pecx);
*peax = 0;
retval = 0;
}
break;
default:
- printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func);
break;
}
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot