make all drivers relocatable. Per default, an 1:1 mapping is assumed.
Patch to add relocation to libpayload will follow. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Jordan Crouse <jordan.crouse@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3524 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
addf443e12
commit
99c0856903
|
@ -87,7 +87,10 @@ static unsigned long vgaddr;
|
|||
static unsigned long gpaddr;
|
||||
static unsigned long fbaddr;
|
||||
|
||||
#define FB ((unsigned char *) fbaddr)
|
||||
#define DC (phys_to_virt(dcaddr))
|
||||
#define VG (phys_to_virt(vgaddr))
|
||||
#define GP (phys_to_virt(gpaddr))
|
||||
#define FB ((unsigned char *) phys_to_virt(fbaddr))
|
||||
|
||||
static void init_video_mode(void)
|
||||
{
|
||||
|
@ -119,32 +122,32 @@ static void init_video_mode(void)
|
|||
lo &= ~0x38;
|
||||
wrmsr(0x48002001, lo, hi);
|
||||
|
||||
writel(0x4758, dcaddr + 0x00);
|
||||
writel(0x4758, DC + 0x00);
|
||||
|
||||
val = readl(dcaddr + 0x00);
|
||||
val = readl(DC + 0x00);
|
||||
|
||||
writel(0, dcaddr + 0x10);
|
||||
writel(0, dcaddr + 0x14);
|
||||
writel(0, dcaddr + 0x18);
|
||||
writel(0, DC + 0x10);
|
||||
writel(0, DC + 0x14);
|
||||
writel(0, DC + 0x18);
|
||||
|
||||
/* Set up the default scaling */
|
||||
|
||||
val = readl(dcaddr + 0xD4);
|
||||
val = readl(DC + 0xD4);
|
||||
|
||||
writel((0x4000 << 16) | 0x4000, dcaddr + 0x90);
|
||||
writel(0, dcaddr + 0x94);
|
||||
writel(val & ~0xf3040000, dcaddr + 0xD4);
|
||||
writel((0x4000 << 16) | 0x4000, DC + 0x90);
|
||||
writel(0, DC + 0x94);
|
||||
writel(val & ~0xf3040000, DC + 0xD4);
|
||||
|
||||
/* Set up the compression (or lack thereof) */
|
||||
writel(vga_mode.hactive * vga_mode.vactive | 0x01, dcaddr + 0x2C);
|
||||
writel(vga_mode.hactive * vga_mode.vactive | 0x01, DC + 0x2C);
|
||||
|
||||
val = readl(dcaddr + 0x88);
|
||||
writel(val & ~0xC00, dcaddr + 0x88);
|
||||
writel(0, dcaddr + 0x8C);
|
||||
val = readl(DC + 0x88);
|
||||
writel(val & ~0xC00, DC + 0x88);
|
||||
writel(0, DC + 0x8C);
|
||||
|
||||
/* Set the pitch */
|
||||
writel(vga_mode.hactive >> 3, dcaddr + 0x34);
|
||||
writel((vga_mode.hactive + 7) >> 3, dcaddr + 0x30);
|
||||
writel(vga_mode.hactive >> 3, DC + 0x34);
|
||||
writel((vga_mode.hactive + 7) >> 3, DC + 0x30);
|
||||
|
||||
/* Set up default watermarks */
|
||||
|
||||
|
@ -154,50 +157,50 @@ static void init_video_mode(void)
|
|||
/* Write the timings */
|
||||
|
||||
writel((vga_mode.hactive - 1) | ((vga_mode.htotal - 1) << 16),
|
||||
dcaddr + 0x40);
|
||||
DC + 0x40);
|
||||
|
||||
writel((vga_mode.hblankstart - 1) | ((vga_mode.hblankend - 1) << 16),
|
||||
dcaddr + 0x44);
|
||||
DC + 0x44);
|
||||
|
||||
writel((vga_mode.hsyncstart - 1) | ((vga_mode.hsyncend - 1) << 16),
|
||||
dcaddr + 0x48);
|
||||
DC + 0x48);
|
||||
|
||||
writel((vga_mode.vactive - 1) | ((vga_mode.vtotal - 1) << 16),
|
||||
dcaddr + 0x50);
|
||||
DC + 0x50);
|
||||
|
||||
writel((vga_mode.vblankstart - 1) | ((vga_mode.vblankend - 1) << 16),
|
||||
dcaddr + 0x54);
|
||||
DC + 0x54);
|
||||
|
||||
writel((vga_mode.vsyncstart - 1) | ((vga_mode.vsyncend - 1) << 16),
|
||||
dcaddr + 0x58);
|
||||
DC + 0x58);
|
||||
|
||||
writel(((vga_mode.hactive - 1) << 16) | (vga_mode.vactive - 1),
|
||||
dcaddr + 0x5C);
|
||||
DC + 0x5C);
|
||||
|
||||
|
||||
/* Write the VG configuration */
|
||||
|
||||
writel(0x290000F | vga_mode.synccfg, vgaddr + 0x08);
|
||||
writel(0x290000F | vga_mode.synccfg, VG + 0x08);
|
||||
|
||||
/* Turn on the dacs */
|
||||
|
||||
val = readl(vgaddr + 0x50);
|
||||
writel((val & ~0xC00) | 0x01, vgaddr + 0x50);
|
||||
val = readl(VG + 0x50);
|
||||
writel((val & ~0xC00) | 0x01, VG + 0x50);
|
||||
|
||||
/* Set the framebuffer base */
|
||||
writel(fbaddr, dcaddr + 0x84);
|
||||
writel(fbaddr, DC + 0x84);
|
||||
|
||||
/* Write the final configuration */
|
||||
|
||||
writel(0xB000059, dcaddr + 0x08);
|
||||
writel(0, dcaddr + 0x0C);
|
||||
writel(0x2B601, dcaddr + 0x04);
|
||||
writel(0xB000059, DC + 0x08);
|
||||
writel(0, DC + 0x0C);
|
||||
writel(0x2B601, DC + 0x04);
|
||||
}
|
||||
|
||||
static void geode_set_palette(int entry, unsigned int color)
|
||||
{
|
||||
writel(entry, dcaddr + 0x70);
|
||||
writel(color, dcaddr + 0x74);
|
||||
writel(entry, DC + 0x70);
|
||||
writel(color, DC + 0x74);
|
||||
}
|
||||
|
||||
static void geode_scroll_up(void)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#define CRTC_DATA 0x3d5
|
||||
|
||||
#define VIDEO(_r, _c)\
|
||||
((u16 *) (0xB8000 + ((_r) * (VIDEO_COLS * 2)) + ((_c) * 2)))
|
||||
((u16 *) (phys_to_virt(0xB8000) + ((_r) * (VIDEO_COLS * 2)) + ((_c) * 2)))
|
||||
|
||||
static u8 crtc_read(u8 index)
|
||||
{
|
||||
|
|
|
@ -29,4 +29,5 @@
|
|||
|
||||
TARGETS-y += i386/head.S.o i386/main.o i386/sysinfo.o
|
||||
TARGETS-y += i386/timer.o i386/coreboot.o i386/util.S.o
|
||||
TARGETS-y += i386/exec.S.o
|
||||
TARGETS-y += i386/exec.S.o i386/virtual.o
|
||||
|
||||
|
|
|
@ -152,10 +152,10 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
|
|||
|
||||
int get_coreboot_info(struct sysinfo_t *info)
|
||||
{
|
||||
int ret = cb_parse_header((void *)0x0, 0x1000, info);
|
||||
int ret = cb_parse_header(phys_to_virt(0x00000000), 0x1000, info);
|
||||
|
||||
if (ret != 1)
|
||||
ret = cb_parse_header((void *)0xf0000, 0x1000, info);
|
||||
ret = cb_parse_header(phys_to_virt(0x000f0000), 0x1000, info);
|
||||
|
||||
return (ret == 1) ? 0 : -1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of the libpayload project.
|
||||
*
|
||||
* Copyright (C) 2008 coresystems GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
unsigned long virtual_offset = 0;
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* This file is part of the libpayload project.
|
||||
*
|
||||
* Copyright (C) 2008 coresystems GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ARCH_VIRTUAL_H
|
||||
#define _ARCH_VIRTUAL_H
|
||||
|
||||
extern unsigned long virtual_offset;
|
||||
|
||||
#define virt_to_phys(virt) ((unsigned long) (virt) + virtual_offset)
|
||||
#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virtual_offset))
|
||||
|
||||
#define virt_to_bus(addr) virt_to_phys(addr)
|
||||
#define bus_to_virt(addr) phys_to_virt(addr)
|
||||
|
||||
#endif
|
|
@ -33,6 +33,7 @@
|
|||
#include <stddef.h>
|
||||
#include <arch/types.h>
|
||||
#include <arch/io.h>
|
||||
#include <arch/virtual.h>
|
||||
#include <sysinfo.h>
|
||||
#include <stdarg.h>
|
||||
#include <lar.h>
|
||||
|
|
Loading…
Reference in New Issue