ia64/xen-unstable

changeset 13904:6c63ff548888

[IA64] Fix serial console on Tiger2 & Tiger4

I inadvertently broke the serial console on Intel Tiger systems by
assuming they were registering a com1 at 0x3f8. Instead, unconditionally
register both com ports (the ns16550 driver will throw away any that
don't have baud == 0) and create a function to detect the Tiger systems.
This should setup reasonable default com port values, but they can still
be superceded using com1= and com2= boot time parameters.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild2.aw
date Wed Feb 14 10:14:37 2007 -0700 (2007-02-14)
parents 8bdbe88e422f
children 2b3dd681dbce
files xen/arch/ia64/linux-xen/setup.c xen/arch/ia64/xen/pcdp.c xen/arch/ia64/xen/xensetup.c
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/setup.c	Mon Feb 12 10:10:37 2007 -0700
     1.2 +++ b/xen/arch/ia64/linux-xen/setup.c	Wed Feb 14 10:14:37 2007 -0700
     1.3 @@ -314,6 +314,74 @@ io_port_init (void)
     1.4  	num_io_spaces = 1;
     1.5  }
     1.6  
     1.7 +#ifdef XEN
     1.8 +static int __init
     1.9 +intel_tiger_console_setup(void)
    1.10 +{
    1.11 +	extern struct ns16550_defaults ns16550_com1, ns16550_com2;
    1.12 +	efi_system_table_t *systab;
    1.13 +	efi_config_table_t *tables;
    1.14 +	struct acpi20_table_rsdp *rsdp = NULL;
    1.15 +	struct acpi_table_xsdt *xsdt;
    1.16 +	struct acpi_table_header *hdr;
    1.17 +	int i;
    1.18 +
    1.19 +	/* Don't duplicate setup if an HCDP table is present */
    1.20 +	if (efi.hcdp)
    1.21 +		return -ENODEV;
    1.22 +
    1.23 +	/* Manually walk firmware provided tables to get to the XSDT.  */
    1.24 +	systab = __va(ia64_boot_param->efi_systab);
    1.25 +
    1.26 +	if (!systab || systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
    1.27 +		return -ENODEV;
    1.28 +
    1.29 +	tables = __va(systab->tables);
    1.30 +
    1.31 +	for (i = 0 ; i < (int)systab->nr_tables && !rsdp ; i++) {
    1.32 +		if (efi_guidcmp(tables[i].guid, ACPI_20_TABLE_GUID) == 0)
    1.33 +			rsdp =
    1.34 +			     (struct acpi20_table_rsdp *)__va(tables[i].table);
    1.35 +	}
    1.36 +
    1.37 +	if (!rsdp || strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1))
    1.38 +		return -ENODEV;
    1.39 +
    1.40 +	xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
    1.41 +	hdr = &xsdt->header;
    1.42 +
    1.43 +	if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1))
    1.44 +		return -ENODEV;
    1.45 +
    1.46 +	/* Only looking for Intel systems */
    1.47 +	if (strncmp(hdr->oem_id, "INTEL", 5))
    1.48 +		return -ENODEV;
    1.49 +
    1.50 +	if (!strncmp(hdr->oem_table_id, "SR870BH2", 8)) {
    1.51 +		/* Tiger 2 */
    1.52 +		ns16550_com1.baud = BAUD_AUTO;
    1.53 +		ns16550_com1.io_base = 0x3f8;
    1.54 +		ns16550_com1.irq = 4;
    1.55 +
    1.56 +		ns16550_com2.baud = BAUD_AUTO;
    1.57 +		ns16550_com2.io_base = 0x2f8;
    1.58 +		ns16550_com2.irq = 3;
    1.59 +
    1.60 +		return 0;
    1.61 +
    1.62 +	} else if (!strncmp(hdr->oem_table_id, "SR870BN4", 8)) {
    1.63 +		/* Tiger 4 */
    1.64 +		ns16550_com1.baud = BAUD_AUTO;
    1.65 +		ns16550_com1.io_base = 0x2f8;
    1.66 +		ns16550_com1.irq = 3;
    1.67 +		
    1.68 +		return 0;
    1.69 +	}
    1.70 +
    1.71 +	return -ENODEV;
    1.72 +}
    1.73 +#endif
    1.74 +
    1.75  /**
    1.76   * early_console_setup - setup debugging console
    1.77   *
    1.78 @@ -344,6 +412,10 @@ early_console_setup (char *cmdline)
    1.79  		earlycons++;
    1.80  #endif
    1.81  
    1.82 +#ifdef XEN
    1.83 +	if (!intel_tiger_console_setup())
    1.84 +		earlycons++;
    1.85 +#endif
    1.86  	return (earlycons) ? 0 : -1;
    1.87  }
    1.88  
     2.1 --- a/xen/arch/ia64/xen/pcdp.c	Mon Feb 12 10:10:37 2007 -0700
     2.2 +++ b/xen/arch/ia64/xen/pcdp.c	Wed Feb 14 10:14:37 2007 -0700
     2.3 @@ -140,7 +140,7 @@ static int __init
     2.4  setup_serial_console(struct pcdp *pcdp, struct pcdp_uart *uart)
     2.5  {
     2.6  
     2.7 -	ns16550_com1.baud = uart->baud;
     2.8 +	ns16550_com1.baud = uart->baud ? uart->baud : BAUD_AUTO;
     2.9  	ns16550_com1.io_base = uart->addr.address;
    2.10  	if (uart->bits)
    2.11  		ns16550_com1.data_bits = uart->bits;
     3.1 --- a/xen/arch/ia64/xen/xensetup.c	Mon Feb 12 10:10:37 2007 -0700
     3.2 +++ b/xen/arch/ia64/xen/xensetup.c	Wed Feb 14 10:14:37 2007 -0700
     3.3 @@ -147,7 +147,6 @@ void early_cmdline_parse(char **cmdline_
     3.4  }
     3.5  
     3.6  struct ns16550_defaults ns16550_com1 = {
     3.7 -    .baud      = BAUD_AUTO,
     3.8      .data_bits = 8,
     3.9      .parity    = 'n',
    3.10      .stop_bits = 1
    3.11 @@ -158,7 +157,6 @@ unsigned int ns16550_com1_polarity;
    3.12  unsigned int ns16550_com1_trigger;
    3.13  
    3.14  struct ns16550_defaults ns16550_com2 = {
    3.15 -    .baud      = BAUD_AUTO,
    3.16      .data_bits = 8,
    3.17      .parity    = 'n',
    3.18      .stop_bits = 1
    3.19 @@ -271,12 +269,7 @@ void start_kernel(void)
    3.20          hpsim_serial_init();
    3.21      else {
    3.22          ns16550_init(0, &ns16550_com1);
    3.23 -        if (ns16550_com1.io_base == 0x3f8) {
    3.24 -            /* Also init com2 for Tiger4. */
    3.25 -            ns16550_com2.io_base = 0x2f8;
    3.26 -            ns16550_com2.irq     = 3;
    3.27 -            ns16550_init(1, &ns16550_com2);
    3.28 -        }
    3.29 +        ns16550_init(1, &ns16550_com2);
    3.30      }
    3.31      serial_init_preirq();
    3.32