merge mainline into net
This commit is contained in:
commit
aa6b91afe9
68 changed files with 2264 additions and 747 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;
|
||||
|
||||
|
@ -218,6 +219,7 @@ kernel = {
|
|||
|
||||
videoinkernel = commands/boot.c;
|
||||
|
||||
extra_dist = kern/i386/int.S;
|
||||
extra_dist = kern/i386/realmode.S;
|
||||
extra_dist = kern/i386/pc/lzma_decode.S;
|
||||
extra_dist = kern/mips/cache_flush.S;
|
||||
|
@ -363,8 +365,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;
|
||||
|
@ -398,11 +400,15 @@ module = {
|
|||
module = {
|
||||
name = usb;
|
||||
common = bus/usb/usb.c;
|
||||
noemu = bus/usb/usbtrans.c;
|
||||
noemu = bus/usb/usbhub.c;
|
||||
enable = emu;
|
||||
common = bus/usb/usbtrans.c;
|
||||
common = bus/usb/usbhub.c;
|
||||
enable = usb;
|
||||
emu_condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = emuusb;
|
||||
common = bus/usb/usb.c;
|
||||
condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -437,18 +443,22 @@ module = {
|
|||
|
||||
module = {
|
||||
name = pci;
|
||||
noemu = bus/pci.c;
|
||||
emu = bus/emu/pci.c;
|
||||
emu = commands/lspci.c;
|
||||
common = bus/pci.c;
|
||||
|
||||
enable = emu;
|
||||
enable = i386_pc;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
enable = i386_ieee1275;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_multiboot;
|
||||
emu_condition = COND_GRUB_EMU_PCI;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = emupci;
|
||||
common = bus/emu/pci.c;
|
||||
common = commands/lspci.c;
|
||||
|
||||
condition = COND_GRUB_EMU_PCI;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -786,8 +796,6 @@ module = {
|
|||
name = usbtest;
|
||||
common = commands/usbtest.c;
|
||||
enable = usb;
|
||||
enable = emu;
|
||||
emu_condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -901,8 +909,6 @@ module = {
|
|||
name = usbms;
|
||||
common = disk/usbms.c;
|
||||
enable = usb;
|
||||
enable = emu;
|
||||
emu_condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1444,9 +1450,7 @@ module = {
|
|||
common = term/serial.c;
|
||||
x86 = term/ns8250.c;
|
||||
|
||||
enable = emu;
|
||||
enable = x86;
|
||||
emu_condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1681,3 +1685,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;
|
||||
|
||||
|
|
|
@ -36,11 +36,33 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
typedef enum
|
||||
{
|
||||
GRUB_UHCI_REG_USBCMD = 0x00,
|
||||
GRUB_UHCI_REG_USBINTR = 0x04,
|
||||
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
||||
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12,
|
||||
GRUB_UHCI_REG_USBLEGSUP = 0xc0
|
||||
} grub_uhci_reg_t;
|
||||
|
||||
/* R/WC legacy support bits */
|
||||
#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8)
|
||||
|
||||
/* Reset all legacy support - clear all R/WC bits and all R/W bits */
|
||||
#define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \
|
||||
| GRUB_UHCI_TRAP_BY_64H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_64H_RSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_RSTAT )
|
||||
|
||||
/* Some UHCI commands */
|
||||
#define GRUB_UHCI_CMD_RUN_STOP (1 << 0)
|
||||
#define GRUB_UHCI_CMD_HCRESET (1 << 1)
|
||||
#define GRUB_UHCI_CMD_MAXP (1 << 7)
|
||||
|
||||
/* Important bits in structures */
|
||||
#define GRUB_UHCI_LINK_TERMINATE 1
|
||||
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
||||
|
||||
|
@ -181,6 +203,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
||||
return 0;
|
||||
|
||||
/* Set bus master - needed for coreboot or broken BIOSes */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write_word(addr,
|
||||
GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
|
||||
|
||||
/* Determine IO base address. */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||
base = grub_pci_read (addr);
|
||||
|
@ -195,6 +222,19 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
||||
|
||||
/* Reset PIRQ and SMI */
|
||||
addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP);
|
||||
grub_pci_write_word(addr, GRUB_UHCI_RESET_LEGSUP_SMI);
|
||||
/* Reset the HC */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, GRUB_UHCI_CMD_HCRESET);
|
||||
grub_millisleep(5);
|
||||
/* Disable interrupts and commands (just to be safe) */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBINTR, 0);
|
||||
/* Finish HC reset, HC remains disabled */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
/* Read back to be sure PCI write is done */
|
||||
grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD);
|
||||
|
||||
/* Reserve a page for the frame list. */
|
||||
u->framelist = grub_memalign (4096, 4096);
|
||||
if (! u->framelist)
|
||||
|
@ -252,9 +292,6 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
u->td[N_TD - 2].linkptr = 0;
|
||||
u->tdfree = u->td;
|
||||
|
||||
/* Make sure UHCI is disabled! */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
|
||||
/* Setup the frame list pointers. Since no isochronous transfers
|
||||
are and will be supported, they all point to the (same!) queue
|
||||
head. */
|
||||
|
@ -285,7 +322,8 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
u->qh[N_QH - 1].linkptr = 1;
|
||||
|
||||
/* Enable UHCI again. */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD,
|
||||
GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP);
|
||||
|
||||
/* UHCI is initialized and ready for transfers. */
|
||||
grub_dprintf ("uhci", "UHCI initialized\n");
|
||||
|
|
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)),
|
||||
|
|
|
@ -86,6 +86,30 @@ hook (const struct grub_video_mode_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
print_edid (struct grub_video_edid_info *edid_info)
|
||||
{
|
||||
unsigned int edid_width, edid_height;
|
||||
|
||||
if (grub_video_edid_checksum (edid_info))
|
||||
{
|
||||
grub_printf (" EDID checksum invalid\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
grub_printf (" EDID version: %u.%u\n",
|
||||
edid_info->version, edid_info->revision);
|
||||
if (grub_video_edid_preferred_mode (edid_info, &edid_width, &edid_height)
|
||||
== GRUB_ERR_NONE)
|
||||
grub_printf (" Preferred mode: %ux%u\n", edid_width, edid_height);
|
||||
else
|
||||
{
|
||||
grub_printf (" No preferred mode available\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
|
@ -130,6 +154,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
FOR_VIDEO_ADAPTERS (adapter)
|
||||
{
|
||||
struct grub_video_mode_info info;
|
||||
struct grub_video_edid_info edid_info;
|
||||
|
||||
grub_printf ("Adapter '%s':\n", adapter->name);
|
||||
|
||||
|
@ -164,6 +189,11 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
adapter->iterate (hook);
|
||||
|
||||
if (adapter->get_edid && adapter->get_edid (&edid_info) == GRUB_ERR_NONE)
|
||||
print_edid (&edid_info);
|
||||
else
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
current_mode = NULL;
|
||||
|
||||
if (adapter->id != id)
|
||||
|
|
|
@ -139,6 +139,7 @@ make_regex (const char *start, const char *end, regex_t *regexp)
|
|||
case '.':
|
||||
case '(':
|
||||
case ')':
|
||||
case '@':
|
||||
buffer[i++] = '\\';
|
||||
buffer[i++] = ch;
|
||||
break;
|
||||
|
|
|
@ -57,6 +57,7 @@ grub_ata_dumpinfo (struct grub_ata *dev, char *info)
|
|||
{
|
||||
grub_dprintf ("ata", "Addressing: %d\n", dev->addr);
|
||||
grub_dprintf ("ata", "Sectors: %lld\n", (unsigned long long) dev->size);
|
||||
grub_dprintf ("ata", "Sector size: %u\n", 1U << dev->log_sector_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +171,21 @@ grub_ata_identify (struct grub_ata *dev)
|
|||
else
|
||||
dev->size = grub_le_to_cpu64(*((grub_uint64_t *) &info16[100]));
|
||||
|
||||
if (info16[106] & (1 << 12))
|
||||
{
|
||||
grub_uint32_t secsize;
|
||||
secsize = grub_le_to_cpu32 (*((grub_uint32_t *) &info16[117]));
|
||||
if (secsize & (secsize - 1) || !secsize
|
||||
|| secsize > 1048576)
|
||||
secsize = 256;
|
||||
for (dev->log_sector_size = 0;
|
||||
(1U << dev->log_sector_size) < secsize;
|
||||
dev->log_sector_size++);
|
||||
dev->log_sector_size++;
|
||||
}
|
||||
else
|
||||
dev->log_sector_size = 9;
|
||||
|
||||
/* Read CHS information. */
|
||||
dev->cylinders = info16[1];
|
||||
dev->heads = info16[3];
|
||||
|
@ -314,7 +330,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
grub_ata_setaddress (ata, &parms, sector, batch, addressing);
|
||||
parms.taskfile.cmd = (! rw ? cmd : cmd_write);
|
||||
parms.buffer = buf;
|
||||
parms.size = batch * GRUB_DISK_SECTOR_SIZE;
|
||||
parms.size = batch << ata->log_sector_size;
|
||||
parms.write = rw;
|
||||
if (ata->dma)
|
||||
parms.dma = 1;
|
||||
|
@ -322,9 +338,9 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
err = ata->dev->readwrite (ata, &parms, 0);
|
||||
if (err)
|
||||
return err;
|
||||
if (parms.size != batch * GRUB_DISK_SECTOR_SIZE)
|
||||
if (parms.size != batch << ata->log_sector_size)
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "incomplete read");
|
||||
buf += GRUB_DISK_SECTOR_SIZE * batch;
|
||||
buf += batch << ata->log_sector_size;
|
||||
sector += batch;
|
||||
nsectors += batch;
|
||||
}
|
||||
|
@ -433,6 +449,7 @@ grub_ata_open (const char *name, grub_disk_t disk)
|
|||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
|
||||
|
||||
disk->total_sectors = ata->size;
|
||||
disk->log_sector_size = ata->log_sector_size;
|
||||
|
||||
disk->id = grub_make_scsi_id (id, bus, 0);
|
||||
|
||||
|
|
|
@ -709,7 +709,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
|||
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp)
|
||||
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE))
|
||||
{
|
||||
grub_partition_t tpart = NULL;
|
||||
char *partition_name = NULL;
|
||||
char *device_name;
|
||||
grub_efi_device_path_t *dup_dp, *dup_ldp;
|
||||
grub_efi_hard_drive_device_path_t hd;
|
||||
|
@ -722,7 +722,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
|||
if (grub_partition_get_start (part) == hd.partition_start
|
||||
&& grub_partition_get_len (part) == hd.partition_size)
|
||||
{
|
||||
tpart = part;
|
||||
partition_name = grub_partition_get_name (part);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -760,17 +760,14 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *partition_name;
|
||||
|
||||
grub_partition_iterate (parent, find_partition);
|
||||
|
||||
if (! tpart)
|
||||
if (! partition_name)
|
||||
{
|
||||
grub_disk_close (parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
partition_name = grub_partition_get_name (tpart);
|
||||
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
|
||||
grub_free (partition_name);
|
||||
}
|
||||
|
|
|
@ -177,6 +177,10 @@ grub_pata_readwrite (struct grub_ata *disk,
|
|||
/* Start command. */
|
||||
grub_pata_regset (dev, GRUB_ATA_REG_CMD, parms->taskfile.cmd);
|
||||
|
||||
/* Wait for !BSY. */
|
||||
if (grub_pata_wait_not_busy (dev, GRUB_ATA_TOUT_DATA))
|
||||
return grub_errno;
|
||||
|
||||
/* Check status. */
|
||||
grub_int8_t sts = grub_pata_regget (dev, GRUB_ATA_REG_STATUS);
|
||||
grub_dprintf ("pata", "status=0x%x\n", sts);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1179,12 +1179,9 @@ grub_gzio_open (grub_file_t io)
|
|||
grub_free (gzio);
|
||||
grub_free (file);
|
||||
grub_file_seek (io, 0);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return io;
|
||||
}
|
||||
return io;
|
||||
}
|
||||
|
||||
return file;
|
||||
|
|
|
@ -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;
|
||||
|
@ -262,10 +265,13 @@ grub_util_get_fd_sectors (int fd, unsigned *log_secsize)
|
|||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (ioctl (fd, DIOCGSECTORSIZE, §or_size))
|
||||
goto fail;
|
||||
# elif defined(__NetBSD__)
|
||||
sector_size = label.d_secsize;
|
||||
# else
|
||||
if (ioctl (fd, BLKSSZGET, §or_size))
|
||||
# endif
|
||||
goto fail;
|
||||
# endif
|
||||
|
||||
if (sector_size & (sector_size - 1) || !sector_size)
|
||||
goto fail;
|
||||
|
@ -1835,6 +1841,9 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
|
|||
struct stat st;
|
||||
int fd;
|
||||
|
||||
if (disk->dev != &grub_util_biosdisk_dev)
|
||||
return 0;
|
||||
|
||||
fd = open (map[disk->id].device, O_RDONLY);
|
||||
/* Shouldn't happen. */
|
||||
if (fd == -1)
|
||||
|
|
|
@ -224,7 +224,11 @@ char *
|
|||
canonicalize_file_name (const char *path)
|
||||
{
|
||||
char *ret;
|
||||
#ifdef PATH_MAX
|
||||
#ifdef __MINGW32__
|
||||
ret = xmalloc (PATH_MAX);
|
||||
if (!_fullpath (ret, path, PATH_MAX))
|
||||
return NULL;
|
||||
#elif defined (PATH_MAX)
|
||||
ret = xmalloc (PATH_MAX);
|
||||
if (!realpath (path, ret))
|
||||
return NULL;
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
subu $t1, $t3, $t2
|
||||
1:
|
||||
cache 1, 0($t0)
|
||||
/* All four ways. */
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
cache 1, 1($t0)
|
||||
cache 1, 2($t0)
|
||||
cache 1, 3($t0)
|
||||
#endif
|
||||
|
||||
addiu $t1, $t1, -0x4
|
||||
bne $t1, $zero, 1b
|
||||
addiu $t0, $t0, 0x4
|
||||
|
|
|
@ -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)
|
||||
|
@ -170,7 +188,7 @@ grub_machine_init (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
grub_arch_memsize = (totalmem >> 20);
|
||||
grub_arch_memsize = totalmem;
|
||||
grub_arch_highmemsize = 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);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/ns8250.h>
|
||||
#include <grub/bsdlabel.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -946,6 +948,86 @@ grub_netbsd_add_modules (void)
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds NetBSD bootinfo bootdisk and bootwedge. The partition identified
|
||||
* in these bootinfo fields is the root device.
|
||||
*/
|
||||
static void
|
||||
grub_netbsd_add_boot_disk_and_wedge (void)
|
||||
{
|
||||
grub_device_t dev;
|
||||
grub_disk_t disk;
|
||||
grub_partition_t part;
|
||||
grub_uint32_t biosdev;
|
||||
grub_uint32_t partmapsector;
|
||||
struct grub_partition_bsd_disk_label *label;
|
||||
grub_uint64_t buf[GRUB_DISK_SECTOR_SIZE / 8];
|
||||
grub_uint8_t *hash;
|
||||
grub_uint64_t ctx[(GRUB_MD_MD5->contextsize + 7) / 8];
|
||||
|
||||
dev = grub_device_open (0);
|
||||
if (! (dev && dev->disk && dev->disk->partition))
|
||||
goto fail;
|
||||
|
||||
disk = dev->disk;
|
||||
part = disk->partition;
|
||||
|
||||
if (disk->dev && disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
|
||||
biosdev = (grub_uint32_t) disk->id & 0xff;
|
||||
else
|
||||
biosdev = 0xff;
|
||||
|
||||
/* Absolute sector of the partition map describing this partition. */
|
||||
partmapsector = grub_partition_get_start (part->parent) + part->offset;
|
||||
|
||||
disk->partition = part->parent;
|
||||
if (grub_disk_read (disk, part->offset, 0, GRUB_DISK_SECTOR_SIZE, buf) != GRUB_ERR_NONE)
|
||||
goto fail;
|
||||
disk->partition = part;
|
||||
|
||||
/* Fill bootwedge. */
|
||||
{
|
||||
struct grub_netbsd_btinfo_bootwedge biw;
|
||||
|
||||
grub_memset (&biw, 0, sizeof (biw));
|
||||
biw.biosdev = biosdev;
|
||||
biw.startblk = grub_partition_get_start (part);
|
||||
biw.nblks = part->len;
|
||||
biw.matchblk = partmapsector;
|
||||
biw.matchnblks = 1;
|
||||
|
||||
GRUB_MD_MD5->init (&ctx);
|
||||
GRUB_MD_MD5->write (&ctx, buf, GRUB_DISK_SECTOR_SIZE);
|
||||
GRUB_MD_MD5->final (&ctx);
|
||||
hash = GRUB_MD_MD5->read (&ctx);
|
||||
memcpy (biw.matchhash, hash, 16);
|
||||
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
|
||||
}
|
||||
|
||||
/* Fill bootdisk if this a NetBSD disk label. */
|
||||
label = (struct grub_partition_bsd_disk_label *) &buf;
|
||||
if (part->partmap != NULL &&
|
||||
(grub_strcmp (part->partmap->name, "netbsd") == 0) &&
|
||||
label->magic == grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
|
||||
{
|
||||
struct grub_netbsd_btinfo_bootdisk bid;
|
||||
|
||||
grub_memset (&bid, 0, sizeof (bid));
|
||||
bid.labelsector = partmapsector;
|
||||
bid.label.type = label->type;
|
||||
bid.label.checksum = label->checksum;
|
||||
memcpy (bid.label.packname, label->packname, 16);
|
||||
bid.biosdev = biosdev;
|
||||
bid.partition = part->number;
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
|
||||
}
|
||||
|
||||
fail:
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_netbsd_boot (void)
|
||||
{
|
||||
|
@ -1607,6 +1689,8 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
|||
grub_bsd_add_meta (NETBSD_BTINFO_CONSOLE, &cons, sizeof (cons));
|
||||
}
|
||||
|
||||
grub_netbsd_add_boot_disk_and_wedge ();
|
||||
|
||||
grub_loader_set (grub_netbsd_boot, grub_bsd_unload, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -371,6 +374,7 @@ grub_linux_setup_video (struct linux_kernel_params *params)
|
|||
case GRUB_VIDEO_DRIVER_VGA:
|
||||
case GRUB_VIDEO_DRIVER_CIRRUS:
|
||||
case GRUB_VIDEO_DRIVER_BOCHS:
|
||||
case GRUB_VIDEO_DRIVER_RADEON_FULOONG2E:
|
||||
/* Make gcc happy. */
|
||||
case GRUB_VIDEO_DRIVER_SDL:
|
||||
case GRUB_VIDEO_DRIVER_NONE:
|
||||
|
@ -483,12 +487,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
|
||||
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
# define ELFCLASSXX ELFCLASS32
|
||||
# define Elf_Ehdr Elf32_Ehdr
|
||||
# define Elf_Phdr Elf32_Phdr
|
||||
# define Elf_Shdr Elf32_Shdr
|
||||
#elif defined(MULTIBOOT_LOAD_ELF64)
|
||||
# define XX 64
|
||||
# define E_MACHINE MULTIBOOT_ELF64_MACHINE
|
||||
# define ELFCLASSXX ELFCLASS64
|
||||
# define Elf_Ehdr Elf64_Ehdr
|
||||
# define Elf_Phdr Elf64_Phdr
|
||||
# define Elf_Shdr Elf64_Shdr
|
||||
#else
|
||||
#error "I'm confused"
|
||||
#endif
|
||||
|
@ -223,3 +225,4 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
|
|||
#undef ELFCLASSXX
|
||||
#undef Elf_Ehdr
|
||||
#undef Elf_Phdr
|
||||
#undef Elf_Shdr
|
||||
|
|
|
@ -232,7 +232,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
|
|||
grub_env_export ("chosen");
|
||||
grub_free (buf);
|
||||
}
|
||||
for (ptr = def; *ptr; ptr++)
|
||||
|
||||
for (ptr = def; ptr && *ptr; ptr++)
|
||||
{
|
||||
if (ptr[0] == '>' && ptr[1] == '>')
|
||||
{
|
||||
|
@ -242,10 +243,12 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
|
|||
if (ptr[0] == '>')
|
||||
break;
|
||||
}
|
||||
if (ptr[0] && ptr[1])
|
||||
|
||||
if (ptr && ptr[0] && ptr[1])
|
||||
grub_env_set ("default", ptr + 1);
|
||||
else
|
||||
grub_env_unset ("default");
|
||||
|
||||
grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args);
|
||||
|
||||
if (errs_before != grub_err_printed_errors)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -274,6 +274,56 @@ grub_vbe_bios_get_pm_interface (grub_uint16_t *segment, grub_uint16_t *offset,
|
|||
return regs.eax & 0xffff;
|
||||
}
|
||||
|
||||
/* Call VESA BIOS 0x4f11 to get flat panel information, return status. */
|
||||
static grub_vbe_status_t
|
||||
grub_vbe_bios_get_flat_panel_info (struct grub_vbe_flat_panel_info *flat_panel_info)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
||||
regs.eax = 0x4f11;
|
||||
regs.ebx = 0x0001;
|
||||
regs.es = (((grub_addr_t) flat_panel_info) & 0xffff0000) >> 4;
|
||||
regs.edi = ((grub_addr_t) flat_panel_info) & 0xffff;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x10, ®s);
|
||||
return regs.eax & 0xffff;
|
||||
}
|
||||
|
||||
/* Call VESA BIOS 0x4f15 to get DDC availability, return status. */
|
||||
static grub_vbe_status_t
|
||||
grub_vbe_bios_get_ddc_capabilities (grub_uint8_t *level)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
||||
regs.eax = 0x4f15;
|
||||
regs.ebx = 0x0000;
|
||||
regs.ecx = 0x0000;
|
||||
regs.es = 0x0000;
|
||||
regs.edi = 0x0000;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x10, ®s);
|
||||
|
||||
*level = regs.ebx & 0xff;
|
||||
return regs.eax & 0xffff;
|
||||
}
|
||||
|
||||
/* Call VESA BIOS 0x4f15 to read EDID information, return status. */
|
||||
static grub_vbe_status_t
|
||||
grub_vbe_bios_read_edid (struct grub_video_edid_info *edid_info)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
||||
regs.eax = 0x4f15;
|
||||
regs.ebx = 0x0001;
|
||||
regs.ecx = 0x0000;
|
||||
regs.edx = 0x0000;
|
||||
regs.es = (((grub_addr_t) edid_info) & 0xffff0000) >> 4;
|
||||
regs.edi = ((grub_addr_t) edid_info) & 0xffff;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x10, ®s);
|
||||
return regs.eax & 0xffff;
|
||||
}
|
||||
|
||||
|
||||
grub_err_t
|
||||
grub_vbe_probe (struct grub_vbe_info_block *info_block)
|
||||
|
@ -328,6 +378,61 @@ grub_vbe_probe (struct grub_vbe_info_block *info_block)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_vbe_get_edid (struct grub_video_edid_info *edid_info)
|
||||
{
|
||||
struct grub_video_edid_info *edid_info_lowmem;
|
||||
|
||||
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
|
||||
edid_info_lowmem =
|
||||
(struct grub_video_edid_info *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
grub_memset (edid_info_lowmem, 0, sizeof (*edid_info_lowmem));
|
||||
|
||||
if (grub_vbe_bios_read_edid (edid_info_lowmem) != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "EDID information not available");
|
||||
|
||||
grub_memcpy (edid_info, edid_info_lowmem, sizeof (*edid_info));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
|
||||
{
|
||||
grub_vbe_status_t status;
|
||||
grub_uint8_t ddc_level;
|
||||
struct grub_video_edid_info edid_info;
|
||||
struct grub_vbe_flat_panel_info *flat_panel_info;
|
||||
|
||||
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
|
||||
flat_panel_info = (struct grub_vbe_flat_panel_info *)
|
||||
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + sizeof (struct grub_video_edid_info));
|
||||
grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info));
|
||||
|
||||
if (controller_info.version >= 0x200
|
||||
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff)
|
||||
== GRUB_VBE_STATUS_OK)
|
||||
{
|
||||
if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE
|
||||
&& grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
|
||||
&& grub_video_edid_preferred_mode (&edid_info, width, height)
|
||||
== GRUB_ERR_NONE)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
status = grub_vbe_bios_get_flat_panel_info (flat_panel_info);
|
||||
if (status == GRUB_VBE_STATUS_OK)
|
||||
{
|
||||
*width = flat_panel_info->horizontal_size;
|
||||
*height = flat_panel_info->vertical_size;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot get preferred mode");
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_vbe_set_video_mode (grub_uint32_t vbe_mode,
|
||||
struct grub_vbe_mode_info_block *vbe_mode_info)
|
||||
|
@ -697,11 +802,28 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
|
|||
struct grub_vbe_mode_info_block best_vbe_mode_info;
|
||||
grub_uint32_t best_vbe_mode = 0;
|
||||
int depth;
|
||||
int preferred_mode = 0;
|
||||
|
||||
/* 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 == 0 && height == 0)
|
||||
{
|
||||
grub_vbe_get_preferred_mode (&width, &height);
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
preferred_mode = 1;
|
||||
else
|
||||
{
|
||||
/* Fall back to 640x480. This is conservative, but the largest
|
||||
mode supported by the graphics card may not be safe for the
|
||||
display device. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
width = 640;
|
||||
height = 480;
|
||||
}
|
||||
}
|
||||
|
||||
/* Walk thru mode list and try to find matching mode. */
|
||||
for (p = vbe_mode_list; *p != 0xFFFF; p++)
|
||||
{
|
||||
|
@ -744,10 +866,21 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
|
|||
/* Unsupported bitdepth . */
|
||||
continue;
|
||||
|
||||
if (((vbe_mode_info.x_resolution != width)
|
||||
|| (vbe_mode_info.y_resolution != height)) && width != 0 && height != 0)
|
||||
/* Non matching resolution. */
|
||||
continue;
|
||||
if (preferred_mode)
|
||||
{
|
||||
if (vbe_mode_info.x_resolution > width
|
||||
|| vbe_mode_info.y_resolution > height)
|
||||
/* Resolution exceeds that of preferred mode. */
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((vbe_mode_info.x_resolution != width)
|
||||
|| (vbe_mode_info.y_resolution != height))
|
||||
&& width != 0 && height != 0)
|
||||
/* Non matching resolution. */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check if user requested RGB or index color mode. */
|
||||
if ((mode_mask & GRUB_VIDEO_MODE_TYPE_COLOR_MASK) != 0)
|
||||
|
@ -901,6 +1034,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
|
|||
.set_active_render_target = grub_video_fb_set_active_render_target,
|
||||
.get_active_render_target = grub_video_fb_get_active_render_target,
|
||||
.iterate = grub_video_vbe_iterate,
|
||||
.get_edid = grub_video_vbe_get_edid,
|
||||
.print_adapter_specific_info = grub_video_vbe_print_adapter_specific_info,
|
||||
|
||||
.next = 0
|
||||
|
|
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);
|
||||
}
|
|
@ -376,6 +376,50 @@ grub_video_get_active_render_target (struct grub_video_render_target **target)
|
|||
return grub_video_adapter_active->get_active_render_target (target);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_video_edid_checksum (struct grub_video_edid_info *edid_info)
|
||||
{
|
||||
const char *edid_bytes = (const char *) edid_info;
|
||||
int i;
|
||||
char checksum = 0;
|
||||
|
||||
/* Check EDID checksum. */
|
||||
for (i = 0; i < 128; ++i)
|
||||
checksum += edid_bytes[i];
|
||||
|
||||
if (checksum != 0)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
"invalid EDID checksum %d", checksum);
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
|
||||
unsigned int *width, unsigned int *height)
|
||||
{
|
||||
/* Bit 1 in the Feature Support field indicates that the first
|
||||
Detailed Timing Description is the preferred timing mode. */
|
||||
if (edid_info->version == 1 /* we don't understand later versions */
|
||||
&& (edid_info->feature_support
|
||||
& GRUB_VIDEO_EDID_FEATURE_PREFERRED_TIMING_MODE)
|
||||
&& edid_info->detailed_timings[0].pixel_clock)
|
||||
{
|
||||
*width = edid_info->detailed_timings[0].horizontal_active_lo
|
||||
| (((unsigned int)
|
||||
(edid_info->detailed_timings[0].horizontal_hi & 0xf0))
|
||||
<< 4);
|
||||
*height = edid_info->detailed_timings[0].vertical_active_lo
|
||||
| (((unsigned int)
|
||||
(edid_info->detailed_timings[0].vertical_hi & 0xf0))
|
||||
<< 4);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "no preferred mode available");
|
||||
}
|
||||
|
||||
/* Parse <width>x<height>[x<depth>]*/
|
||||
static grub_err_t
|
||||
parse_modespec (const char *current_mode, int *width, int *height, int *depth)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue