Fuloong support.

* configure.ac: Rename yeeloong platform to loongson. All users updated.
	* grub-core/Makefile.core.def (fwstart_fuloong): New image.
	* grub-core/boot/mips/loongson/fuloong.S: New file.
	* grub-core/boot/mips/loongson/fwstart.S: Wait for CS5536 to come up.
	Explicitly init CS5536.
	[FULOONG]: Don't use serial until CS5536 is available.
	Set GPIO based on dumps.
	(serial_hw_init) [FULOONG]: Handle CS5536 parts.
	[FULOONG]: Handle GPIO and memory controller differences.
	Parse machine type in $a2.
	* grub-core/boot/mips/startup_raw.S: Determine and save the
	architecture.
	* grub-core/bus/cs5536.c (gpiodump): Move to fwstart.S.
	(grub_cs5536_init_geode): Remove gpio part. Conditionalise DIVIL
	init on architecture type.
	* grub-core/kern/mips/loongson/init.c (grub_machine_init): Init
	SIS315E. Don't init at_keyboard on fuloong.
	(grub_halt): Support Fuloong.
	* grub-core/kern/mips/startup.S [LOONGSON]: Save $s7.
	* grub-core/loader/mips/linux.c (LOONGSON_MACHTYPE): Removed.
	(loongson_machtypes): New array.
	(grub_cmd_linux) [GRUB_MACHINE_MIPS_LOONGSON]: Pass the right machine
	type.
	* grub-core/term/ns8250.c (serial_get_divisor): New parameter port and
	config. All users updated. Handle CS5536 serial.
	* grub-core/term/serial.c (grub_serial_register): Conditionalise
	default port on machine type. Register serial as inactive.
	* grub-core/video/sis315pro.c: New file.
	* include/grub/cs5536.h (GRUB_CS5536_MSR_MAILBOX_CONFIG_ENABLED): New
	definition.
	(GRUB_CS5536_MSR_MAILBOX_CONFIG): Likewise.
	(GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1): Likewise.
	(GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3): Likewise.
	(GRUB_CS5536_MSR_DIVIL_UART1_CONF): Likewise.
	(GRUB_CS5536_MSR_DIVIL_UART2_CONF): Likewise.
	* include/grub/mips/loongson.h (GRUB_CPU_LOONGSON_SHUTDOWN_GPIO): Rename
	to ...
	(GRUB_CPU_YEELOONG_SHUTDOWN_GPIO): ... this.
	* include/grub/mips/loongson/kernel.h (GRUB_ARCH_MACHINE_YEELOONG): New
	definition.
	(GRUB_ARCH_MACHINE_FULOONG): Likewise.
	(grub_arch_machine): New extern var.
	* include/grub/mips/loongson/serial.h
	(GRUB_MACHINE_SERIAL_DIVISOR_115200): Renamed to ...
	(GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200): ... this.
	(GRUB_MACHINE_SERIAL_PORT): Renamed to ...
	(GRUB_MACHINE_SERIAL_PORT0): ... this.
	(GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200): New definition.
	(GRUB_MACHINE_SERIAL_PORT1): Likewise.
	(GRUB_MACHINE_SERIAL_PORT2): Likewise.
	(GRUB_MACHINE_SERIAL_PORTS): Include ports 1 and 2.
	* include/grub/term.h (grub_term_register_input_inactive): New inline
	function.
	(grub_term_register_output_inactive): Likewise.
	* include/grub/video.h (grub_video_driver_id): New value
	GRUB_VIDEO_DRIVER_SIS315PRO.
	* util/grub-mkimage.c (image_target_desc): Rename name to dirname.
	New field "names". All users updated.
	New field value IMAGE_FULOONG_FLASH.
	(generate_image): USe separate fwstart hashes for yeeloong and fuloong.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-05-15 01:43:44 +02:00
commit 5d063cdc10
37 changed files with 843 additions and 252 deletions

View file

@ -259,7 +259,7 @@ grub_keyboard_controller_write (grub_uint8_t c)
grub_outb (c, KEYBOARD_REG_DATA);
}
#if !defined (GRUB_MACHINE_MIPS_YEELOONG) && !defined (GRUB_MACHINE_QEMU)
#if !defined (GRUB_MACHINE_MIPS_LOONGSON) && !defined (GRUB_MACHINE_QEMU)
static grub_uint8_t
grub_keyboard_controller_read (void)
@ -332,7 +332,7 @@ set_scancodes (void)
return;
}
#if !(defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU))
#if !(defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU))
current_set = 1;
return;
#endif
@ -569,7 +569,7 @@ grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unus
keyboard_controller_wait_until_ready ();
grub_inb (KEYBOARD_REG_DATA);
}
#if defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU)
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU)
grub_keyboard_controller_orig = 0;
grub_keyboard_orig_set = 2;
#else

View file

@ -37,7 +37,8 @@ static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS;
/* Convert speed to divisor. */
static unsigned short
serial_get_divisor (unsigned int speed)
serial_get_divisor (const struct grub_serial_port *port,
const struct grub_serial_config *config)
{
unsigned int i;
@ -63,13 +64,16 @@ serial_get_divisor (unsigned int speed)
/* Set the baud rate. */
for (i = 0; i < ARRAY_SIZE (divisor_tab); i++)
if (divisor_tab[i].speed == speed)
/* UART in Yeeloong runs twice the usual rate. */
#ifdef GRUB_MACHINE_MIPS_YEELOONG
return 2 * divisor_tab[i].div;
#else
return divisor_tab[i].div;
if (divisor_tab[i].speed == config->speed)
{
/* internal Loongson UART runs twice the usual rate. */
#ifdef GRUB_MACHINE_MIPS_LOONGSON
if (port->port == 0xbff003f8)
return 2 * divisor_tab[i].div;
else
#endif
return divisor_tab[i].div;
}
return 0;
}
@ -93,7 +97,7 @@ do_real_config (struct grub_serial_port *port)
port->broken = 0;
divisor = serial_get_divisor (port->config.speed);
divisor = serial_get_divisor (port, &port->config);
/* Turn off the interrupt. */
grub_outb (0, port->port + UART_IER);
@ -111,8 +115,8 @@ do_real_config (struct grub_serial_port *port)
| stop_bits[port->config.stop_bits]);
grub_outb (status, port->port + UART_LCR);
/* In Yeeloong serial port has only 3 wires. */
#ifndef GRUB_MACHINE_MIPS_YEELOONG
/* On Loongson machines serial port has only 3 wires. */
#ifndef GRUB_MACHINE_MIPS_LOONGSON
/* Enable the FIFO. */
grub_outb (UART_ENABLE_FIFO_TRIGGER1, port->port + UART_FCR);
@ -188,7 +192,7 @@ serial_hw_configure (struct grub_serial_port *port,
{
unsigned short divisor;
divisor = serial_get_divisor (config->speed);
divisor = serial_get_divisor (port, config);
if (divisor == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed");

View file

@ -26,6 +26,9 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/list.h>
#ifdef GRUB_MACHINE_MIPS_LOONGSON
#include <grub/machine/kernel.h>
#endif
GRUB_MOD_LICENSE ("GPLv3+");
@ -297,18 +300,23 @@ grub_serial_register (struct grub_serial_port *port)
port->term_in = in;
port->term_out = out;
grub_terminfo_output_register (out, "vt100");
#ifdef GRUB_MACHINE_MIPS_YEELOONG
if (grub_strcmp (port->name, "com0") == 0)
#ifdef GRUB_MACHINE_MIPS_LOONGSON
if (grub_strcmp (port->name,
(grub_arch_machine == GRUB_ARCH_MACHINE_YEELOONG)
? "com0" : "com2") == 0)
{
grub_term_register_input_active ("serial_*", in);
grub_term_register_output_active ("serial_*", out);
}
else
#endif
{
grub_term_register_input ("serial_*", in);
grub_term_register_output ("serial_*", out);
grub_term_register_input_inactive ("serial_*", in);
grub_term_register_output_inactive ("serial_*", out);
}
#else
grub_term_register_input ("serial_*", in);
grub_term_register_output ("serial_*", out);
#endif
return GRUB_ERR_NONE;
}