diff --git a/Makefile b/Makefile index 799e35058b..ae6afc313e 100644 --- a/Makefile +++ b/Makefile @@ -261,7 +261,7 @@ LINUXBIOSINCLUDE := -Iinclude \ -I$(srctree)/include \ -I$(srctree)/include/cpu/generic/$(ARCH)/ \ -I$(srctree)/include/cpu/generic/x86/ \ - -include include/linuxbios/autoconf.h + -include $(srctree)/include/linuxbios/autoconf.h CPPFLAGS := $(LINUXBIOSINCLUDE) @@ -355,7 +355,8 @@ ifeq ($(config-targets),1) # Read arch specific Makefile to set LBBUILD_DEFCONFIG as needed. # LBBUILD_DEFCONFIG may point out an alternative default configuration # used for 'make defconfig' -include $(srctree)/mainboard/$(MAINBOARD)/Makefile +# The ? makes the error go away if configuration has been done yet. +include $(srctree)/mainboard/$(MAINBOARD)/Makefil? export LBBUILD_DEFCONFIG diff --git a/include/cpu/generic/i386/arch/io.h b/include/cpu/generic/i386/arch/io.h new file mode 100644 index 0000000000..ae42133329 --- /dev/null +++ b/include/cpu/generic/i386/arch/io.h @@ -0,0 +1,151 @@ +/* + * 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 _ARCH_IO_H +#define _ARCH_IO_H + +#include + +/* + * This file contains the definitions for the x86 IO instructions + * inb/inw/inl/outb/outw/outl and the "string versions" of the same + * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" + * versions of the single-IO instructions (inb_p/inw_p/..). + */ + +static inline void outb(uint8_t value, uint16_t port) +{ + __asm__ __volatile__ ("outb %b0, %w1" : : "a" (value), "Nd" (port)); +} + +static inline void outw(uint16_t value, uint16_t port) +{ + __asm__ __volatile__ ("outw %w0, %w1" : : "a" (value), "Nd" (port)); +} + +static inline void outl(uint32_t value, uint16_t port) +{ + __asm__ __volatile__ ("outl %0, %w1" : : "a" (value), "Nd" (port)); +} + +static inline uint8_t inb(uint16_t port) +{ + uint8_t value; + __asm__ __volatile__ ("inb %w1, %b0" : "=a"(value) : "Nd" (port)); + return value; +} + +static inline uint16_t inw(uint16_t port) +{ + uint16_t value; + __asm__ __volatile__ ("inw %w1, %w0" : "=a"(value) : "Nd" (port)); + return value; +} + +static inline uint32_t inl(uint16_t port) +{ + uint32_t value; + __asm__ __volatile__ ("inl %w1, %0" : "=a"(value) : "Nd" (port)); + return value; +} + +static inline void outsb(uint16_t port, const void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; outsb " + : "=S" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + +static inline void outsw(uint16_t port, const void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; outsw " + : "=S" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + +static inline void outsl(uint16_t port, const void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; outsl " + : "=S" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + + +static inline void insb(uint16_t port, void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; insb " + : "=D" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + +static inline void insw(uint16_t port, void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; insw " + : "=D" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + +static inline void insl(uint16_t port, void *addr, unsigned long count) +{ + __asm__ __volatile__ ( + "cld ; rep ; insl " + : "=D" (addr), "=c" (count) + : "d"(port), "0"(addr), "1" (count) + ); +} + +static inline void writeb(uint8_t b, volatile void *addr) +{ + *(volatile uint8_t *) addr = b; +} + +static inline void writew(uint16_t b, volatile void *addr) +{ + *(volatile uint16_t *) addr = b; +} + +static inline void writel(uint32_t b, volatile void *addr) +{ + *(volatile uint32_t *) addr = b; +} + +static inline uint8_t readb(const volatile void *addr) +{ + return *(volatile uint8_t *) addr; +} + +static inline uint16_t readw(const volatile void *addr) +{ + return *(volatile uint16_t *) addr; +} + +static inline uint32_t readl(const volatile void *addr) +{ + return *(volatile uint32_t *) addr; +} + +#endif + diff --git a/mainboard/emulation/qemu-i386/Makefile b/mainboard/emulation/qemu-i386/Makefile index 8494ed4725..3bc34c211e 100644 --- a/mainboard/emulation/qemu-i386/Makefile +++ b/mainboard/emulation/qemu-i386/Makefile @@ -9,6 +9,11 @@ core-$(UNCOMPRESSORS) += uncompressors $(obj)/mainboard.o: $(obj)/dtc.h -$(obj)/dtc.h: $(src)/dts - dtc -O lb $(src)/dts >$(obj)/dtc.h +$(obj)/dtc.h: $(src)/dts $(obj)/dtc + $(obj)/dtc -O lb $(src)/dts >$(obj)/dtc.h + +# this does not belong in this file. +$(obj)/dtc: + $(MAKE) -C $(srctree)/util/dtc/ + cp $(srctree)/util/dtc/dtc $(obj)/ diff --git a/mainboard/emulation/qemu-i386/mainboard.c b/mainboard/emulation/qemu-i386/mainboard.c index 5b61b37786..2b4a1efe6a 100644 --- a/mainboard/emulation/qemu-i386/mainboard.c +++ b/mainboard/emulation/qemu-i386/mainboard.c @@ -20,7 +20,7 @@ #include #include #include -#include "dtc.h" +// #include "dtc.h" struct chip_operations mainboard_emulation_qemu_i386_ops = { .name = "QEMU Mainboard" diff --git a/mainboard/emulation/qemu-i386/setup_before_car.c b/mainboard/emulation/qemu-i386/setup_before_car.c index 2022de65d0..d9ee419f8d 100644 --- a/mainboard/emulation/qemu-i386/setup_before_car.c +++ b/mainboard/emulation/qemu-i386/setup_before_car.c @@ -1,27 +1,24 @@ /* - 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 #include #include -#include -#include -#include "option_table.h" /* */