diff --git a/Kconfig b/Kconfig index 9347fdc6df..1634fe246a 100644 --- a/Kconfig +++ b/Kconfig @@ -36,6 +36,10 @@ source mainboard/Kconfig source arch/Kconfig source lib/Kconfig source console/Kconfig +# these are used for internal purposes only +source northbridge/Kconfig +source southbridge/Kconfig +source superio/Kconfig menu "Payload" diff --git a/Makefile b/Makefile index d0ad4b507e..fd69df9032 100644 --- a/Makefile +++ b/Makefile @@ -96,6 +96,9 @@ include lib/Makefile include device/Makefile include console/Makefile include mainboard/$(MAINBOARDDIR)/Makefile +include northbridge/Makefile +include southbridge/Makefile +include superio/Makefile include arch/$(ARCH)/Makefile endif diff --git a/arch/x86/Makefile b/arch/x86/Makefile index da699b7426..aa06db159f 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -106,6 +106,7 @@ STAGE2_LIB_OBJ = stage2.o clog2.o mem.o malloc.o tables.o delay.o compute_ STAGE2_ARCH_X86_OBJ = archtables.o linuxbios_table.o udelay_io.o STAGE2_ARCH_X86_OBJ += pci_ops_auto.o pci_ops_conf1.o pci_ops_conf2.o +STAGE2_ARCH_X86_OBJ += keyboard.o i8259.o isa-dma.o STAGE2_DYNAMIC_OBJ = statictree.o diff --git a/arch/x86/i8259.c b/arch/x86/i8259.c new file mode 100644 index 0000000000..8ebcd27dd1 --- /dev/null +++ b/arch/x86/i8259.c @@ -0,0 +1,41 @@ +#include +/* code taken from: +! +! setup.S Copyright (C) 1991, 1992 Linus Torvalds +! +! setup.s is responsible for getting the system data from the BIOS, +! and putting them into the appropriate places in system memory. +! both setup.s and system has been loaded by the bootblock. + */ +/* we're getting screwed again and again by this problem of the 8259. + * so we're going to leave this lying around for inclusion into + * crt0.S on an as-needed basis. +! well, that went ok, I hope. Now we have to reprogram the interrupts :-( +! we put them right after the intel-reserved hardware interrupts, at +! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really +! messed this up with the original PC, and they haven't been able to +! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, +! which is used for the internal hardware interrupts as well. We just +! have to reprogram the 8259's, and it isn't fun. + */ + +void setup_i8259(void) +{ + outb(0x11, 0x20); /*! initialization sequence to 8259A-1*/ + outb(0x11, 0xA0); /*! and to 8259A-2*/ + outb(0x20, 0x21); /*! start of hardware int's (0x20)*/ + outb(0x28, 0xA1); /*! start of hardware int's 2 (0x28)*/ + outb(0x04, 0x21); /*! 8259-1 is master*/ + outb(0x02, 0xA1); /*! 8259-2 is slave*/ + outb(0x01, 0x21); /*! 8086 mode for both*/ + outb(0x01, 0xA1); + outb(0xFF, 0xA1); /*! mask off all interrupts for now*/ + outb(0xFB, 0x21); /*! mask all irq's but irq2 which is cascaded*/ +} + +/* + * I like the way Linus says it: +! Well, that certainly wasn't fun :-(. Hopefully it works, and we don't +! need no steenking BIOS anyway (except for the initial loading :-). +*/ + diff --git a/arch/x86/isa-dma.c b/arch/x86/isa-dma.c new file mode 100644 index 0000000000..7b84afa98c --- /dev/null +++ b/arch/x86/isa-dma.c @@ -0,0 +1,44 @@ +#include +#include + +/* DMA controller registers */ +#define DMA1_CMD_REG 0x08 /* command register (w) */ +#define DMA1_STAT_REG 0x08 /* status register (r) */ +#define DMA1_REQ_REG 0x09 /* request register (w) */ +#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ +#define DMA1_MODE_REG 0x0B /* mode register (w) */ +#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ +#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ +#define DMA1_RESET_REG 0x0D /* Master Clear (w) */ +#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ +#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ + +#define DMA2_CMD_REG 0xD0 /* command register (w) */ +#define DMA2_STAT_REG 0xD0 /* status register (r) */ +#define DMA2_REQ_REG 0xD2 /* request register (w) */ +#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ +#define DMA2_MODE_REG 0xD6 /* mode register (w) */ +#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ +#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ +#define DMA2_RESET_REG 0xDA /* Master Clear (w) */ +#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ +#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ + +#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ +#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ +#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ + +#define DMA_AUTOINIT 0x10 + + +void isa_dma_init(void) +{ + /* slave at 0x00 - 0x0f */ + /* master at 0xc0 - 0xdf */ + /* 0x80 - 0x8f DMA page registers */ + /* DMA: 0x00, 0x02, 0x4, 0x06 base address for DMA channel */ + outb(0, DMA1_RESET_REG); + outb(0, DMA2_RESET_REG); + outb(DMA_MODE_CASCADE, DMA2_MODE_REG); + outb(0, DMA2_MASK_REG); +} diff --git a/arch/x86/keyboard.c b/arch/x86/keyboard.c new file mode 100644 index 0000000000..ea718ec781 --- /dev/null +++ b/arch/x86/keyboard.c @@ -0,0 +1,79 @@ +#include +#include +#include +#include + +static int kbd_empty_input_buffer(void) +{ + unsigned long timeout; + for(timeout = 1000000; timeout && (inb(0x64) & 0x02); timeout--) { + post_code(0); + } + return !!timeout; +} + +static int kbd_empty_output_buffer(void) +{ + unsigned long timeout; + for(timeout = 1000000; timeout && ((inb(0x64) & 0x01) == 0); timeout--) { + post_code(0); + } + return !!timeout; +} + +/* much better keyboard init courtesy ollie@sis.com.tw + TODO: Typematic Setting, the keyboard is too slow for me */ +static void pc_keyboard_init(struct pc_keyboard *keyboard) +{ + unsigned char regval; + + /* send cmd = 0xAA, self test 8042 */ + outb(0xaa, 0x64); + + /* empty input buffer or any other command/data will be lost */ + if (!kbd_empty_input_buffer()) { + printk(BIOS_ERR, "Keyboard input buffer would not empty\n"); + return; + } + + /* empty output buffer or any other command/data will be lost */ + if (!kbd_empty_output_buffer()) { + printk(BIOS_ERR, "Keyboard output buffer would not empty\n"); + return; + } + + /* read self-test result, 0x55 should be returned form 0x60 */ + if ((regval = inb(0x60) != 0x55)) + return; + + /* enable keyboard interface */ + outb(0x60, 0x64); + kbd_empty_input_buffer(); + + /* send cmd: enable IRQ 1 */ + outb(0x61, 0x60); + kbd_empty_input_buffer(); + + /* reset kerboard and self test (keyboard side) */ + outb(0xff, 0x60); + + /* empty inut bufferm or any other command/data will be lost */ + kbd_empty_input_buffer(); + + /* empty output buffer or any other command/data will be lost */ + kbd_empty_output_buffer(); + + if ((regval = inb(0x60) != 0xfa)) + return; + + kbd_empty_output_buffer(); + if ((regval = inb(0x60) != 0xaa)) + return; +} + +void init_pc_keyboard(unsigned int port0, unsigned int port1, struct pc_keyboard *kbd) +{ + if ((port0 == 0x60) && (port1 == 0x64)) { + pc_keyboard_init(kbd); + } +} diff --git a/arch/x86/stage0_i586.S b/arch/x86/stage0_i586.S index 0d2ba1da86..1ca33ca1ca 100644 --- a/arch/x86/stage0_i586.S +++ b/arch/x86/stage0_i586.S @@ -110,6 +110,9 @@ gdt16xend: */ .align 4 .globl gdtptr + .globl gdt_limit +gdt_limit = gdt_end - gdt - 1 /* compute the table limit */ + gdt: gdtptr: .word gdt_end - gdt -1 /* compute the table limit */ diff --git a/device/Makefile b/device/Makefile index b457f46bef..0ba0142565 100644 --- a/device/Makefile +++ b/device/Makefile @@ -25,5 +25,6 @@ $(obj)/device/%.o: $(src)/device/%.c $(Q)$(CC) $(INITCFLAGS) -c $< -o $@ STAGE2_DEVICE_OBJ = device.o device_util.o root_device.o \ - pci_device.o pci_ops.o pci_rom.o + pci_device.o pci_ops.o pci_rom.o \ + pnp_device.o diff --git a/device/device_util.c b/device/device_util.c index f837d7ef02..2cb59ea99f 100644 --- a/device/device_util.c +++ b/device/device_util.c @@ -1,21 +1,22 @@ /* - * Author(s) unknown + * Copyright (C) 2003 Linux Networx + * * - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ -*/ #include #include #include diff --git a/device/pci_device.c b/device/pci_device.c index 91706423c3..edd4b284f2 100644 --- a/device/pci_device.c +++ b/device/pci_device.c @@ -659,8 +659,10 @@ void pci_dev_init(struct device *dev) // #warning "Need to set up CONFIG_PCI_ROM_RUN" #if CONFIG_PCI_ROM_RUN == 1 void run_bios(struct device * dev, unsigned long addr); + void do_vgabios(void); struct rom_header *rom, *ram; + printk(BIOS_INFO, "Probing for option rom\n"); rom = pci_rom_probe(dev); if (rom == NULL) return; @@ -668,7 +670,10 @@ void pci_dev_init(struct device *dev) if (ram == NULL) return; - run_bios(dev, ram); + //run_bios(dev, ram); + //void do_vgabios(void) + // + do_vgabios(); #endif } diff --git a/device/pci_rom.c b/device/pci_rom.c index 8bc0109778..6923541815 100644 --- a/device/pci_rom.c +++ b/device/pci_rom.c @@ -22,6 +22,9 @@ #include #include +#define CONFIG_CONSOLE_VGA 1 +#define CONFIG_CONSOLE_VGA_MULTI 0 + struct rom_header * pci_rom_probe(struct device *dev) { unsigned long rom_address; @@ -80,10 +83,15 @@ struct rom_header * pci_rom_probe(struct device *dev) static void *pci_ram_image_start = (void *)PCI_RAM_IMAGE_START; +#ifndef GO_AWAY +int vga_inited; +struct device *vga_pri; +#endif + #if CONFIG_CONSOLE_VGA == 1 extern int vga_inited; // defined in vga_console.c #if CONFIG_CONSOLE_VGA_MULTI == 0 -extern device_t vga_pri; // the primary vga device, defined in device.c +extern struct device *vga_pri; // the primary vga device, defined in device.c #endif #endif @@ -109,11 +117,11 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) { #if CONFIG_CONSOLE_VGA == 1 #if CONFIG_CONSOLE_VGA_MULTI == 0 - if (dev != vga_pri) return NULL; // only one VGA supported + //if (dev != vga_pri) return NULL; // only one VGA supported #endif printk(BIOS_DEBUG, "Copying VGA ROM image from 0x%x to 0x%x, 0x%x bytes\n", rom_header, PCI_VGA_RAM_IMAGE_START, rom_size); - memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size); + memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header, rom_size); vga_inited = 1; return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START); #endif diff --git a/device/pnp_device.c b/device/pnp_device.c index 133c83fcd3..1c98b4a7b3 100644 --- a/device/pnp_device.c +++ b/device/pnp_device.c @@ -1,25 +1,25 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /* Copyright 2004 Linux Networx */ +#include #include #include -#include -#include +//#include +//#include #include #include #include @@ -27,47 +27,47 @@ /* PNP fundamental operations */ -void pnp_write_config(device_t dev, u8 reg, u8 value) +void pnp_write_config(struct device * dev, u8 reg, u8 value) { outb(reg, dev->path.u.pnp.port); outb(value, dev->path.u.pnp.port + 1); } -u8 pnp_read_config(device_t dev, u8 reg) +u8 pnp_read_config(struct device * dev, u8 reg) { outb(reg, dev->path.u.pnp.port); return inb(dev->path.u.pnp.port + 1); } -void pnp_set_logical_device(device_t dev) +void pnp_set_logical_device(struct device * dev) { pnp_write_config(dev, 0x07, dev->path.u.pnp.device); } -void pnp_set_enable(device_t dev, int enable) +void pnp_set_enable(struct device * dev, int enable) { pnp_write_config(dev, 0x30, enable?0x1:0x0); } -int pnp_read_enable(device_t dev) +int pnp_read_enable(struct device * dev) { return !!pnp_read_config(dev, 0x30); } -void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase) +void pnp_set_iobase(struct device * dev, unsigned index, unsigned iobase) { /* Index == 0x60 or 0x62 */ pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff); pnp_write_config(dev, index + 1, iobase & 0xff); } -void pnp_set_irq(device_t dev, unsigned index, unsigned irq) +void pnp_set_irq(struct device * dev, unsigned index, unsigned irq) { /* Index == 0x70 or 0x72 */ pnp_write_config(dev, index, irq); } -void pnp_set_drq(device_t dev, unsigned index, unsigned drq) +void pnp_set_drq(struct device * dev, unsigned index, unsigned drq) { /* Index == 0x74 */ pnp_write_config(dev, index, drq & 0xff); @@ -75,15 +75,15 @@ void pnp_set_drq(device_t dev, unsigned index, unsigned drq) /* PNP device operations */ -void pnp_read_resources(device_t dev) +void pnp_read_resources(struct device * dev) { return; } -static void pnp_set_resource(device_t dev, struct resource *resource) +static void pnp_set_resource(struct device * dev, struct resource *resource) { if (!(resource->flags & IORESOURCE_ASSIGNED)) { - printk_err("ERROR: %s %02x %s size: 0x%010Lx not assigned\n", + printk(BIOS_ERR, "ERROR: %s %02x %s size: 0x%010Lx not assigned\n", dev_path(dev), resource->index, resource_type(resource), resource->size); @@ -101,7 +101,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) pnp_set_irq(dev, resource->index, resource->base); } else { - printk_err("ERROR: %s %02x unknown resource type\n", + printk(BIOS_ERR, "ERROR: %s %02x unknown resource type\n", dev_path(dev), resource->index); return; } @@ -110,7 +110,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) report_resource_stored(dev, resource, ""); } -void pnp_set_resources(device_t dev) +void pnp_set_resources(struct device * dev) { int i; @@ -123,13 +123,13 @@ void pnp_set_resources(device_t dev) } } -void pnp_enable_resources(device_t dev) +void pnp_enable_resources(struct device * dev) { pnp_set_logical_device(dev); pnp_set_enable(dev, 1); } -void pnp_enable(device_t dev) +void pnp_enable(struct device * dev) { if (!dev->enabled) { pnp_set_logical_device(dev); @@ -138,15 +138,16 @@ void pnp_enable(device_t dev) } struct device_operations pnp_ops = { - .read_resources = pnp_read_resources, - .set_resources = pnp_set_resources, - .enable_resources = pnp_enable_resources, - .enable = pnp_enable, + .phase4_read_resources = pnp_read_resources, + .phase4_set_resources = pnp_set_resources, + .phase5_enable_resources = pnp_enable_resources, + //.enable = pnp_enable, + // FIXME }; /* PNP chip operations */ -static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *info) +static void pnp_get_ioresource(struct device * dev, unsigned index, struct io_info *info) { struct resource *resource; unsigned moving, gran, step; @@ -185,7 +186,7 @@ static void pnp_get_ioresource(device_t dev, unsigned index, struct io_info *inf resource->size = 1 << gran; } -static void get_resources(device_t dev, struct pnp_info *info) +static void get_resources(struct device * dev, struct pnp_info *info) { struct resource *resource; @@ -223,11 +224,12 @@ static void get_resources(device_t dev, struct pnp_info *info) } } -void pnp_enable_devices(device_t base_dev, struct device_operations *ops, +void pnp_enable_devices(struct device * base_dev, struct device_operations *ops, unsigned functions, struct pnp_info *info) { struct device_path path; - device_t dev; + struct device_id id = {.type = DEVICE_ID_PNP}; + struct device * dev; int i; path.type = DEVICE_PATH_PNP; @@ -236,7 +238,7 @@ void pnp_enable_devices(device_t base_dev, struct device_operations *ops, /* Setup the ops and resources on the newly allocated devices */ for(i = 0; i < functions; i++) { path.u.pnp.device = info[i].function; - dev = alloc_find_dev(base_dev->bus, &path); + dev = alloc_find_dev(base_dev->bus, &path, &id); /* Don't initialize a device multiple times */ if (dev->ops) diff --git a/include/device/pnp.h b/include/device/pnp.h index c6a0b1b50b..d100e8bde9 100644 --- a/include/device/pnp.h +++ b/include/device/pnp.h @@ -1,43 +1,46 @@ /* - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (C) FIXME + * Copyright (C) 2007 coresystems GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ -*/ #ifndef DEVICE_PNP_H #define DEVICE_PNP_H -#include +#include #include #include /* Primitive pnp resource manipulation */ -void pnp_write_config(device_t dev, u8 reg, u8 value); -u8 pnp_read_config(device_t dev, u8 reg); -void pnp_set_logical_device(device_t dev); -void pnp_set_enable(device_t dev, int enable); -int pnp_read_enable(device_t dev); -void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase); -void pnp_set_irq(device_t dev, unsigned index, unsigned irq); -void pnp_set_drq(device_t dev, unsigned index, unsigned drq); +void pnp_write_config(struct device * dev, u8 reg, u8 value); +u8 pnp_read_config(struct device * dev, u8 reg); +void pnp_set_logical_device(struct device * dev); +void pnp_set_enable(struct device * dev, int enable); +int pnp_read_enable(struct device * dev); +void pnp_set_iobase(struct device * dev, unsigned index, unsigned iobase); +void pnp_set_irq(struct device * dev, unsigned index, unsigned irq); +void pnp_set_drq(struct device * dev, unsigned index, unsigned drq); /* PNP device operations */ -void pnp_read_resources(device_t dev); -void pnp_set_resources(device_t dev); -void pnp_enable_resources(device_t dev); -void pnp_enable(device_t dev); +void pnp_read_resources(struct device * dev); +void pnp_set_resources(struct device * dev); +void pnp_enable_resources(struct device * dev); +void pnp_enable(struct device * dev); -struct device_operations pnp_ops; +extern struct device_operations pnp_ops; /* PNP helper operations */ @@ -59,7 +62,7 @@ struct pnp_info { #define PNP_DRQ1 0x80 struct io_info io0, io1, io2, io3; }; -struct resource *pnp_get_resource(device_t dev, unsigned index); +struct resource *pnp_get_resource(struct device * dev, unsigned index); void pnp_enable_devices(struct device *dev, struct device_operations *ops, unsigned functions, struct pnp_info *info); diff --git a/include/isa-dma.h b/include/isa-dma.h new file mode 100644 index 0000000000..5a42d30dff --- /dev/null +++ b/include/isa-dma.h @@ -0,0 +1,27 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Stefan Reinauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __ISA_DMA_H +#define __ISA_DMA_H + +/* This function is called in the southbridge code */ +void isa_dma_init(void); + +#endif + diff --git a/include/keyboard.h b/include/keyboard.h new file mode 100644 index 0000000000..e3d6d63126 --- /dev/null +++ b/include/keyboard.h @@ -0,0 +1,34 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Stefan Reinauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __KEYBOARD_H +#define __KEYBOARD_H 1 + +struct pc_keyboard { + // this structure should contain typematic settings, but LinuxBIOS + // does not care yet. +}; + +/* This function is called in the SuperIO code */ +void init_pc_keyboard(unsigned int port0, unsigned int port1, struct pc_keyboard *kbd); + + + +#endif + diff --git a/mainboard/emulation/Kconfig b/mainboard/emulation/Kconfig index 16ea7c06a4..2f3a8d81bf 100644 --- a/mainboard/emulation/Kconfig +++ b/mainboard/emulation/Kconfig @@ -6,6 +6,9 @@ config BOARD_EMULATION_QEMU_X86 bool "x86 QEMU" select ARCH_X86 select CAR_TYPE_I586 + select NORTHBRIDGE_INTEL_I440BXEMULATION + select SOUTHBRIDGE_INTEL_I82371EB + select SUPERIO_WINBOND_W83627HF help x86 QEMU variant. diff --git a/mainboard/emulation/qemu-x86/Makefile b/mainboard/emulation/qemu-x86/Makefile index e0658f8c6a..4c3a78c647 100644 --- a/mainboard/emulation/qemu-x86/Makefile +++ b/mainboard/emulation/qemu-x86/Makefile @@ -60,10 +60,6 @@ $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/ $(Q)printf " DTC $(subst $(shell pwd)/,,$(@))\n" $(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@ -STAGE2_MAINBOARD_OBJ = mainboard.o +STAGE2_MAINBOARD_OBJ = mainboard.o vga.o STAGE2_CHIPSET_OBJ = -# chipset -include $(src)/northbridge/intel/i440bxemulation/Makefile -include $(src)/southbridge/intel/i82371eb/Makefile - diff --git a/mainboard/emulation/qemu-x86/dts b/mainboard/emulation/qemu-x86/dts index 33ba972d48..9969490116 100644 --- a/mainboard/emulation/qemu-x86/dts +++ b/mainboard/emulation/qemu-x86/dts @@ -45,6 +45,7 @@ %% #include +extern struct constructor qemuvga_constructors[]; struct mainboard_emulation_qemu_x86_config root = { .nothing = 1, @@ -55,5 +56,5 @@ struct northbridge_intel_i440bx_config domain0 = { }; struct constructor *all_constructors[] ={ - i440bx_constructors, i82371eb_constructors, 0 + i440bx_constructors, i82371eb_constructors, qemuvga_constructors, 0 }; diff --git a/mainboard/emulation/qemu-x86/vga.c b/mainboard/emulation/qemu-x86/vga.c new file mode 100644 index 0000000000..d23e92a06e --- /dev/null +++ b/mainboard/emulation/qemu-x86/vga.c @@ -0,0 +1,59 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 coresystems GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include "config.h" + +static void setup_onboard(struct device *dev) +{ + struct pc_keyboard conf; + printk(BIOS_INFO, "Init VGA device\n"); + dev->on_mainboard=1; + dev->rom_address=0xc0000; + + // FIXME - this should be in superio some day + // but since qemu has no superio. + init_pc_keyboard(0x60, 0x64, &conf); +} + + +static struct device_operations qemuvga_pci_ops_dev = { + .constructor = default_device_constructor, + .phase3_scan = 0, + .phase4_read_resources = pci_dev_read_resources, + .phase4_set_resources = pci_dev_set_resources, + .phase4_enable_disable = setup_onboard, + .phase5_enable_resources = pci_dev_enable_resources, + .phase6_init = pci_dev_init, + .ops_pci = &pci_dev_ops_pci, +}; + +struct constructor qemuvga_constructors[] = { + {.id = {.type = DEVICE_ID_PCI, + .u = {.pci = {.vendor = 0x1013,.device = 0x00b8}}}, + &qemuvga_pci_ops_dev}, + {.ops = 0}, +}; diff --git a/northbridge/Kconfig b/northbridge/Kconfig new file mode 100644 index 0000000000..e226b0ed9b --- /dev/null +++ b/northbridge/Kconfig @@ -0,0 +1,23 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +source northbridge/intel/Kconfig + diff --git a/northbridge/Makefile b/northbridge/Makefile new file mode 100644 index 0000000000..1af0bd67d4 --- /dev/null +++ b/northbridge/Makefile @@ -0,0 +1,23 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +include $(src)/northbridge/intel/Makefile + diff --git a/northbridge/intel/Kconfig b/northbridge/intel/Kconfig new file mode 100644 index 0000000000..aa2ddb42f4 --- /dev/null +++ b/northbridge/intel/Kconfig @@ -0,0 +1,28 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +config NORTHBRIDGE_INTEL_I440BXEMULATION + boolean + help + This option is internally used to decide which northbridge code to + use. It is set in the mainboard Kconfig + + diff --git a/northbridge/intel/Makefile b/northbridge/intel/Makefile new file mode 100644 index 0000000000..cf6e3a446a --- /dev/null +++ b/northbridge/intel/Makefile @@ -0,0 +1,25 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +ifdef CONFIG_NORTHBRIDGE_INTEL_I440BXEMULATION + include $(src)/northbridge/intel/i440bxemulation/Makefile +endif + diff --git a/northbridge/intel/i440bxemulation/Makefile b/northbridge/intel/i440bxemulation/Makefile index e38e85d4c8..e96475aebf 100644 --- a/northbridge/intel/i440bxemulation/Makefile +++ b/northbridge/intel/i440bxemulation/Makefile @@ -19,9 +19,10 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -$(obj)/i440bx.o: $(src)/northbridge/intel/i440bxemulation/i440bx.c +STAGE2_CHIPSET_OBJ += $(obj)/northbridge/intel/i440bxemulation/i440bx.o + +$(obj)/northbridge/intel/i440bxemulation/%.o: $(src)/northbridge/intel/i440bxemulation/%.c + $(Q)mkdir -p $(obj)/northbridge/intel/i440bxemulation $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" $(Q)$(CC) $(INITCFLAGS) -c $< -o $@ -STAGE2_CHIPSET_OBJ += $(obj)/i440bx.o - diff --git a/southbridge/Kconfig b/southbridge/Kconfig new file mode 100644 index 0000000000..c7b91b3c93 --- /dev/null +++ b/southbridge/Kconfig @@ -0,0 +1,23 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +source southbridge/intel/Kconfig + diff --git a/southbridge/Makefile b/southbridge/Makefile new file mode 100644 index 0000000000..46cfbf1dc3 --- /dev/null +++ b/southbridge/Makefile @@ -0,0 +1,23 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +include $(src)/southbridge/intel/Makefile + diff --git a/southbridge/intel/Kconfig b/southbridge/intel/Kconfig new file mode 100644 index 0000000000..57206b78d9 --- /dev/null +++ b/southbridge/intel/Kconfig @@ -0,0 +1,27 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +config SOUTHBRIDGE_INTEL_I82371EB + boolean + help + This option is internally used to decide which southbridge code to + use. It is set in the mainboard Kconfig + diff --git a/southbridge/intel/Makefile b/southbridge/intel/Makefile new file mode 100644 index 0000000000..5ba5e9ee0e --- /dev/null +++ b/southbridge/intel/Makefile @@ -0,0 +1,29 @@ +## +## This file is part of the LinuxBIOS project. +## +## Copyright (C) 2007 coresystems GmbH +## Written by Stefan Reinauer for coresystems GmbH. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +# one entry like the below for each supported intel southbridge + +ifdef CONFIG_SOUTHBRIDGE_INTEL_I82371EB + include $(src)/southbridge/intel/i82371eb/Makefile +endif + + + diff --git a/util/x86emu/Makefile b/util/x86emu/Makefile index 872ceea0d0..8b4ffa3f3e 100644 --- a/util/x86emu/Makefile +++ b/util/x86emu/Makefile @@ -20,7 +20,7 @@ X86EMU_OBJ = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o PCBIOS_OBJ = pcibios.o -BIOSEMU_OBJ = biosemu.o +BIOSEMU_OBJ = biosemu.o vm86.o LIBX86EMU_OBJS = $(patsubst %,$(obj)/util/x86emu/x86emu/%,$(X86EMU_OBJ)) \ $(patsubst %,$(obj)/util/x86emu/pcbios/%,$(PCBIOS_OBJ)) \ diff --git a/util/x86emu/biosemu.c b/util/x86emu/biosemu.c index 3d60383762..8acabdd981 100644 --- a/util/x86emu/biosemu.c +++ b/util/x86emu/biosemu.c @@ -70,7 +70,7 @@ u32 getIntVect(int num) return MEM_RW(num << 2) + (MEM_RW((num << 2) + 2) << 4); } -/* FixME: There is already a push_word() in the emulator */ +/* FIXME: There is already a push_word() in the emulator */ void pushw(u16 val) { X86_ESP -= 2; @@ -97,8 +97,8 @@ u8 x_inb(u16 port) val = inb(port); - //if (port != 0x40) - // printk(BIOS_DEBUG,"inb(0x%04x) = 0x%02x\n", port, val); + if (port != 0x40) + printk("inb(0x%04x) = 0x%02x\n", port, val); return val; } @@ -109,7 +109,7 @@ u16 x_inw(u16 port) val = inw(port); - //printk(BIOS_DEBUG,"inw(0x%04x) = 0x%04x\n", port, val); + printk("inw(0x%04x) = 0x%04x\n", port, val); return val; } @@ -119,26 +119,26 @@ u32 x_inl(u16 port) val = inl(port); - //printk(BIOS_DEBUG,"inl(0x%04x) = 0x%08x\n", port, val); + printk("inl(0x%04x) = 0x%08x\n", port, val); return val; } void x_outb(u16 port, u8 val) { - //if (port != 0x43) - // printk(BIOS_DEBUG,"outb(0x%02x, 0x%04x)\n", val, port); + if (port != 0x43) + printk("outb(0x%02x, 0x%04x)\n", val, port); outb(val, port); } void x_outw(u16 port, u16 val) { - //printk(BIOS_DEBUG,"outw(0x%04x, 0x%04x)\n", val, port); + printk("outw(0x%04x, 0x%04x)\n", val, port); outw(val, port); } void x_outl(u16 port, u32 val) { - //printk(BIOS_DEBUG,"outl(0x%08x, 0x%04x)\n", val, port); + printk("outl(0x%08x, 0x%04x)\n", val, port); outl(val, port); } @@ -155,7 +155,7 @@ void do_int(int num) { int ret = 0; -// printk(BIOS_DEBUG,"int%x vector at %x\n", num, getIntVect(num)); + printk("int%x vector at %x\n", num, getIntVect(num)); switch (num) { #ifndef _PC @@ -316,6 +316,7 @@ void reset_int_vect(void) MEM_WW((0x6D << 2) + 2, SYS_BIOS >> 4); } #endif + void run_bios(struct device * dev, unsigned long addr) { #if 1 @@ -367,10 +368,13 @@ void run_bios(struct device * dev, unsigned long addr) pushw(X86_SS); pushw(X86_SP + 2); -// X86EMU_trace_on(); +#ifndef NO_TRACE + //X86EMU_trace_on(); +#endif printk("entering emulator\n"); - X86EMU_exec(); + printk("exited emulator\n"); + #endif } diff --git a/util/x86emu/vm86.c b/util/x86emu/vm86.c index 7f0aa22b4c..af7b7e6d3e 100644 --- a/util/x86emu/vm86.c +++ b/util/x86emu/vm86.c @@ -29,14 +29,14 @@ #include //#include #include -#include "vgachip.h" +//#include "vgachip.h" /* Declare a temporary global descriptor table - necessary because the Core part of the bios no longer sets up any 16 bit segments */ __asm__ ( /* pointer to original gdt */ "gdtarg: \n" " .word gdt_limit \n" - " .long gdt \n" + " .long gdtptr \n" /* compute the table limit */ "__mygdt_limit = __mygdt_end - __mygdt - 1 \n" @@ -75,6 +75,15 @@ __asm__ ( " .byte 0, 0x92, 0, 0 \n" "__mygdt_end: \n" + + "idtarg:\n" + " .word _idt_end - _idt - 1\n" /* limit */ + " .long _idt\n" + " .word 0\n" + "_idt:\n" + " .fill 20, 8, 0\n" // # idt is unitiailzed + "_idt_end:\n" + ); /* Declare a pointer to where our idt is going to be i.e. at mem zero */ @@ -290,7 +299,7 @@ void vga_enable_console() void do_vgabios(void) { - device_t dev; + struct device *dev; unsigned long busdevfn; unsigned int rom = 0; unsigned char *buf; @@ -305,35 +314,36 @@ void do_vgabios(void) dev = dev_find_class(PCI_CLASS_DISPLAY_VGA<<8 , 0); if (!dev) { - printk_debug("NO VGA FOUND\n"); + printk(BIOS_DEBUG, "NO VGA FOUND\n"); return; } - printk_debug("found VGA: vid=%x, did=%x\n", dev->vendor, dev->device); + printk(BIOS_DEBUG,"found VGA: vid=%x, did=%x\n", dev->vendor, dev->device); /* declare rom address here - keep any config data out of the way * of core LXB stuff */ - - rom = 0xfffc0000; +#warning fix rom address + rom = 0xc0000; pci_write_config32(dev, PCI_ROM_ADDRESS, rom|1); - printk_debug("rom base, size: %x\n", rom); + printk(BIOS_DEBUG, "rom base, size: %x\n", rom); buf = (unsigned char *) rom; if ((buf[0] == 0x55) && (buf[1] == 0xaa)) { memcpy((void *) 0xc0000, buf, size); - write_protect_vgabios(); // in northbridge +#warning Implement write_protect_vgabios() + //write_protect_vgabios(); // in northbridge // check signature again buf = (unsigned char *) 0xc0000; if (buf[0]==0x55 && buf[1]==0xAA) { busdevfn = (dev->bus->secondary << 8) | dev->path.u.pci.devfn; - printk_debug("bus/devfn = %#x\n", busdevfn); + printk(BIOS_DEBUG, "bus/devfn = %#x\n", busdevfn); real_mode_switch_call_vga(busdevfn); } else - printk_debug("Failed to copy VGA BIOS to 0xc0000\n"); + printk(BIOS_DEBUG, "Failed to copy VGA BIOS to 0xc0000\n"); } else - printk_debug("BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]); + printk(BIOS_DEBUG, "BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]); pci_write_config32(dev, PCI_ROM_ADDRESS, 0); } @@ -518,28 +528,28 @@ int biosint(unsigned long intnumber, cs = cs_ip >> 16; flags = stackflags; - printk_debug("biosint: INT# 0x%lx\n", intnumber); - printk_debug("biosint: eax 0x%lx ebx 0x%lx ecx 0x%lx edx 0x%lx\n", + 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_debug("biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n", + printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n", ebp, esp, edi, esi); - printk_debug("biosint: ip 0x%x cs 0x%x flags 0x%x\n", + printk(BIOS_DEBUG, "biosint: ip 0x%x cs 0x%x flags 0x%x\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_info("biosint: Oops, exception %u\n", intnumber); + printk(BIOS_INFO, "biosint: Oops, exception %u\n", intnumber); if (esp < 0x1000) { - printk_debug("Stack contents: "); + printk(BIOS_DEBUG, "Stack contents: "); while (esp < 0x1000) { - printk_debug("0x%04x ", *(unsigned short *) esp); + printk(BIOS_DEBUG, "0x%04x ", *(unsigned short *) esp); esp += 2; } - printk_debug("\n"); + printk(BIOS_DEBUG, "\n"); } - printk_debug("biosint: Bailing out\n"); + printk(BIOS_DEBUG, "biosint: Bailing out\n"); // "longjmp" vga_exit(); break; @@ -558,7 +568,7 @@ int biosint(unsigned long intnumber, &ebx, &edx, &ecx, &eax, &flags); break; default: - printk_info("BIOSINT: Unsupport int #0x%x\n", + printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%x\n", intnumber); break; } @@ -614,7 +624,7 @@ void setup_realmode_idt(void) TF bit is set upon call to real mode */ idts[1].cs = 0; idts[1].offset = 16384; - memcpy(16384, &debughandle, &end_debughandle - &debughandle); + memcpy((void *)16384, &debughandle, &end_debughandle - &debughandle); } @@ -658,7 +668,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp, unsigned short devid, vendorid, devfn; short devindex; /* Use short to get rid of gabage in upper half of 32-bit register */ unsigned char bus; - device_t dev; + struct device *dev; switch(func) { case CHECK: @@ -684,7 +694,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp, // devfn is an int, so we mask it off. busdevfn = (dev->bus->secondary << 8) | (dev->path.u.pci.devfn & 0xff); - printk_debug("0x%x: return 0x%x\n", func, busdevfn); + printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn); *pebx = busdevfn; retval = 0; } else { @@ -710,7 +720,7 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp, reg = *pedi; dev = dev_find_slot(bus, devfn); if (! dev) { - printk_debug("0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn); + 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; @@ -744,14 +754,14 @@ pcibios(unsigned long *pedi, unsigned long *pesi, unsigned long *pebp, if (retval) retval = PCIBIOS_BADREG; - printk_debug("0x%x: bus %d devfn 0x%x reg 0x%x val 0x%lx\n", + 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_err("UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func); + printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func); break; }