public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] runtime platform detection in GENERIC kernels
@ 2003-05-14 15:03 Martin Hicks
  2003-05-14 15:32 ` Alex Williamson
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Martin Hicks @ 2003-05-14 15:03 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: text/plain, Size: 2899 bytes --]


Hello,

In the process of trying to get a GENERIC kernel running on SGI SN2
hardware we've run into a few instances where knowing what type of
machine we are running on is useful.  Would it be acceptable to make a
macro such as is_sgi_sn2() to check this?

One of the specific situations is in console_init()
(drivers/char/tty_io.c) where SN2 machines must use the sgi-l1_protocol
driver and the rest of the IA64 machines just use the normal serial
driver.  A small check was added:

        mac_scc_console_init();
 #elif defined(CONFIG_PARISC)
        pdc_console_init();
+#elif defined(CONFIG_IA64_GENERIC)
+       if (is_sgi_sn2())
+               sgi_l1_serial_console_init();
+       else
+               serial_console_init();
 #elif defined(CONFIG_SERIAL)
        serial_console_init();
 #endif /* CONFIG_8xx */


The current patch is attached.  It's a first draft.  I'm looking
comments on whether this (or something like it) has any chance
of being accepted, and if so, any comments on the design of
the facility.

mh


-- 
Wild Open Source Inc.                  mort@wildopensource.com



===========================================================================
Index: linux/arch/ia64/kernel/setup.c
===========================================================================

--- /usr/tmp/TmpDir.30939-0/linux/arch/ia64/kernel/setup.c_1.33	Tue May 13 14:41:50 2003
+++ linux/arch/ia64/kernel/setup.c	Tue May 13 14:38:08 2003
@@ -63,6 +63,8 @@
  struct cpuinfo_ia64 _cpu_data[NR_CPUS] __attribute__ ((section ("__special_page_section")));
 #endif
 
+int machine_is_sgi_sn2;
+
 unsigned long ia64_cycles_per_usec;
 struct ia64_boot_param *ia64_boot_param;
 struct screen_info screen_info;
@@ -446,7 +448,11 @@
 	ia64_sal_init(efi.sal_systab);
 
 #ifdef CONFIG_IA64_GENERIC
-	machvec_init(acpi_get_sysname());
+	{
+		char *str = acpi_get_sysname();
+		machvec_init(str);
+		init_is_sgi_sn2(str);
+	}
 #endif
 
 	/*

===========================================================================
Index: linux/include/asm-ia64/system.h
===========================================================================

--- /usr/tmp/TmpDir.30939-0/linux/include/asm-ia64/system.h_1.25	Tue May 13 14:41:50 2003
+++ linux/include/asm-ia64/system.h	Tue May 13 14:40:26 2003
@@ -445,6 +445,20 @@
 #define task_running(rq, p)    (((rq)->curr == (p)) || spin_is_locked(&(p)->switch_lock))
 #define idle_needs_wakeup	0
 
+#ifdef CONFIG_IA64_GENERIC
+extern int machine_is_sgi_sn2;
+#define init_is_sgi_sn2(str) do { 		\
+	if (!strcmp(str,"sn2"))			\
+		machine_is_sgi_sn2=1;		\
+  } while (0)
+
+#define is_sgi_sn2() 	(machine_is_sgi_sn2)
+#elif CONFIG_IA64_SGI_SN
+#define is_sgi_sn2()	1
+#else
+#define is_sgi_sn2()	0
+#endif /* CONFIG_IA64_GENERIC */
+
 #endif /* __KERNEL__ */
 
 #endif /* __ASSEMBLY__ */

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-05-20 19:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-14 15:03 [Linux-ia64] runtime platform detection in GENERIC kernels Martin Hicks
2003-05-14 15:32 ` Alex Williamson
2003-05-14 15:47 ` Martin Hicks
2003-05-14 20:49 ` Jes Sorensen
2003-05-16 19:21 ` Martin Hicks
2003-05-16 19:35 ` Alex Williamson
2003-05-20 19:56 ` Martin Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox