WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [patch] Introduce platform vector for dom0 fw fixup

To: Alex Williamson <alex.williamson@xxxxxx>
Subject: [Xen-ia64-devel] [patch] Introduce platform vector for dom0 fw fixup
From: Jes Sorensen <jes@xxxxxxx>
Date: Mon, 18 Jun 2007 17:07:47 +0200
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 18 Jun 2007 08:05:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.4 (X11/20060527)
Hi,

This one introduces a platform vector allowing platform specific
code to fixup mappings for dom0. We need this for sn2 to map in the
various platform specific registers (SHUB etc).

For platforms that don't need this, this call will be a noop.

Cheers,
Jes

# HG changeset patch
# User jes@xxxxxxxxxxxxxxxx
# Date 1182179096 -7200
# Node ID 6acbcc8500005bc2f6094901c53226ff218f091c
# Parent  534211a668f5617451847b883098fdb323498696
Introduce machine vector for platform specific fixups for dom0. This
is required to map SN2 specific registers to dom0.

Signed-off-by: Jes Sorensen <jes@xxxxxxx>

diff -r 534211a668f5 -r 6acbcc850000 xen/arch/ia64/xen/Makefile
--- a/xen/arch/ia64/xen/Makefile        Wed Jun 13 17:03:34 2007 +0200
+++ b/xen/arch/ia64/xen/Makefile        Mon Jun 18 17:04:56 2007 +0200
@@ -10,6 +10,7 @@ obj-y += dom_fw_dom0.o
 obj-y += dom_fw_dom0.o
 obj-y += dom_fw_domu.o
 obj-y += dom_fw_utils.o
+obj-y += dom_fw_sn2.o
 obj-y += fw_emul.o
 obj-y += hpsimserial.o
 obj-y += hypercall.o
diff -r 534211a668f5 -r 6acbcc850000 xen/arch/ia64/xen/dom_fw_utils.c
--- a/xen/arch/ia64/xen/dom_fw_utils.c  Wed Jun 13 17:03:34 2007 +0200
+++ b/xen/arch/ia64/xen/dom_fw_utils.c  Mon Jun 18 17:04:56 2007 +0200
@@ -292,6 +292,13 @@ int dom_fw_setup(domain_t * d, unsigned 
                        xfree(fw_tables);
                        return ret;
                }
+
+               ret = platform_fw_init(d, bp, fw_tables);
+               if (ret < 0) {
+                       xfree(fw_tables);
+                       return ret;
+               }
+
                if (sizeof(*fw_tables) +
                    fw_tables->num_mds * sizeof(fw_tables->efi_memmap[0]) >
                    fw_tables_size) {
diff -r 534211a668f5 -r 6acbcc850000 
xen/include/asm-ia64/linux-xen/asm/machvec.h
--- a/xen/include/asm-ia64/linux-xen/asm/machvec.h      Wed Jun 13 17:03:34 
2007 +0200
+++ b/xen/include/asm-ia64/linux-xen/asm/machvec.h      Mon Jun 18 17:04:56 
2007 +0200
@@ -191,6 +191,16 @@ machvec_noop_pci_legacy_write (struct pc
        panic("%s() called", __FUNCTION__);
        return 0;
 }
+
+typedef int ia64_mv_fw_init_t (void *d, void *bp, void *tables);
+
+static inline int
+machvec_noop_platform_fw_init (void *d, void *bp, void *tables)
+{
+       return 0;
+}
+
+
 #endif
 
 extern void machvec_setup (char **);
@@ -254,6 +264,9 @@ extern void machvec_tlb_migrate_finish (
 #  define platform_readw_relaxed        ia64_mv.readw_relaxed
 #  define platform_readl_relaxed        ia64_mv.readl_relaxed
 #  define platform_readq_relaxed        ia64_mv.readq_relaxed
+#ifdef XEN
+#  define platform_fw_init     ia64_mv.fw_init
+#endif
 # endif
 
 /* __attribute__((__aligned__(16))) is required to make size of the
@@ -302,8 +315,12 @@ struct ia64_machine_vector {
        ia64_mv_readw_relaxed_t *readw_relaxed;
        ia64_mv_readl_relaxed_t *readl_relaxed;
        ia64_mv_readq_relaxed_t *readq_relaxed;
+#ifdef XEN
+       ia64_mv_fw_init_t *fw_init;
+#endif
 } __attribute__((__aligned__(16))); /* align attrib? see above comment */
 
+#ifdef XEN
 #define MACHVEC_INIT(name)                     \
 {                                              \
        #name,                                  \
@@ -346,7 +363,53 @@ struct ia64_machine_vector {
        platform_readw_relaxed,                 \
        platform_readl_relaxed,                 \
        platform_readq_relaxed,                 \
-}
+       platform_fw_init,                       \
+}
+#else
+#define MACHVEC_INIT(name)                     \
+{                                              \
+       #name,                                  \
+       platform_setup,                         \
+       platform_cpu_init,                      \
+       platform_irq_init,                      \
+       platform_send_ipi,                      \
+       platform_timer_interrupt,               \
+       platform_global_tlb_purge,              \
+       platform_tlb_migrate_finish,            \
+       platform_dma_init,                      \
+       platform_dma_alloc_coherent,            \
+       platform_dma_free_coherent,             \
+       platform_dma_map_single,                \
+       platform_dma_unmap_single,              \
+       platform_dma_map_sg,                    \
+       platform_dma_unmap_sg,                  \
+       platform_dma_sync_single_for_cpu,       \
+       platform_dma_sync_sg_for_cpu,           \
+       platform_dma_sync_single_for_device,    \
+       platform_dma_sync_sg_for_device,        \
+       platform_dma_mapping_error,                     \
+       platform_dma_supported,                 \
+       platform_local_vector_to_irq,           \
+       platform_pci_get_legacy_mem,            \
+       platform_pci_legacy_read,               \
+       platform_pci_legacy_write,              \
+       platform_inb,                           \
+       platform_inw,                           \
+       platform_inl,                           \
+       platform_outb,                          \
+       platform_outw,                          \
+       platform_outl,                          \
+       platform_mmiowb,                        \
+       platform_readb,                         \
+       platform_readw,                         \
+       platform_readl,                         \
+       platform_readq,                         \
+       platform_readb_relaxed,                 \
+       platform_readw_relaxed,                 \
+       platform_readl_relaxed,                 \
+       platform_readq_relaxed,                 \
+}
+#endif
 
 extern struct ia64_machine_vector ia64_mv;
 extern void machvec_init (const char *name);
@@ -494,5 +557,10 @@ extern ia64_mv_dma_supported               swiotlb_dm
 #ifndef platform_readq_relaxed
 # define platform_readq_relaxed        __ia64_readq_relaxed
 #endif
+#ifdef XEN
+#ifndef platform_fw_init
+# define platform_fw_init      machvec_noop_platform_fw_init
+#endif
+#endif
 
 #endif /* _ASM_IA64_MACHVEC_H */
diff -r 534211a668f5 -r 6acbcc850000 
xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h
--- a/xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h  Wed Jun 13 17:03:34 
2007 +0200
+++ b/xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h  Mon Jun 18 17:04:56 
2007 +0200
@@ -70,6 +70,9 @@ extern ia64_mv_migrate_t              sn_migrate;
 extern ia64_mv_migrate_t               sn_migrate;
 extern ia64_mv_setup_msi_irq_t         sn_setup_msi_irq;
 extern ia64_mv_teardown_msi_irq_t      sn_teardown_msi_irq;
+#endif
+#ifdef XEN
+extern ia64_mv_fw_init_t               sn2_dom_fw_init;
 #endif
 
 
@@ -161,6 +164,10 @@ extern ia64_mv_teardown_msi_irq_t  sn_tea
 #endif
 #endif
 
+#ifdef XEN
+#define platform_fw_init               sn2_dom_fw_init
+#endif
+
 #include <asm/sn/io.h>
 
 #endif /* _ASM_IA64_MACHVEC_SN2_H */
diff -r 534211a668f5 -r 6acbcc850000 xen/arch/ia64/xen/dom_fw_sn2.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/ia64/xen/dom_fw_sn2.c    Mon Jun 18 17:04:56 2007 +0200
@@ -0,0 +1,92 @@
+/*
+ *  Xen domain0 platform firmware fixups for sn2
+ *  Copyright (C) 2007 Silicon Graphics Inc.
+ *       Jes Sorensen <jes@xxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <xen/config.h>
+#include <xen/acpi.h>
+#include <xen/errno.h>
+#include <xen/sched.h>
+#include <xen/nodemask.h>
+
+#include <asm/dom_fw.h>
+#include <asm/dom_fw_common.h>
+#include <asm/dom_fw_dom0.h>
+#include <asm/dom_fw_utils.h>
+
+#include <asm/sn/arch.h>
+#include <asm/sn/addrs.h>
+#include <asm/sn/shub_mmr.h>
+
+#define SWAP_NASID(n, x)       ((x & ~NASID_MASK) | NASID_SPACE(n))
+
+int __init
+sn2_dom_fw_init(domain_t *d,
+               struct xen_ia64_boot_param *bp,
+               struct fw_tables *tables)
+{
+       int node;
+       short nasid;
+       unsigned long shubid, shubpicam, shubpiowrite;
+
+       printk("SN2 mapping specific registers to dom0\n");
+
+       assign_domain_mach_page(d, LOCAL_MMR_OFFSET | SH_RTC, PAGE_SIZE,
+                               ASSIGN_nocache);
+
+       if (is_shub1()) {
+               /* 0x110060000 */
+               shubid = SH1_GLOBAL_MMR_OFFSET + (SH1_SHUB_ID & PAGE_MASK);
+               /* 0x120050000 */
+               shubpicam = SH1_GLOBAL_MMR_OFFSET +
+                       (SH1_PI_CAM_CONTROL & PAGE_MASK);
+               /* 0x120070000 */
+               shubpiowrite = SH1_GLOBAL_MMR_OFFSET +
+                       (SH1_PIO_WRITE_STATUS_0 & PAGE_MASK);
+
+               for_each_online_node(node) {
+                       nasid = cnodeid_to_nasid(node);
+                       shubid = SWAP_NASID(nasid, shubid);
+                       shubpicam = SWAP_NASID(nasid, shubpicam);
+                       shubpiowrite = SWAP_NASID(nasid, shubpiowrite);
+
+                       assign_domain_mach_page(d, shubid, PAGE_SIZE,
+                                               ASSIGN_nocache);
+                       assign_domain_mach_page(d, shubpicam, PAGE_SIZE,
+                                               ASSIGN_nocache);
+                       assign_domain_mach_page(d, shubpiowrite, PAGE_SIZE,
+                                               ASSIGN_nocache);
+               }
+
+               /* map leds */
+               assign_domain_mach_page(d, LOCAL_MMR_OFFSET |
+                                       SH1_REAL_JUNK_BUS_LED0,
+                                       PAGE_SIZE, ASSIGN_nocache);
+               assign_domain_mach_page(d, LOCAL_MMR_OFFSET |
+                                       SH1_REAL_JUNK_BUS_LED1,
+                                       PAGE_SIZE, ASSIGN_nocache);
+               assign_domain_mach_page(d, LOCAL_MMR_OFFSET |
+                                       SH1_REAL_JUNK_BUS_LED2,
+                                       PAGE_SIZE, ASSIGN_nocache);
+               assign_domain_mach_page(d, LOCAL_MMR_OFFSET |
+                                       SH1_REAL_JUNK_BUS_LED3,
+                                       PAGE_SIZE, ASSIGN_nocache);
+       } else
+               panic("Unable to build EFI entry for SHUB 2 MMR\n");
+
+       return 0;
+}
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>