From 9b0ad543fe5138b1638a91888e34ad99cdf16616 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 14 Aug 2009 03:35:14 +0200 Subject: [PATCH 03/10] Palm-multiarch patch --- sys/arch/palm/include/palm_var.h | 16 +++++++ sys/arch/palm/palm/palm_machdep.c | 88 +++++-------------------------------- 2 files changed, 28 insertions(+), 76 deletions(-) diff --git a/sys/arch/palm/include/palm_var.h b/sys/arch/palm/include/palm_var.h index a0adc90..d950960 100644 --- a/sys/arch/palm/include/palm_var.h +++ b/sys/arch/palm/include/palm_var.h @@ -39,6 +39,22 @@ #include #include + +extern int mach; + +#define mach_is_palmt5 ( mach == 917 ? 1 : 0 ) +#define mach_is_palmtx ( mach == 885 ? 1 : 0 ) +#define mach_is_palmld ( mach == 835 ? 1 : 0 ) +#define mach_is_palmz72 ( mach == 904 ? 1 : 0 ) + +static inline char *mach_name(void) +{ + if (mach_is_palmt5) return "Palm Tungsten|T5"; + else if (mach_is_palmtx) return "Palm T|X"; + else if (mach_is_palmld) return "Palm LifeDrive"; + else if (mach_is_palmz72) return "Palm Zire72"; + else return "Unknown"; +} #endif #ifdef _KERNEL diff --git a/sys/arch/palm/palm/palm_machdep.c b/sys/arch/palm/palm/palm_machdep.c index d0b3260..501cf2b 100644 --- a/sys/arch/palm/palm/palm_machdep.c +++ b/sys/arch/palm/palm/palm_machdep.c @@ -154,6 +154,8 @@ #include "wsdisplay.h" +int mach = -1; /* machine ID */ + /* Kernel text starts 2MB in from the bottom of the kernel address space. */ #define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000) #define KERNEL_VM_BASE (KERNEL_BASE + SDRAM_SIZE) @@ -236,7 +238,7 @@ extern struct user *proc0paddr; #define BOOT_STRING_MAGIC 0x4f425344 char bootargs[MAX_BOOT_STRING]; -void process_kernel_args(char *); +inline void process_kernel_args(int *); void consinit(void); void early_clkman(u_int, int); @@ -590,7 +592,7 @@ initarm(void *arg) */ /* XXX should really be done after setting up the console, but we * XXX need to parse the console selection flags right now. */ -// process_kernel_args((char *)0xa0200000 - MAX_BOOT_STRING - 1); + process_kernel_args((int *)0x5c000000); /* * This test will work for now but has to be revised when support @@ -1080,81 +1082,14 @@ initarm(void *arg) const char *console = "glass"; -void -process_kernel_args(char *args) +inline void +process_kernel_args(int *args) { - char *cp = args; - - if (cp == NULL || *(int *)cp != BOOT_STRING_MAGIC) { - boothowto = RB_AUTOBOOT; - return; - } - - /* Eat the cookie */ - *(int *)cp = 0; - cp += sizeof(int); - - boothowto = 0; - - /* Make a local copy of the bootargs */ - strncpy(bootargs, cp, MAX_BOOT_STRING - sizeof(int)); - - cp = bootargs; - boot_file = bootargs; - - /* Skip the kernel image filename */ - while (*cp != ' ' && *cp != 0) - ++cp; - - if (*cp != 0) - *cp++ = 0; - - while (*cp == ' ') - ++cp; - - boot_args = cp; - - printf("bootfile: %s\n", boot_file); - printf("bootargs: %s\n", boot_args); - - /* Setup pointer to boot flags */ - while (*cp != '-') - if (*cp++ == '\0') - return; - - for (;*++cp;) { - int fl; - - fl = 0; - switch(*cp) { - case 'a': - fl |= RB_ASKNAME; - break; - case 'c': - fl |= RB_CONFIG; - break; - case 'd': - fl |= RB_KDB; - break; - case 's': - fl |= RB_SINGLE; - break; - /* XXX undocumented console switching flags */ - case '0': - console = "ffuart"; - break; - case '1': - console = "btuart"; - break; - case '2': - console = "stuart"; - break; - default: - printf("unknown option `%c'\n", *cp); - break; - } - boothowto |= fl; - } + if (args[0] == 917 || /* Palm T5 */ + args[0] == 885 || /* Palm TX */ + args[0] == 835 || /* Palm LD */ + args[0] == 904) /* Palm Z72 */ + mach = args[0]; } #ifdef KGDB @@ -1284,6 +1219,7 @@ board_startup(void) */ extern const char copyright[]; printf("%s\n", copyright); + printf("OpenBSD running on: %s\n", mach_name()); } // } #endif -- 1.6.3.4