Remove early sm712 init as there is no reason for it (the "watchdog"

effect was due to wrong GPIO map).
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-07-11 16:24:35 +02:00
parent 139072b83a
commit 9c28da2a89
5 changed files with 15 additions and 156 deletions

View File

@ -1,3 +1,8 @@
2013-07-11 Vladimir Serbinenko <phcoder@gmail.com>
Remove early sm712 init as there is no reason for it (the "watchdog"
effect was due to wrong GPIO map).
2013-07-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/pcidump.c: Remove static variables.

View File

@ -40,15 +40,6 @@ trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
./gentrigtables > $@
CLEANFILES += trigtables.c
gensm712: video/sm712.c
$(BUILD_CC) -DGENINIT -o $@ -I$(top_builddir) -I$(top_builddir)/include -I$(top_srcdir)/include $(CPPFLAGS) $<
CLEANFILES += gensm712
# trigtables.c
sm712_start.h: gensm712 video/sm712.c $(top_srcdir)/configure.ac
$(builddir)/gensm712 > $@
CLEANFILES += sm712_start.h
# XXX Use Automake's LEX & YACC support
grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $<

View File

@ -405,7 +405,6 @@ image = {
image = {
name = fwstart;
mips_loongson = boot/mips/loongson/fwstart.S;
mips_loongson_nodist = sm712_start.h;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;

View File

@ -754,140 +754,3 @@ continue:
#endif
cached_continue:
#ifndef FULOONG2F
/* We have to init video early enough or watchdog will reboot us. */
/* Setup PCI controller. */
lui $t0, %hi (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO)
lui $t1, %hi(0x8000000c)
addiu $t1, $t1, %lo(0x8000000c)
sw $t1, %lo (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO) ($t0)
li $t1, 0xffffffff
sw $t1, %lo (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI) ($t0)
li $t0, GRUB_MACHINE_PCI_CONTROLLER_HEADER
li $t1, (GRUB_PCI_COMMAND_PARITY_ERROR | GRUB_PCI_COMMAND_BUS_MASTER \
| GRUB_PCI_COMMAND_MEM_ENABLED)
sh $t0, GRUB_PCI_REG_COMMAND ($t1)
li $t1, ((1 << GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT) \
| GRUB_PCI_STATUS_FAST_B2B_CAPABLE \
| GRUB_PCI_STATUS_66MHZ_CAPABLE \
| GRUB_PCI_STATUS_CAPABILITIES)
sh $t0, GRUB_PCI_REG_STATUS ($t1)
li $t0, 0xff
sw $t0, GRUB_PCI_REG_CACHELINE ($t1)
lui $t1, %hi(0x80000000 | GRUB_PCI_ADDR_MEM_TYPE_64 \
| GRUB_PCI_ADDR_MEM_PREFETCH)
addiu $t1, $t1, %lo(0x80000000 | GRUB_PCI_ADDR_MEM_TYPE_64 \
| GRUB_PCI_ADDR_MEM_PREFETCH)
sw $t0, GRUB_PCI_REG_ADDRESS_REG0 ($t1)
sw $zero, GRUB_PCI_REG_ADDRESS_REG1 ($t1)
/* Find video. */
/* $t4 chooses device in priority encoding. */
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
This way we don't need to sacrifice a register for it. */
retry_sm712:
/* We have only one bus (0). Function is 0. */
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
lui $t3, %hi(GRUB_SM712_PCIID)
addiu $t3, $t3, %lo(GRUB_SM712_PCIID)
ori $t4, $zero, 1
1:
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
/* In case of failure try again. SM712 may be slow to come up. */
beql $t4, $zero, retry_sm712
nop
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
bnel $t2, $t3, 1b
sll $t4, $t4, 1
/* FIXME: choose address dynamically if needed. */
#define SM712_MAP 0x04000000
lui $t2, %hi(SM712_MAP)
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_ADDRESS_REG0) ($t1)
/* Set latency. */
li $t2, 0x8
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_CACHELINE) ($t1)
/* Enable address spaces. */
li $t2, 0x7
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_COMMAND) ($t1)
lui $t3, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX)
li $t2, 0x18
sb $t2, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX)($t3)
lui $t3, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA)
li $t2, 0x11
sb $t2, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA)($t3)
li $t2, ((((SM712_MAP & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK) \
>> GRUB_MACHINE_PCI_WIN_SHIFT) \
& GRUB_MACHINE_PCI_WIN_MASK))
lui $t3, %hi(0xbfe00110)
addiu $t3, $t3, %lo(0xbfe00110)
sw $t2, 0 ($t3)
li $t2, (GRUB_MACHINE_PCI_WIN1_ADDR \
| (SM712_MAP & GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
lui $t3, %hi(GRUB_SM712_REG_BASE)
addiu $t3, $t3, %lo(GRUB_SM712_REG_BASE)
addu $t2, $t2, $t3
lui $t0, %hi(init_table - 0x20000000)
addiu $t0, $t0, %lo(init_table - 0x20000000)
lui $t1, %hi(init_table_end - 0x20000000)
addiu $t1, $t1, %lo(init_table_end - 0x20000000)
li $t5, 0x80
addiu $t6, $t2, 0x3c0
table_cont:
lb $t3, 0($t0)
andi $t5, $t3, 0x80
andi $t3, $t3, 0x7f
addu $t3, $t3, $t6
lb $t4, 1($t0)
bne $zero, $t5, 1f
addiu $t0, $t0, 2
b 2f
sb $t4, 0($t3)
1:
lb $t4, 0($t3)
2:
bne $t0, $t1, table_cont
nop
lui $t3, %hi(0x40c000 - GRUB_SM712_REG_BASE)
addiu $t3, $t3, %lo(0x40c000 - GRUB_SM712_REG_BASE)
addu $t1, $t2, $t3
sw $zero, 0xc ($t1)
sw $zero, 0x40 ($t1)
li $t3, 0x20000
sw $t3, 0x0 ($t1)
lui $t3, %hi(0x1020100)
addiu $t3, $t3, %lo(0x1020100)
sw $t3, 0x10 ($t1)
li $t4, 0x16
sb $t4, GRUB_VGA_IO_SR_INDEX($t2)
lb $t4, GRUB_VGA_IO_SR_DATA($t2)
b init_end
nop
init_table:
#include "sm712_start.h"
init_table_end:
.align 4
init_end:
#endif

View File

@ -1407,15 +1407,16 @@ generate_image (const char *dir, const char *prefix,
/* fwstart.img is the only part which can't be tested by using *-elf
target. Check it against the checksum. */
const grub_uint8_t yeeloong_fwstart_good_hash[512 / 8] =
{
0x11, 0x7f, 0xfd, 0x7e, 0xd9, 0xbb, 0x82, 0xe7,
0x5f, 0xcc, 0xbf, 0x09, 0x1d, 0xfe, 0xfa, 0xd5,
0x97, 0xfb, 0xbb, 0xd8, 0x76, 0x4b, 0xfc, 0x0a,
0x4e, 0x3c, 0x91, 0x06, 0x98, 0xa0, 0xe0, 0xda,
0x4f, 0x74, 0x17, 0x6f, 0x95, 0xd2, 0xec, 0x1b,
0x7f, 0x12, 0x80, 0x23, 0xcb, 0xa0, 0x2d, 0x59,
0x15, 0x82, 0x70, 0x3d, 0x23, 0xbf, 0xee, 0x93,
0x5e, 0x5c, 0xbd, 0x1c, 0x51, 0x0b, 0x0b, 0x45 };
{
0x5f, 0x67, 0x46, 0x57, 0x31, 0x30, 0xc5, 0x0a,
0xe9, 0x98, 0x18, 0xc9, 0xf3, 0xca, 0x45, 0xa5,
0x75, 0x64, 0x6b, 0xbb, 0x24, 0xcd, 0xb4, 0xbc,
0xf2, 0x3e, 0x23, 0xf9, 0xc2, 0x6a, 0x8c, 0xde,
0x3b, 0x94, 0x9c, 0xcc, 0xa5, 0xa7, 0x58, 0xb1,
0xbe, 0x8b, 0x3d, 0x73, 0x98, 0x18, 0x7e, 0x68,
0x5e, 0x5f, 0x23, 0x7d, 0x7a, 0xe8, 0x51, 0xf7,
0x1a, 0xaf, 0x2f, 0x54, 0x11, 0x2e, 0x5c, 0x25
};
const grub_uint8_t fuloong2f_fwstart_good_hash[512 / 8] =
{
0x76, 0x9b, 0xad, 0x6e, 0xa2, 0x39, 0x47, 0x62,