merge trunk
This commit is contained in:
commit
540c000f0d
33 changed files with 587 additions and 114 deletions
|
@ -1,4 +1,4 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||
|
||||
DEPDIR=.deps-core
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ kernel = {
|
|||
mips_loongson = term/serial.c;
|
||||
mips_loongson = video/sm712.c;
|
||||
mips_loongson = video/sis315pro.c;
|
||||
mips_loongson = video/radeon_fuloong2e.c;
|
||||
extra_dist = video/sm712_init.c;
|
||||
mips_loongson = commands/keylayouts.c;
|
||||
|
||||
|
@ -363,8 +364,8 @@ image = {
|
|||
};
|
||||
|
||||
image = {
|
||||
name = fwstart_fuloong;
|
||||
mips_loongson = boot/mips/loongson/fuloong.S;
|
||||
name = fwstart_fuloong2f;
|
||||
mips_loongson = boot/mips/loongson/fuloong2f.S;
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
||||
enable = mips_loongson;
|
||||
|
@ -1680,3 +1681,9 @@ module = {
|
|||
name = time;
|
||||
common = commands/time.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = cacheinfo;
|
||||
common = commands/cacheinfo.c;
|
||||
condition = COND_ENABLE_CACHE_STATS;
|
||||
};
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#define FULOONG 1
|
||||
#define FULOONG2F 1
|
||||
#include "fwstart.S"
|
|
@ -26,7 +26,7 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/smbus.h>
|
||||
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200
|
||||
#else
|
||||
|
@ -43,10 +43,10 @@
|
|||
start:
|
||||
_start:
|
||||
__start:
|
||||
/* Put serial init as soon as possible. But on Fuloong serial is past
|
||||
Geode, so on Fuloong we need Geode first.
|
||||
/* Put serial init as soon as possible. But on Fuloong2f serial is past
|
||||
Geode, so on Fuloong2f we need Geode first.
|
||||
*/
|
||||
#ifndef FULOONG
|
||||
#ifndef FULOONG2F
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ retry_cs5536:
|
|||
bnel $t2, $t3, 1b
|
||||
sll $t4, $t4, 1
|
||||
|
||||
#ifndef FULOONG
|
||||
#ifndef FULOONG2F
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(cs5536_found)
|
||||
bal printhex
|
||||
|
@ -95,7 +95,7 @@ retry_cs5536:
|
|||
bal gpio_init
|
||||
nop
|
||||
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
@ -130,7 +130,7 @@ retry_cs5536:
|
|||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0)
|
||||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0)
|
||||
|
||||
/* Yeeloong and Fuloong have only one memory slot. */
|
||||
/* Yeeloong and Fuloong2f have only one memory slot. */
|
||||
/* Output first byte on serial for debugging. */
|
||||
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
|
||||
bal read_spd
|
||||
|
@ -252,7 +252,7 @@ gpio_init:
|
|||
/* In: none. Out: none. Clobbered: $t0, $t1, $t2, $a0, $a1, $a2. */
|
||||
serial_hw_init:
|
||||
move $t2, $ra
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
lui $a1, %hi (GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
|
||||
|
@ -471,7 +471,7 @@ regdump:
|
|||
.quad 0x0100020200010101 /* 4 */
|
||||
.quad 0x0a04030603050203 /* 6 */
|
||||
.quad 0x0f0e040000010a0b /* 7 */
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
.quad 0x0000000100000001 /* 8 */
|
||||
#else
|
||||
.quad 0x0000010200000102 /* 8 */
|
||||
|
@ -482,7 +482,7 @@ regdump:
|
|||
.quad 0x002a3c0615000000 /* c */
|
||||
.quad 0x002a002a002a002a /* d */
|
||||
.quad 0x002a002a002a002a /* e */
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
.quad 0x00b40020005b0004 /* f */
|
||||
#else
|
||||
.quad 0x00b40020006d0004 /* f */
|
||||
|
@ -503,7 +503,7 @@ regdump:
|
|||
|
||||
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
||||
gpio_dump:
|
||||
#ifdef FULOONG
|
||||
#ifdef FULOONG2F
|
||||
.long 0xffff0000, 0x2eefd110, 0xffff0000, 0xffff0000
|
||||
.long 0x2eefd110, 0xffff0000, 0x1000efff, 0xefff1000
|
||||
.long 0x3df3c20c, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
|
@ -740,8 +740,8 @@ continue:
|
|||
lui $t0, %hi(cached_continue - 0x20000000)
|
||||
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
||||
jr $t0
|
||||
#ifdef FULOONG
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG)
|
||||
#ifdef FULOONG2F
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
#else
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
|
||||
#endif
|
||||
|
|
|
@ -109,7 +109,7 @@ argcont:
|
|||
DO_PARSE (memsizestr, $s4)
|
||||
DO_PARSE (highmemsizestr, $s5)
|
||||
DO_CHECKT1 (pmon_yeeloong_verstr, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKT1 (pmon_fuloong_verstr, GRUB_ARCH_MACHINE_FULOONG)
|
||||
DO_CHECKT1 (pmon_fuloong2f_verstr, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
2:
|
||||
b argcont
|
||||
addiu $t0, $t0, 4
|
||||
|
@ -155,11 +155,12 @@ memsizestr: .asciiz "memsize="
|
|||
highmemsizestr: .asciiz "highmemsize="
|
||||
machtype_yeeloong_str1: .asciiz "machtype=8.9"
|
||||
machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-"
|
||||
machtype_fuloong_str: .asciiz "machtype=lemote-fuloong-"
|
||||
machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f"
|
||||
machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e"
|
||||
pmon_yeeloong_str: .asciiz "PMON_VER=LM8"
|
||||
pmon_fuloong_str: .asciiz "PMON_VER=LM6"
|
||||
pmon_fuloong2f_str: .asciiz "PMON_VER=LM6"
|
||||
pmon_yeeloong_verstr: .asciiz "Version=LM8"
|
||||
pmon_fuloong_verstr: .asciiz "Version=LM6"
|
||||
pmon_fuloong2f_verstr: .asciiz "Version=LM6"
|
||||
.p2align 2
|
||||
|
||||
argdone:
|
||||
|
@ -173,8 +174,9 @@ argdone:
|
|||
DO_CHECKA1 (machtype_yeeloong_str1, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_yeeloong_str2, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (pmon_yeeloong_str, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
|
||||
DO_CHECKA1 (pmon_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
|
||||
DO_CHECKA1 (machtype_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKA1 (machtype_fuloong2e_str, GRUB_ARCH_MACHINE_FULOONG2E)
|
||||
DO_CHECKA1 (pmon_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
addiu $a0, $a0, -1
|
||||
b argdone
|
||||
addiu $a1, $a1, 4
|
||||
|
|
|
@ -281,7 +281,7 @@ grub_cs5536_init_geode (grub_pci_device_t dev)
|
|||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
break;
|
||||
case GRUB_ARCH_MACHINE_FULOONG:
|
||||
case GRUB_ARCH_MACHINE_FULOONG2F:
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1
|
||||
|
|
|
@ -115,16 +115,6 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
/* Skip ghosts. */
|
||||
if (id == GRUB_LOONGSON_OHCI_PCIID
|
||||
&& dev.function == GRUB_LOONGSON_OHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
if (id == GRUB_LOONGSON_EHCI_PCIID
|
||||
&& dev.function == GRUB_LOONGSON_EHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (hook (dev, id))
|
||||
return;
|
||||
|
||||
|
|
58
grub-core/commands/cacheinfo.c
Normal file
58
grub-core/commands/cacheinfo.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* cacheinfo.c - disk cache statistics */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
unsigned long hits, misses;
|
||||
|
||||
grub_disk_cache_get_performance (&hits, &misses);
|
||||
grub_printf ("Disk cache: hits = %lu, misses = %lu ", hits, misses);
|
||||
if (hits + misses)
|
||||
{
|
||||
unsigned long ratio = hits * 10000 / (hits + misses);
|
||||
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
|
||||
}
|
||||
else
|
||||
grub_printf ("(N/A)\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_cacheinfo;
|
||||
|
||||
GRUB_MOD_INIT(cacheinfo)
|
||||
{
|
||||
cmd_cacheinfo =
|
||||
grub_register_command ("cacheinfo", grub_rescue_cmd_info,
|
||||
0, N_("Get disk cache info."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cacheinfo)
|
||||
{
|
||||
grub_unregister_command (cmd_cacheinfo);
|
||||
}
|
|
@ -90,26 +90,6 @@ grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
grub_rescue_cmd_info (void)
|
||||
{
|
||||
extern void grub_disk_cache_get_performance (unsigned long *,
|
||||
unsigned long *);
|
||||
unsigned long hits, misses;
|
||||
|
||||
grub_disk_cache_get_performance (&hits, &misses);
|
||||
grub_printf ("Disk cache: hits = %u, misses = %u ", hits, misses);
|
||||
if (hits + misses)
|
||||
{
|
||||
unsigned long ratio = hits * 10000 / (hits + misses);
|
||||
grub_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100);
|
||||
}
|
||||
else
|
||||
grub_printf ("(N/A)\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* dump ADDRESS [SIZE] */
|
||||
static grub_err_t
|
||||
grub_mini_cmd_dump (struct grub_command *cmd __attribute__ ((unused)),
|
||||
|
|
|
@ -614,7 +614,8 @@ grub_jfs_read_file (struct grub_jfs_data *data,
|
|||
/* Find the file with the pathname PATH on the filesystem described by
|
||||
DATA. */
|
||||
static grub_err_t
|
||||
grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
|
||||
grub_jfs_find_file (struct grub_jfs_data *data, const char *path,
|
||||
grub_uint32_t start_ino)
|
||||
{
|
||||
char fpath[grub_strlen (path)];
|
||||
char *name = fpath;
|
||||
|
@ -623,7 +624,7 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
|
|||
|
||||
grub_strncpy (fpath, path, grub_strlen (path) + 1);
|
||||
|
||||
if (grub_jfs_read_inode (data, GRUB_JFS_AGGR_INODE, &data->currinode))
|
||||
if (grub_jfs_read_inode (data, start_ino, &data->currinode))
|
||||
return grub_errno;
|
||||
|
||||
/* Skip the first slashes. */
|
||||
|
@ -724,11 +725,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
|
|||
if (symlink[0] == '/')
|
||||
ino = 2;
|
||||
|
||||
/* Now load in the old inode. */
|
||||
if (grub_jfs_read_inode (data, ino, &data->currinode))
|
||||
return grub_errno;
|
||||
|
||||
grub_jfs_find_file (data, symlink);
|
||||
grub_jfs_find_file (data, symlink, ino);
|
||||
if (grub_errno)
|
||||
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
|
||||
|
||||
|
@ -750,7 +747,7 @@ grub_jfs_dir (grub_device_t device, const char *path,
|
|||
if (!data)
|
||||
goto fail;
|
||||
|
||||
if (grub_jfs_find_file (data, path))
|
||||
if (grub_jfs_find_file (data, path, GRUB_JFS_AGGR_INODE))
|
||||
goto fail;
|
||||
|
||||
diro = grub_jfs_opendir (data, &data->currinode);
|
||||
|
@ -801,7 +798,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
|
|||
if (!data)
|
||||
goto fail;
|
||||
|
||||
grub_jfs_find_file (data, name);
|
||||
grub_jfs_find_file (data, name, GRUB_JFS_AGGR_INODE);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static struct grub_disk_cache grub_disk_cache_table[GRUB_DISK_CACHE_NUM];
|
|||
void (*grub_disk_firmware_fini) (void);
|
||||
int grub_disk_firmware_is_tainted;
|
||||
|
||||
#if 0
|
||||
#if DISK_CACHE_STATS
|
||||
static unsigned long grub_disk_cache_hits;
|
||||
static unsigned long grub_disk_cache_misses;
|
||||
|
||||
|
@ -119,13 +119,13 @@ grub_disk_cache_fetch (unsigned long dev_id, unsigned long disk_id,
|
|||
&& cache->sector == sector)
|
||||
{
|
||||
cache->lock = 1;
|
||||
#if 0
|
||||
#if DISK_CACHE_STATS
|
||||
grub_disk_cache_hits++;
|
||||
#endif
|
||||
return cache->data;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if DISK_CACHE_STATS
|
||||
grub_disk_cache_misses++;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -217,6 +217,9 @@ grub_util_biosdisk_iterate (int (*hook) (const char *name),
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
if (pull != GRUB_DISK_PULL_NONE)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
|
||||
if (map[i].drive && hook (map[i].drive))
|
||||
return 1;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
extern void grub_video_sm712_init (void);
|
||||
extern void grub_video_sis315pro_init (void);
|
||||
extern void grub_video_radeon_fuloong2e_init (void);
|
||||
extern void grub_video_init (void);
|
||||
extern void grub_bitmap_init (void);
|
||||
extern void grub_font_init (void);
|
||||
|
@ -123,6 +124,23 @@ void
|
|||
grub_machine_init (void)
|
||||
{
|
||||
grub_addr_t modend;
|
||||
grub_uint32_t prid;
|
||||
|
||||
asm volatile ("mfc0 %0, " GRUB_CPU_LOONGSON_COP0_PRID : "=r" (prid));
|
||||
|
||||
switch (prid)
|
||||
{
|
||||
/* Loongson 2E. */
|
||||
case 0x6302:
|
||||
grub_arch_machine = GRUB_ARCH_MACHINE_FULOONG2E;
|
||||
break;
|
||||
/* Loongson 2F. */
|
||||
case 0x6303:
|
||||
if (grub_arch_machine != GRUB_ARCH_MACHINE_FULOONG2F
|
||||
&& grub_arch_machine != GRUB_ARCH_MACHINE_YEELOONG)
|
||||
grub_arch_machine = GRUB_ARCH_MACHINE_YEELOONG;
|
||||
break;
|
||||
}
|
||||
|
||||
/* FIXME: measure this. */
|
||||
if (grub_arch_busclock == 0)
|
||||
|
@ -189,6 +207,7 @@ grub_machine_init (void)
|
|||
grub_video_init ();
|
||||
grub_video_sm712_init ();
|
||||
grub_video_sis315pro_init ();
|
||||
grub_video_radeon_fuloong2e_init ();
|
||||
grub_bitmap_init ();
|
||||
grub_font_init ();
|
||||
grub_gfxterm_init ();
|
||||
|
@ -213,7 +232,9 @@ grub_halt (void)
|
|||
{
|
||||
switch (grub_arch_machine)
|
||||
{
|
||||
case GRUB_ARCH_MACHINE_FULOONG:
|
||||
case GRUB_ARCH_MACHINE_FULOONG2E:
|
||||
break;
|
||||
case GRUB_ARCH_MACHINE_FULOONG2F:
|
||||
{
|
||||
grub_pci_device_t dev;
|
||||
grub_port_t p;
|
||||
|
@ -248,8 +269,27 @@ grub_exit (void)
|
|||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
|
||||
|
||||
switch (grub_arch_machine)
|
||||
{
|
||||
case GRUB_ARCH_MACHINE_FULOONG2E:
|
||||
grub_outb (grub_inb (0xbfe00104) & ~4, 0xbfe00104);
|
||||
grub_outb (grub_inb (0xbfe00104) | 4, 0xbfe00104);
|
||||
break;
|
||||
case GRUB_ARCH_MACHINE_FULOONG2F:
|
||||
{
|
||||
grub_pci_device_t dev;
|
||||
if (!grub_cs5536_find (&dev))
|
||||
break;
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_RESET,
|
||||
grub_cs5536_read_msr (dev,
|
||||
GRUB_CS5536_MSR_DIVIL_RESET)
|
||||
| 1);
|
||||
break;
|
||||
}
|
||||
case GRUB_ARCH_MACHINE_YEELOONG:
|
||||
grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
|
||||
break;
|
||||
}
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("Reboot failed\n");
|
||||
|
|
|
@ -61,7 +61,7 @@ VARIABLE (grub_arch_highmemsize)
|
|||
.long 0
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
VARIABLE (grub_arch_machine)
|
||||
.long GRUB_ARCH_MACHINE_FULOONG
|
||||
.long GRUB_ARCH_MACHINE_FULOONG2F
|
||||
#endif
|
||||
cont:
|
||||
/* Save our base. */
|
||||
|
|
|
@ -210,6 +210,7 @@ grub_vprintf (const char *fmt, va_list args)
|
|||
buf[PREALLOC_SIZE - 2] = '.';
|
||||
buf[PREALLOC_SIZE - 1] = '.';
|
||||
buf[PREALLOC_SIZE] = 0;
|
||||
curbuf = buf;
|
||||
}
|
||||
else
|
||||
s = grub_vsnprintf_real (curbuf, s, fmt, ap2);
|
||||
|
|
|
@ -45,15 +45,18 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
#include <grub/efi/efi.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
#define DEFAULT_VIDEO_MODE "auto"
|
||||
#define ACCEPTS_PURE_TEXT 0
|
||||
#elif defined (GRUB_MACHINE_IEEE1275)
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
#define DEFAULT_VIDEO_MODE "text"
|
||||
#define ACCEPTS_PURE_TEXT 1
|
||||
#else
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#include <grub/i386/pc/console.h>
|
||||
#define HAS_VGA_TEXT 1
|
||||
#define DEFAULT_VIDEO_MODE "text"
|
||||
#define ACCEPTS_PURE_TEXT 1
|
||||
#endif
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
|
@ -483,12 +486,22 @@ grub_linux_boot (void)
|
|||
tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
|
||||
if (! tmp)
|
||||
return grub_errno;
|
||||
#if ACCEPTS_PURE_TEXT
|
||||
err = grub_video_set_mode (tmp, 0, 0);
|
||||
#else
|
||||
err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||
#endif
|
||||
grub_free (tmp);
|
||||
}
|
||||
else
|
||||
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
|
||||
|
||||
{
|
||||
#if ACCEPTS_PURE_TEXT
|
||||
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
|
||||
#else
|
||||
err = grub_video_set_mode (DEFAULT_VIDEO_MODE,
|
||||
GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||
#endif
|
||||
}
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
|
|
|
@ -41,7 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
const char loongson_machtypes[][60] =
|
||||
{
|
||||
[GRUB_ARCH_MACHINE_YEELOONG] = "machtype=lemote-yeeloong-2f-8.9inches",
|
||||
[GRUB_ARCH_MACHINE_FULOONG] = "machtype=lemote-fuloong-2f-unknown"
|
||||
[GRUB_ARCH_MACHINE_FULOONG2F] = "machtype=lemote-fuloong-2f-unknown",
|
||||
[GRUB_ARCH_MACHINE_FULOONG2E] = "machtype=lemote-fuloong-2e-unknown"
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -239,6 +239,15 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
const char loongson_defserial[][6] =
|
||||
{
|
||||
[GRUB_ARCH_MACHINE_YEELOONG] = "com0",
|
||||
[GRUB_ARCH_MACHINE_FULOONG2F] = "com2",
|
||||
[GRUB_ARCH_MACHINE_FULOONG2E] = "com1"
|
||||
};
|
||||
#endif
|
||||
|
||||
grub_err_t
|
||||
grub_serial_register (struct grub_serial_port *port)
|
||||
{
|
||||
|
@ -301,9 +310,7 @@ grub_serial_register (struct grub_serial_port *port)
|
|||
port->term_out = out;
|
||||
grub_terminfo_output_register (out, "vt100");
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
if (grub_strcmp (port->name,
|
||||
(grub_arch_machine == GRUB_ARCH_MACHINE_YEELOONG)
|
||||
? "com0" : "com2") == 0)
|
||||
if (grub_strcmp (port->name, loongson_defserial[grub_arch_machine]) == 0)
|
||||
{
|
||||
grub_term_register_input_active ("serial_*", in);
|
||||
grub_term_register_output_active ("serial_*", out);
|
||||
|
|
231
grub-core/video/radeon_fuloong2e.c
Normal file
231
grub-core/video/radeon_fuloong2e.c
Normal file
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define grub_video_render_target grub_video_fbrender_target
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/vga.h>
|
||||
|
||||
#define GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE 1048576
|
||||
|
||||
static struct
|
||||
{
|
||||
struct grub_video_mode_info mode_info;
|
||||
struct grub_video_render_target *render_target;
|
||||
|
||||
grub_uint8_t *ptr;
|
||||
int mapped;
|
||||
grub_uint32_t base;
|
||||
grub_pci_device_t dev;
|
||||
} framebuffer;
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_video_init (void)
|
||||
{
|
||||
/* Reset frame buffer. */
|
||||
grub_memset (&framebuffer, 0, sizeof(framebuffer));
|
||||
|
||||
return grub_video_fb_init ();
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_video_fini (void)
|
||||
{
|
||||
if (framebuffer.mapped)
|
||||
grub_pci_device_unmap_range (framebuffer.dev, framebuffer.ptr,
|
||||
GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE);
|
||||
|
||||
return grub_video_fb_fini ();
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_setup (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask __attribute__ ((unused)))
|
||||
{
|
||||
int depth;
|
||||
grub_err_t err;
|
||||
int found = 0;
|
||||
|
||||
#ifndef TEST
|
||||
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
|
||||
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
grub_uint32_t class;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class = grub_pci_read (addr);
|
||||
|
||||
if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA
|
||||
|| pciid != 0x515a1002)
|
||||
return 0;
|
||||
|
||||
found = 1;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
||||
framebuffer.base = grub_pci_read (addr);
|
||||
framebuffer.dev = dev;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Decode depth from mode_type. If it is zero, then autodetect. */
|
||||
depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
|
||||
>> GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
|
||||
|
||||
if ((width != 640 && width != 0) || (height != 480 && height != 0)
|
||||
|| (depth != 16 && depth != 0))
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"Only 1024x600x16 is supported");
|
||||
|
||||
grub_pci_iterate (find_card);
|
||||
if (!found)
|
||||
return grub_error (GRUB_ERR_IO, "Couldn't find graphics card");
|
||||
#endif
|
||||
/* Fill mode info details. */
|
||||
framebuffer.mode_info.width = 640;
|
||||
framebuffer.mode_info.height = 480;
|
||||
framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
|
||||
framebuffer.mode_info.bpp = 16;
|
||||
framebuffer.mode_info.bytes_per_pixel = 2;
|
||||
framebuffer.mode_info.pitch = 640 * 2;
|
||||
framebuffer.mode_info.number_of_colors = 256;
|
||||
framebuffer.mode_info.red_mask_size = 5;
|
||||
framebuffer.mode_info.red_field_pos = 11;
|
||||
framebuffer.mode_info.green_mask_size = 6;
|
||||
framebuffer.mode_info.green_field_pos = 5;
|
||||
framebuffer.mode_info.blue_mask_size = 5;
|
||||
framebuffer.mode_info.blue_field_pos = 0;
|
||||
framebuffer.mode_info.reserved_mask_size = 0;
|
||||
framebuffer.mode_info.reserved_field_pos = 0;
|
||||
#ifndef TEST
|
||||
framebuffer.mode_info.blit_format
|
||||
= grub_video_get_blit_format (&framebuffer.mode_info);
|
||||
#endif
|
||||
|
||||
/* We can safely discard volatile attribute. */
|
||||
#ifndef TEST
|
||||
framebuffer.ptr
|
||||
= (void *) grub_pci_device_map_range (framebuffer.dev,
|
||||
framebuffer.base,
|
||||
GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE);
|
||||
#endif
|
||||
framebuffer.mapped = 1;
|
||||
|
||||
/* Prevent garbage from appearing on the screen. */
|
||||
grub_memset (framebuffer.ptr, 0x55,
|
||||
framebuffer.mode_info.height * framebuffer.mode_info.pitch);
|
||||
|
||||
#ifndef TEST
|
||||
err = grub_video_fb_create_render_target_from_pointer (&framebuffer
|
||||
.render_target,
|
||||
&framebuffer.mode_info,
|
||||
framebuffer.ptr);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = grub_video_fb_set_active_render_target (framebuffer.render_target);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Copy default palette to initialize emulated palette. */
|
||||
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
|
||||
grub_video_fbstd_colors);
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_swap_buffers (void)
|
||||
{
|
||||
/* TODO: Implement buffer swapping. */
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_set_active_render_target (struct grub_video_render_target *target)
|
||||
{
|
||||
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
|
||||
target = framebuffer.render_target;
|
||||
|
||||
return grub_video_fb_set_active_render_target (target);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_radeon_fuloong2e_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
||||
void **framebuf)
|
||||
{
|
||||
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
|
||||
*framebuf = (char *) framebuffer.ptr;
|
||||
|
||||
grub_video_fb_fini ();
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static struct grub_video_adapter grub_video_radeon_fuloong2e_adapter =
|
||||
{
|
||||
.name = "RADEON RV100 QZ (Fuloong2E) Video Driver",
|
||||
.id = GRUB_VIDEO_DRIVER_RADEON_FULOONG2E,
|
||||
|
||||
.prio = GRUB_VIDEO_ADAPTER_PRIO_NATIVE,
|
||||
|
||||
.init = grub_video_radeon_fuloong2e_video_init,
|
||||
.fini = grub_video_radeon_fuloong2e_video_fini,
|
||||
.setup = grub_video_radeon_fuloong2e_setup,
|
||||
.get_info = grub_video_fb_get_info,
|
||||
.get_info_and_fini = grub_video_radeon_fuloong2e_get_info_and_fini,
|
||||
.set_palette = grub_video_fb_set_palette,
|
||||
.get_palette = grub_video_fb_get_palette,
|
||||
.set_viewport = grub_video_fb_set_viewport,
|
||||
.get_viewport = grub_video_fb_get_viewport,
|
||||
.map_color = grub_video_fb_map_color,
|
||||
.map_rgb = grub_video_fb_map_rgb,
|
||||
.map_rgba = grub_video_fb_map_rgba,
|
||||
.unmap_color = grub_video_fb_unmap_color,
|
||||
.fill_rect = grub_video_fb_fill_rect,
|
||||
.blit_bitmap = grub_video_fb_blit_bitmap,
|
||||
.blit_render_target = grub_video_fb_blit_render_target,
|
||||
.scroll = grub_video_fb_scroll,
|
||||
.swap_buffers = grub_video_radeon_fuloong2e_swap_buffers,
|
||||
.create_render_target = grub_video_fb_create_render_target,
|
||||
.delete_render_target = grub_video_fb_delete_render_target,
|
||||
.set_active_render_target = grub_video_radeon_fuloong2e_set_active_render_target,
|
||||
.get_active_render_target = grub_video_fb_get_active_render_target,
|
||||
|
||||
.next = 0
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(video_radeon_fuloong2e)
|
||||
{
|
||||
grub_video_register (&grub_video_radeon_fuloong2e_adapter);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(video_radeon_fuloong2e)
|
||||
{
|
||||
grub_video_unregister (&grub_video_radeon_fuloong2e_adapter);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue