Properly init even without pmon parameters
This commit is contained in:
parent
813a5f2d33
commit
5dd8753cc0
2 changed files with 62 additions and 3 deletions
|
@ -48,7 +48,14 @@ codestart:
|
||||||
/* Parse arguments. Has to be done before relocation.
|
/* Parse arguments. Has to be done before relocation.
|
||||||
So need to do it in asm. */
|
So need to do it in asm. */
|
||||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||||
|
move $s2, $zero
|
||||||
|
move $s3, $zero
|
||||||
|
move $s4, $zero
|
||||||
|
move $s5, $zero
|
||||||
|
|
||||||
/* $a2 has the environment. */
|
/* $a2 has the environment. */
|
||||||
|
addiu $t0, $a2, 1
|
||||||
|
beq $t0, $zero, argdone
|
||||||
move $t0, $a2
|
move $t0, $a2
|
||||||
argcont:
|
argcont:
|
||||||
lw $t1, 0($t0)
|
lw $t1, 0($t0)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/cpu/kernel.h>
|
#include <grub/cpu/kernel.h>
|
||||||
|
#include <grub/cs5536.h>
|
||||||
|
|
||||||
extern void grub_video_sm712_init (void);
|
extern void grub_video_sm712_init (void);
|
||||||
extern void grub_video_video_init (void);
|
extern void grub_video_video_init (void);
|
||||||
|
@ -89,16 +90,67 @@ void
|
||||||
grub_machine_init (void)
|
grub_machine_init (void)
|
||||||
{
|
{
|
||||||
void *modend;
|
void *modend;
|
||||||
|
|
||||||
|
/* FIXME: measure this. */
|
||||||
|
if (grub_arch_busclock == 0)
|
||||||
|
{
|
||||||
|
grub_arch_busclock = 66000000;
|
||||||
|
grub_arch_cpuclock = 797000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
||||||
|
|
||||||
|
if (grub_arch_memsize == 0)
|
||||||
|
{
|
||||||
|
grub_port_t smbbase;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_pci_device_t dev;
|
||||||
|
struct grub_smbus_spd spd;
|
||||||
|
unsigned totalmem;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!grub_cs5536_find (&dev))
|
||||||
|
grub_fatal ("No CS5536 found\n");
|
||||||
|
|
||||||
|
err = grub_cs5536_init_smbus (dev, 0x7ff, &smbbase);
|
||||||
|
if (err)
|
||||||
|
grub_fatal ("Couldn't init SMBus: %s\n", grub_errmsg);
|
||||||
|
|
||||||
|
/* Yeeloong has only one memory slot. */
|
||||||
|
err = grub_cs5536_read_spd (smbbase, GRUB_SMB_RAM_START_ADDR, &spd);
|
||||||
|
if (err)
|
||||||
|
grub_fatal ("Couldn't read SPD: %s\n", grub_errmsg);
|
||||||
|
for (i = 5; i < 13; i++)
|
||||||
|
if (spd.ddr2.rank_capacity & (1 << (i & 7)))
|
||||||
|
break;
|
||||||
|
/* Something is wrong. */
|
||||||
|
if (i == 13)
|
||||||
|
totalmem = 256;
|
||||||
|
else
|
||||||
|
totalmem = ((spd.ddr2.num_of_ranks
|
||||||
|
& GRUB_SMBUS_SPD_MEMORY_NUM_OF_RANKS_MASK) + 1) << (i + 2);
|
||||||
|
|
||||||
|
if (totalmem >= 256)
|
||||||
|
{
|
||||||
|
grub_arch_memsize = 256;
|
||||||
|
grub_arch_highmemsize = totalmem - 256;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_arch_memsize = (totalmem >> 20);
|
||||||
|
grub_arch_highmemsize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modend = get_modules_end ();
|
modend = get_modules_end ();
|
||||||
grub_mm_init_region (modend, (grub_arch_memsize << 20)
|
grub_mm_init_region (modend, (grub_arch_memsize << 20)
|
||||||
- (((grub_addr_t) modend) - GRUB_ARCH_LOWMEMVSTART));
|
- (((grub_addr_t) modend) - GRUB_ARCH_LOWMEMVSTART));
|
||||||
/* FIXME: use upper memory as well. */
|
/* FIXME: use upper memory as well. */
|
||||||
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
|
||||||
|
|
||||||
/* Initialize output terminal (can't be done earlier, as gfxterm
|
/* Initialize output terminal (can't be done earlier, as gfxterm
|
||||||
relies on a working heap. */
|
relies on a working heap. */
|
||||||
grub_video_sm712_init ();
|
|
||||||
grub_video_video_init ();
|
grub_video_video_init ();
|
||||||
|
grub_video_sm712_init ();
|
||||||
grub_video_bitmap_init ();
|
grub_video_bitmap_init ();
|
||||||
grub_font_manager_init ();
|
grub_font_manager_init ();
|
||||||
grub_term_gfxterm_init ();
|
grub_term_gfxterm_init ();
|
||||||
|
|
Loading…
Reference in a new issue