Update ia64 patch to 2.5.69-030521, throwing away the parts included
[linux-flexiantxendom0-3.2.10.git] / arch / ia64 / sn / fakeprom / fw-emu.c
index 792abb0..ce5c919 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
  *
  *
- * Copyright (C) 2000-2002 Silicon Graphics, Inc.  All rights reserved.
+ * Copyright (C) 2000-2003 Silicon Graphics, Inc.  All rights reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it 
  * under the terms of version 2 of the GNU General Public License 
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan
  */
 #include <linux/config.h>
-#include <asm/sn/pda.h>
 #include <linux/efi.h>
 #include <asm/pal.h>
 #include <asm/sal.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/processor.h>
 #include <asm/sn/sn_cpuid.h>
-#ifdef CONFIG_IA64_SGI_SN2
+#ifdef SGI_SN2
 #include <asm/sn/sn2/addrs.h>
 #include <asm/sn/sn2/shub_mmr.h>
 #endif
 #define ACPI_SLIT_REVISION 1
 
 #define OEMID                  "SGI"
-#ifdef CONFIG_IA64_SGI_SN1
-#define PRODUCT                        "SN1"
-#define PROXIMITY_DOMAIN(nasid)        (nasid)
-#else
+#ifdef SGI_SN2
 #define PRODUCT                        "SN2"
 #define PROXIMITY_DOMAIN(nasid)        (((nasid)>>1) & 255)
 #endif
 
 typedef union ia64_nasid_va {
         struct {
-#if defined(CONFIG_IA64_SGI_SN1)
-                unsigned long off   : 33;       /* intra-region offset */
-               unsigned long nasid :  7;       /* NASID */
-               unsigned long off2  : 21;       /* fill */
-                unsigned long reg   :  3;       /* region number */
-#elif defined(CONFIG_IA64_SGI_SN2)
+#if defined(SGI_SN2)
                 unsigned long off   : 36;       /* intra-region offset */
                unsigned long attr  :  2;
                unsigned long nasid : 11;       /* NASID */
@@ -125,9 +116,7 @@ typedef struct {
 #define IS_VIRTUAL_MODE()       ({struct ia64_psr psr; asm("mov %0=psr" : "=r"(psr)); psr.dt;})
 #define ADDR_OF(p)             (IS_VIRTUAL_MODE() ? ((void*)((long)(p)+PAGE_OFFSET)) : ((void*) (p)))
 
-#if defined(CONFIG_IA64_SGI_SN1)
-#define __fwtab_pa(n,x)                ({ia64_nasid_va _v; _v.l = (long) (x); _v.f.nasid = (x) ? (n) : 0; _v.f.reg = 0; _v.l;})
-#elif defined(CONFIG_IA64_SGI_SN2)
+#if defined(SGI_SN2)
 #define __fwtab_pa(n,x)                ({ia64_nasid_va _v; _v.l = (long) (x); _v.f.nasid = (x) ? (n) : 0; _v.f.reg = 0; _v.f.attr = 3; _v.l;})
 #endif
 
@@ -208,7 +197,7 @@ efi_unimplemented (void)
        return EFI_UNSUPPORTED;
 }
 
-#ifdef CONFIG_IA64_SGI_SN2
+#ifdef SGI_SN2
 
 #undef cpu_physical_id
 #define cpu_physical_id(cpuid)                  ((ia64_get_lid() >> 16) & 0xffff)
@@ -301,7 +290,7 @@ sal_emulator (long index, unsigned long in1, unsigned long in2,
                ;
        } else if (index == SAL_UPDATE_PAL) {
                ;
-#ifdef CONFIG_IA64_SGI_SN2
+#ifdef SGI_SN2
        } else if (index == SN_SAL_LOG_CE) {
 #ifdef ajmtestcpei
                fprom_send_cpei();
@@ -501,9 +490,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
        /*
         * Pass the parameter base address to the build_efi_xxx routines.
         */
-#if defined(CONFIG_IA64_SGI_SN1)
-       build_init(8LL*GB*base_nasid);
-#else
+#if defined(SGI_SN2)
        build_init(0x3000000000UL | ((long)base_nasid<<38));
 #endif
 
@@ -559,7 +546,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
         * You can also edit this line to pass other arguments to the kernel.
         *    Note: disable kernel text replication.
         */
-       strcpy(cmd_line, "init=/bin/bash ktreplicate=0");
+       strcpy(cmd_line, "init=/bin/bash console=ttyS0");
 
        memset(efi_systab, 0, sizeof(efi_systab));
        efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE;
@@ -625,10 +612,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
                        lsapic20->header.length = sizeof(struct acpi_table_lsapic);
                        lsapic20->acpi_id = cnode*4+cpu;
                        lsapic20->flags.enabled = 1;
-#if defined(CONFIG_IA64_SGI_SN1)
-                       lsapic20->eid = cpu;
-                       lsapic20->id = nasid;
-#else
+#if defined(SGI_SN2)
                        lsapic20->eid = nasid&0xffff;
                        lsapic20->id = (cpu<<4) | (nasid>>16);
 #endif
@@ -649,12 +633,9 @@ sys_fw_init (const char *args, int arglen, int bsp)
                srat_memory_affinity->proximity_domain = PROXIMITY_DOMAIN(nasid);
                srat_memory_affinity->base_addr_lo = 0;
                srat_memory_affinity->length_lo = 0;
-#if defined(CONFIG_IA64_SGI_SN1)
-               srat_memory_affinity->base_addr_hi = nasid<<1;
-               srat_memory_affinity->length_hi = SN1_NODE_SIZE>>32;
-#else
+#if defined(SGI_SN2)
                srat_memory_affinity->base_addr_hi = (nasid<<6) | (3<<4);
-               srat_memory_affinity->length_hi = SN2_NODE_SIZE>>32;
+               srat_memory_affinity->length_hi = (MD_BANKSIZE*MD_BANKS_PER_NODE)>>32;
 #endif
                srat_memory_affinity->memory_type = ACPI_ADDRESS_RANGE_MEMORY;
                srat_memory_affinity->flags.enabled = 1;
@@ -671,10 +652,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
                        srat_cpu_affinity->header.length = sizeof(struct acpi_table_processor_affinity);
                        srat_cpu_affinity->proximity_domain = PROXIMITY_DOMAIN(nasid);
                        srat_cpu_affinity->flags.enabled = 1;
-#if defined(CONFIG_IA64_SGI_SN1)
-                       srat_cpu_affinity->apic_id = nasid;
-                       srat_cpu_affinity->lsapic_eid = cpu;
-#else
+#if defined(SGI_SN2)
                        srat_cpu_affinity->lsapic_eid = nasid&0xffff;
                        srat_cpu_affinity->apic_id = (cpu<<4) | (nasid>>16);
 #endif
@@ -708,7 +686,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
        sal_systab->sal_b_rev_minor = 0x0; /* 1.00 */
 
        strcpy(sal_systab->oem_id, "SGI");
-       strcpy(sal_systab->product_id, "SN1");
+       strcpy(sal_systab->product_id, "SN2");
 
        /* fill in an entry point: */   
        sal_ed->type = SAL_DESC_ENTRY_POINT;
@@ -757,7 +735,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
        sal_systab->checksum = -checksum;
 
        /* If the checksum is correct, the kernel tries to use the
-        * table. We don't build enough table & the kernel aborts.
+        * table. We dont build enough table & the kernel aborts.
         * Note that the PROM hasd thhhe same problem!!
         */
 
@@ -786,9 +764,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
                for(cpu=0; cpu<CPUS_PER_NODE; cpu++) {
                        if (!IsCpuPresent(cnode, cpu))
                                continue;
-#ifdef CONFIG_IA64_SGI_SN1
-                       bsp_lid = (GetNasid(cnode)<<24) | (cpu<<16);
-#else
+#ifdef SGI_SN2
                        bsp_lid = (GetNasid(cnode)<<16) | (cpu<<28);
 #endif
                        if (bsp-- > 0)