Author: stepan Date: 2007-06-27 23:01:01 +0200 (Wed, 27 Jun 2007) New Revision: 386
Added: LinuxBIOSv3/arch/x86/geodelx/ LinuxBIOSv3/arch/x86/geodelx/cpu.c Modified: LinuxBIOSv3/arch/x86/geodelx.c LinuxBIOSv3/arch/x86/isa-dma.c Log: Ron's arch code., slightly changed. Another one will follow
These are changes needed for geode lx. Also, we are moving CPU bug fixes into initram. This simplifies the code and, also, guarantees that cpu bugs won't cause trouble to initram.
All LX targets compile. Most of these changes have been run by the list.
Signed-off-by: Ronald G. Minnich rminnich@gmail.com Acked-by: Stefan Reinauer stepan@coresystems.de
Added: LinuxBIOSv3/arch/x86/geodelx/cpu.c =================================================================== --- LinuxBIOSv3/arch/x86/geodelx/cpu.c (rev 0) +++ LinuxBIOSv3/arch/x86/geodelx/cpu.c 2007-06-27 21:01:01 UTC (rev 386) @@ -0,0 +1,101 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2006 Indrek Kruusa indrek.kruusa@artecdesign.ee + * Copyright (C) 2006 Ronald G. Minnich rminnich@gmail.com + * Copyright (C) 2006 Stefan Reinauer stepan@coresystems.de + * Copyright (C) 2006 Andrei Birjukov andrei.birjukov@artecdesign.ee + * Copyright (C) 2007 Advanced Micro Devices, Inc. + * + * 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; 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 is a test for the idea of a cpu device. There is only ever + * going to be one CPU device, the bootstrap processor or BP; other + * processors will go through a different path. on Geode it is + * really simple, so we start with that. Later, it gets harder. + */ + +#include <console.h> +#include <string.h> +#include <device/device.h> +#include <lib.h> +#include <io.h> +#include <cpu.h> + +/* TODO: better comment on vsm_end_post_smi, and define 0x05a2 down below */ +/** + * This is a call to the VSM. + * We need to know what it does. + */ +static void vsm_end_post_smi(void) +{ + __asm__ volatile ("push %ax\n" + "mov $0x5000, %ax\n" + ".byte 0x0f, 0x38\n" "pop %ax\n"); +} + +/** + * The very last steps in lx init. Turn on caching, + * tell vsm that we are done. Turn A20 back on in + * case VSM turned it off. + * @param dev struct device pointer + */ +static void lx_init(struct device *dev) +{ + printk(BIOS_SPEW, "lx_init\n"); + + /* Turn on caching if we haven't already */ + enable_cache(); + + // do VSA late init + vsm_end_post_smi(); + + // Set gate A20 (legacy vsm disables it in late init) + printk(BIOS_SPEW, "A20 (0x92): %d\n", inb(0x92)); + outb(0x02, 0x92); + printk(BIOS_SPEW, "A20 (0x92): %d\n", inb(0x92)); + + printk(BIOS_SPEW, "CPU lx_init DONE\n"); +}; + +/* The only operations currently set up are the phase 6. We might, + * however, set up an op in phase3_scan to get the cpuinfo into a + * struct for all to see. On SMP, it would not be hard to have + * phase3 scan set up an array of such structs. Further, for systems + * which have multiple types of CPUs, you can compile in multiple CPU + * files and use the device id, at scan time, to pick which one is + * used. There is a lot of flexibility here! + */ +struct device_operations geodelx_cpuops = { + .constructor = default_device_constructor, + .phase3_scan = NULL, + .phase6_init = lx_init, +}; + +/* This is a constructor for a cpu. the PCI id works for now. + * Later, we might need to change it to use a different phase3 scan, + * and match on a cpu id. However, CPU IDs are known to be kind + * of weird, depending on date manufactured they can be all + * over the place (the Geode alone has had 3 vendors!) so + * we will have to be careful + */ +struct constructor geodelx_constructors[] = { + {.id = {.type = DEVICE_ID_PCI, + .u = {.pci = {.vendor = X86_VENDOR_AMD,.device = 0x05A2}}}, + .ops = &geodelx_cpuops}, + {.ops = 0}, +};
Modified: LinuxBIOSv3/arch/x86/geodelx.c =================================================================== --- LinuxBIOSv3/arch/x86/geodelx.c 2007-06-27 20:52:49 UTC (rev 385) +++ LinuxBIOSv3/arch/x86/geodelx.c 2007-06-27 21:01:01 UTC (rev 386) @@ -26,9 +26,9 @@ #include <device/pci.h> #include <string.h> #include <msr.h> +#include <io.h> #include <amd_geodelx.h> #include <spd.h> -#include <io.h>
/* all these functions used to be in a lot of fiddly little files. To * make it easier to find functions, we are merging them here. This @@ -574,4 +574,7 @@ msr.hi = 0; msr.lo = 0x00000603C; wrmsr(msrnum, msr); + /* fix cpu bugs */ +#warning testing fixing bugs in initram + cpu_bug(); }
Modified: LinuxBIOSv3/arch/x86/isa-dma.c =================================================================== --- LinuxBIOSv3/arch/x86/isa-dma.c 2007-06-27 20:52:49 UTC (rev 385) +++ LinuxBIOSv3/arch/x86/isa-dma.c 2007-06-27 21:01:01 UTC (rev 386) @@ -1,5 +1,6 @@ +/* where is this from? */ + #include <io.h> -#include <isa-dma.h>
/* DMA controller registers */ #define DMA1_CMD_REG 0x08 /* command register (w) */