All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Hicks <mort@wildopensource.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] runtime platform detection in GENERIC kernels
Date: Wed, 14 May 2003 15:03:46 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590723705791@msgid-missing> (raw)

[-- 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 --]

             reply	other threads:[~2003-05-14 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-14 15:03 Martin Hicks [this message]
2003-05-14 15:32 ` [Linux-ia64] runtime platform detection in GENERIC kernels 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590723705791@msgid-missing \
    --to=mort@wildopensource.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.