diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/conf/platid.def src/sys/arch/hpc/conf/platid.def
--- src.orig/sys/arch/hpc/conf/platid.def	2008-05-16 23:17:43.000000000 +0900
+++ src/sys/arch/hpc/conf/platid.def	2008-05-16 23:32:48.000000000 +0900
@@ -83,6 +83,7 @@
 	}
 	XSCALE {
 		PXA250
+		PXA270
 	}
 }
 #endif /* hpcarm */
@@ -165,8 +166,9 @@
 #endif /* hpcsh */
 }
 
-#ifdef hpcmips
+#if defined(hpcmips) || defined(hpcarm)
 Sharp {
+#if defined(hpcmips)
   Tripad {
     PV {
       CPU=MIPS_VR_4111 PV6000
@@ -190,8 +192,18 @@
       CPU=MIPS_TX_3912 HC1200
     }
   }
-}
 #endif /* hpcmips */
+#if defined(hpcarm)
+  WZERO3 {
+    CPU=ARM_XSCALE_PXA270
+    WS003SH -" W-ZERO3 (WS003SH)"
+    WS004SH -" W-ZERO3 (WS004SH)"
+    WS007SH -" W-ZERO3[es] (WS007SH)"
+    WS011SH -" Advanced/W-ZERO3[es] (WS011SH)"
+  }
+#endif /* hpcarm */
+}
+#endif /* hpcmips || hpcarm */
 
 #ifdef hpcmips
 Fujitsu {
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/hpc/platid_mask.c src/sys/arch/hpc/hpc/platid_mask.c
--- src.orig/sys/arch/hpc/hpc/platid_mask.c	2008-05-16 23:17:43.000000000 +0900
+++ src/sys/arch/hpc/hpc/platid_mask.c	2008-05-17 00:07:29.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: platid_mask.c,v 1.22 2008/05/10 15:31:04 martin Exp $	*/
+/*	$NetBSD: $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -163,6 +163,10 @@
 	PLATID_CPU_ARM_XSCALE_PXA250,
 	PLATID_WILD
 }};
+platid_t platid_mask_CPU_ARM_XSCALE_PXA270 = {{
+	PLATID_CPU_ARM_XSCALE_PXA270,
+	PLATID_WILD
+}};
 #endif /* hpcarm */
 #ifdef hpcmips
 platid_t platid_mask_MACH_NEC = {{
@@ -396,11 +400,12 @@
 	PLATID_MACH_CASIO_CASSIOPEIAA_A55V
 }};
 #endif /* hpcsh */
-#ifdef hpcmips
+#if defined(hpcmips) || defined(hpcarm)
 platid_t platid_mask_MACH_SHARP = {{
 	PLATID_WILD,
 	PLATID_MACH_SHARP
 }};
+#if defined(hpcmips)
 platid_t platid_mask_MACH_SHARP_TRIPAD = {{
 	PLATID_WILD,
 	PLATID_MACH_SHARP_TRIPAD
@@ -462,6 +467,29 @@
 	PLATID_MACH_SHARP_MOBILON_HC1200
 }};
 #endif /* hpcmips */
+#if defined(hpcarm)
+platid_t platid_mask_MACH_SHARP_WZERO3 = {{
+	PLATID_WILD,
+	PLATID_MACH_SHARP_WZERO3
+}};
+platid_t platid_mask_MACH_SHARP_WZERO3_WS003SH = {{
+	PLATID_CPU_ARM_XSCALE_PXA270,
+	PLATID_MACH_SHARP_WZERO3_WS003SH
+}};
+platid_t platid_mask_MACH_SHARP_WZERO3_WS004SH = {{
+	PLATID_CPU_ARM_XSCALE_PXA270,
+	PLATID_MACH_SHARP_WZERO3_WS004SH
+}};
+platid_t platid_mask_MACH_SHARP_WZERO3_WS007SH = {{
+	PLATID_CPU_ARM_XSCALE_PXA270,
+	PLATID_MACH_SHARP_WZERO3_WS007SH
+}};
+platid_t platid_mask_MACH_SHARP_WZERO3_WS011SH = {{
+	PLATID_CPU_ARM_XSCALE_PXA270,
+	PLATID_MACH_SHARP_WZERO3_WS011SH
+}};
+#endif /* hpcarm */
+#endif /* hpcmips || hpcarm */
 #ifdef hpcmips
 platid_t platid_mask_MACH_FUJITSU = {{
 	PLATID_WILD,
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/hpc/platid_name.c src/sys/arch/hpc/hpc/platid_name.c
--- src.orig/sys/arch/hpc/hpc/platid_name.c	2008-05-16 23:17:43.000000000 +0900
+++ src/sys/arch/hpc/hpc/platid_name.c	2008-05-17 00:07:29.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: platid_name.c,v 1.22 2008/05/10 15:31:04 martin Exp $	*/
+/*	$NetBSD: $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -104,6 +104,8 @@
 	 TEXT("ARM XSCALE") },
 	{ &platid_mask_CPU_ARM_XSCALE_PXA250,
 	 TEXT("ARM XSCALE PXA250") },
+	{ &platid_mask_CPU_ARM_XSCALE_PXA270,
+	 TEXT("ARM XSCALE PXA270") },
 #endif /* hpcarm */
 #ifdef hpcmips
 	{ &platid_mask_MACH_NEC,
@@ -225,9 +227,10 @@
 	{ &platid_mask_MACH_CASIO_CASSIOPEIAA_A55V,
 	 TEXT("CASIO Cassiopeia A-55V") },
 #endif /* hpcsh */
-#ifdef hpcmips
+#if defined(hpcmips) || defined(hpcarm)
 	{ &platid_mask_MACH_SHARP,
 	 TEXT("Sharp") },
+#if defined(hpcmips)
 	{ &platid_mask_MACH_SHARP_TRIPAD,
 	 TEXT("Sharp Tripad") },
 	{ &platid_mask_MACH_SHARP_TRIPAD_PV,
@@ -259,6 +262,19 @@
 	{ &platid_mask_MACH_SHARP_MOBILON_HC1200,
 	 TEXT("Sharp Mobilon HC1200") },
 #endif /* hpcmips */
+#if defined(hpcarm)
+	{ &platid_mask_MACH_SHARP_WZERO3,
+	 TEXT("Sharp WZERO3") },
+	{ &platid_mask_MACH_SHARP_WZERO3_WS003SH,
+	 TEXT("Sharp W-ZERO3 (WS003SH)") },
+	{ &platid_mask_MACH_SHARP_WZERO3_WS004SH,
+	 TEXT("Sharp W-ZERO3 (WS004SH)") },
+	{ &platid_mask_MACH_SHARP_WZERO3_WS007SH,
+	 TEXT("Sharp W-ZERO3[es] (WS007SH)") },
+	{ &platid_mask_MACH_SHARP_WZERO3_WS011SH,
+	 TEXT("Sharp Advanced/W-ZERO3[es] (WS011SH)") },
+#endif /* hpcarm */
+#endif /* hpcmips || hpcarm */
 #ifdef hpcmips
 	{ &platid_mask_MACH_FUJITSU,
 	 TEXT("Fujitsu") },
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/include/platid_generated.h src/sys/arch/hpc/include/platid_generated.h
--- src.orig/sys/arch/hpc/include/platid_generated.h	2008-05-16 23:17:44.000000000 +0900
+++ src/sys/arch/hpc/include/platid_generated.h	2008-05-17 00:07:29.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: platid_generated.h,v 1.22 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -158,6 +158,10 @@
 #define PLATID_CPU_ARM_XSCALE_PXA250	\
   ((PLATID_CPU_ARM_XSCALE_PXA250_NUM << PLATID_CPU_MODEL_SHIFT)| \
     PLATID_CPU_ARM_XSCALE)
+#define PLATID_CPU_ARM_XSCALE_PXA270_NUM	2
+#define PLATID_CPU_ARM_XSCALE_PXA270	\
+  ((PLATID_CPU_ARM_XSCALE_PXA270_NUM << PLATID_CPU_MODEL_SHIFT)| \
+    PLATID_CPU_ARM_XSCALE)
 #endif /* hpcarm */
 #ifdef hpcmips
 #ifndef SPEC_PLATFORM
@@ -556,13 +560,14 @@
   ((PLATID_MACH_CASIO_CASSIOPEIAA_A55V_NUM << PLATID_SUBMODEL_SHIFT)| \
     PLATID_MACH_CASIO_CASSIOPEIAA_AXX)
 #endif /* hpcsh */
-#ifdef hpcmips
+#if defined(hpcmips) || defined(hpcarm)
 #ifndef SPEC_PLATFORM
 #define SPEC_MACH_SHARP
 #endif /* !SPEC_PLATFORM */
 #define PLATID_MACH_SHARP_NUM	4
 #define PLATID_MACH_SHARP	\
   ((PLATID_MACH_SHARP_NUM << PLATID_VENDOR_SHIFT))
+#if defined(hpcmips)
 #ifndef SPEC_PLATFORM
 #define SPEC_MACH_SHARP_TRIPAD
 #endif /* !SPEC_PLATFORM */
@@ -669,6 +674,44 @@
   ((PLATID_MACH_SHARP_MOBILON_HC1200_NUM << PLATID_SUBMODEL_SHIFT)| \
     PLATID_MACH_SHARP_MOBILON_HC)
 #endif /* hpcmips */
+#if defined(hpcarm)
+#ifndef SPEC_PLATFORM
+#define SPEC_MACH_SHARP_WZERO3
+#endif /* !SPEC_PLATFORM */
+#define PLATID_MACH_SHARP_WZERO3_NUM	4
+#define PLATID_MACH_SHARP_WZERO3	\
+  ((PLATID_MACH_SHARP_WZERO3_NUM << PLATID_SERIES_SHIFT)| \
+    PLATID_MACH_SHARP)
+#ifndef SPEC_PLATFORM
+#define SPEC_MACH_SHARP_WZERO3_WS003SH
+#endif /* !SPEC_PLATFORM */
+#define PLATID_MACH_SHARP_WZERO3_WS003SH_NUM	1
+#define PLATID_MACH_SHARP_WZERO3_WS003SH	\
+  ((PLATID_MACH_SHARP_WZERO3_WS003SH_NUM << PLATID_MODEL_SHIFT)| \
+    PLATID_MACH_SHARP_WZERO3)
+#ifndef SPEC_PLATFORM
+#define SPEC_MACH_SHARP_WZERO3_WS004SH
+#endif /* !SPEC_PLATFORM */
+#define PLATID_MACH_SHARP_WZERO3_WS004SH_NUM	2
+#define PLATID_MACH_SHARP_WZERO3_WS004SH	\
+  ((PLATID_MACH_SHARP_WZERO3_WS004SH_NUM << PLATID_MODEL_SHIFT)| \
+    PLATID_MACH_SHARP_WZERO3)
+#ifndef SPEC_PLATFORM
+#define SPEC_MACH_SHARP_WZERO3_WS007SH
+#endif /* !SPEC_PLATFORM */
+#define PLATID_MACH_SHARP_WZERO3_WS007SH_NUM	3
+#define PLATID_MACH_SHARP_WZERO3_WS007SH	\
+  ((PLATID_MACH_SHARP_WZERO3_WS007SH_NUM << PLATID_MODEL_SHIFT)| \
+    PLATID_MACH_SHARP_WZERO3)
+#ifndef SPEC_PLATFORM
+#define SPEC_MACH_SHARP_WZERO3_WS011SH
+#endif /* !SPEC_PLATFORM */
+#define PLATID_MACH_SHARP_WZERO3_WS011SH_NUM	4
+#define PLATID_MACH_SHARP_WZERO3_WS011SH	\
+  ((PLATID_MACH_SHARP_WZERO3_WS011SH_NUM << PLATID_MODEL_SHIFT)| \
+    PLATID_MACH_SHARP_WZERO3)
+#endif /* hpcarm */
+#endif /* hpcmips || hpcarm */
 #ifdef hpcmips
 #ifndef SPEC_PLATFORM
 #define SPEC_MACH_FUJITSU
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/include/platid_mask.h src/sys/arch/hpc/include/platid_mask.h
--- src.orig/sys/arch/hpc/include/platid_mask.h	2008-05-16 23:17:44.000000000 +0900
+++ src/sys/arch/hpc/include/platid_mask.h	2008-05-17 00:07:29.000000000 +0900
@@ -1,4 +1,4 @@
-/*	$NetBSD: platid_mask.h,v 1.22 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -161,6 +161,10 @@
 #ifdef PLATID_DEFINE_MASK_NICKNAME
 #  define GENERIC_ARM_XSCALE_PXA250 ((int)&platid_mask_CPU_ARM_XSCALE_PXA250)
 #endif
+extern platid_t platid_mask_CPU_ARM_XSCALE_PXA270;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define GENERIC_ARM_XSCALE_PXA270 ((int)&platid_mask_CPU_ARM_XSCALE_PXA270)
+#endif
 #endif /* hpcarm */
 #ifdef hpcmips
 extern platid_t platid_mask_MACH_NEC;
@@ -394,11 +398,12 @@
 #  define CASIO_CASSIOPEIAA_A55V ((int)&platid_mask_MACH_CASIO_CASSIOPEIAA_A55V)
 #endif
 #endif /* hpcsh */
-#ifdef hpcmips
+#if defined(hpcmips) || defined(hpcarm)
 extern platid_t platid_mask_MACH_SHARP;
 #ifdef PLATID_DEFINE_MASK_NICKNAME
 #  define SHARP ((int)&platid_mask_MACH_SHARP)
 #endif
+#if defined(hpcmips)
 extern platid_t platid_mask_MACH_SHARP_TRIPAD;
 #ifdef PLATID_DEFINE_MASK_NICKNAME
 #  define SHARP_TRIPAD ((int)&platid_mask_MACH_SHARP_TRIPAD)
@@ -460,6 +465,29 @@
 #  define SHARP_MOBILON_HC1200 ((int)&platid_mask_MACH_SHARP_MOBILON_HC1200)
 #endif
 #endif /* hpcmips */
+#if defined(hpcarm)
+extern platid_t platid_mask_MACH_SHARP_WZERO3;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define SHARP_WZERO3 ((int)&platid_mask_MACH_SHARP_WZERO3)
+#endif
+extern platid_t platid_mask_MACH_SHARP_WZERO3_WS003SH;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define SHARP_WZERO3_WS003SH ((int)&platid_mask_MACH_SHARP_WZERO3_WS003SH)
+#endif
+extern platid_t platid_mask_MACH_SHARP_WZERO3_WS004SH;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define SHARP_WZERO3_WS004SH ((int)&platid_mask_MACH_SHARP_WZERO3_WS004SH)
+#endif
+extern platid_t platid_mask_MACH_SHARP_WZERO3_WS007SH;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define SHARP_WZERO3_WS007SH ((int)&platid_mask_MACH_SHARP_WZERO3_WS007SH)
+#endif
+extern platid_t platid_mask_MACH_SHARP_WZERO3_WS011SH;
+#ifdef PLATID_DEFINE_MASK_NICKNAME
+#  define SHARP_WZERO3_WS011SH ((int)&platid_mask_MACH_SHARP_WZERO3_WS011SH)
+#endif
+#endif /* hpcarm */
+#endif /* hpcmips || hpcarm */
 #ifdef hpcmips
 extern platid_t platid_mask_MACH_FUJITSU;
 #ifdef PLATID_DEFINE_MASK_NICKNAME
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm.asm src/sys/arch/hpc/stand/hpcboot/arm/arm.asm
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm.asm	2008-05-08 20:40:50.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm.asm	2008-05-17 00:23:35.000000000 +0900
@@ -33,10 +33,13 @@
 ;arm.obj
 ;
 	; dummy buffer for WritebackDCache
+	EXPORT	|dcachesize|	[DATA]
 	EXPORT	|dcachebuf|	[DATA]
 	AREA	|.data|, DATA
+|dcachesize|
+	DCD	8192	; for SA1100
 |dcachebuf|
-	%	8192	; D-cache size
+	%	65536	; max D-cache size
 
 	AREA	|.text|, CODE, PIC
 
@@ -91,14 +94,17 @@
 
 	EXPORT	|WritebackDCache|
 |WritebackDCache| PROC
-	ldr	r0, [pc, #16]	; dcachebuf
-	add	r1, r0, #8192	; cache-size is 8Kbyte.
+	ldr	r0, [pc, #24]	; dcachebuf
+	ldr	r1, [pc, #24]
+	ldr	r1, [r1]	; dcache-size
+	add	r1, r1, r0
 |wbdc1|
 	ldr	r2, [r0], #32	; line-size is 32byte.
 	teq	r1, r0
 	bne	|wbdc1|
 	mov	pc, lr
 	DCD	|dcachebuf|
+	DCD	|dcachesize|
 	ENDP  ; |WritebackDCache|
 
 	EXPORT	|InvalidateDCache|
@@ -112,8 +118,10 @@
 
 	EXPORT	|WritebackInvalidateDCache|
 |WritebackInvalidateDCache| PROC
-	ldr	r0, [pc, #20]	; dcachebuf
-	add	r1, r0, #8192
+	ldr	r0, [pc, #28]	; dcachebuf
+	ldr	r1, [pc, #28]
+	ldr	r1, [r1]	; dcache-size
+	add	r1, r1, r0
 |wbidc1|
 	ldr	r2, [r0], #32
 	teq	r1, r0
@@ -121,6 +129,7 @@
 	mcr	p15, 0, r0, c7, c6, 0
 	mov	pc, lr
 	DCD	|dcachebuf|
+	DCD	|dcachesize|
 	ENDP  ; |WritebackInvalidateDCache|
 
 	;
@@ -276,229 +285,4 @@
 	ENDP  ; |GetCop15Reg14|
 ; Reg15	Test, clock, and idle (W)
 
-	; FlatJump (kaddr_t bootinfo, kaddr_t pvec, kaddr_t stack
-	;		kaddr_t jump)
-	;	bootinfo	boot information block address.
-	;	pvec		page vector of kernel.
-	;	stack		physical address of stack
-	;	jump		physical address of boot function
-	; *** MMU and pipeline behavier are SA-1100 specific. ***
-	EXPORT	|FlatJump|
-|FlatJump| PROC
-	; disable interrupt
-	mrs	r4, cpsr
-	orr	r4, r4, #0xc0
-	msr	cpsr, r4
-	; disable MMU, I/D-Cache, Writebuffer.
-	; interrupt vector address is 0xffff0000
-	; 32bit exception handler/address range.
-	ldr	r4, [pc, #24]
-	; Disable WB/Cache/MMU
-	mcr	p15, 0, r4, c1, c0, 0
-	; Invalidate I/D-cache.
-	mcr	p15, 0, r4, c7, c7, 0	; Fetch translated	fetch
-	; Invalidate TLB entries.
-	mcr	p15, 0, r4, c8, c7, 0	; Fetch translated	decode
-	; jump to kernel entry physical address.
-	mov	pc, r3			; Fetch translated	execute
-	; NOTREACHED
-	nop				; Fetch nontranslated	cache access
-	nop				; Fetch nontranslated	writeback
-	mov	pc, lr			; Fetch nontranslated
-	DCD	0x00002030
-	ENDP  ; |FlatJump|
-;
-;	UART test
-;
-	; boot_func (uint32_t mapaddr, uint32_t bootinfo, uint32_t flags)
-	;
-	EXPORT	|boot_func|
-|boot_func| PROC
-	nop				; Cop15 hazard
-	nop				; Cop15 hazard
-	nop				; Cop15 hazard
-	mov	sp, r2			; set bootloader stack
-;	mov	r4, r0
-;	mov	r5, r1
-;	bl	colorbar
-;	mov	r0, r4
-;	mov	r1, r5
-	bl	boot
-	nop	; NOTREACHED
-	nop
-	ENDP  ; |boot_func|
-
-	EXPORT |colorbar|
-|colorbar| PROC
-	stmfd	sp!, {r4-r7, lr}
-	adr	r4, |$FBADDR|
-	ldr	r4, [r4]
-
-	mov	r7, #8
-	add	r0, r0, r7
-|color_loop|
-	mov	r6, r0
-	and	r6, r6, #7
-	orr	r6, r6, r6, LSL #8
-	orr	r6, r6, r6, LSL #16
-	add	r5, r4, #0x9600
-|fb_loop|
-	str	r6, [r4], #4
-	cmp	r4, r5
-	blt	|fb_loop|
-
-	subs	r7, r7, #1
-	bne	|color_loop|
-
-	ldmfd	sp!, {r4-r7, pc}
-|$FBADDR|
-	DCD	0xc0003000	; use WindowsCE default.
-	ENDP  ; |colorbar|
-
-	EXPORT	|boot|
-|boot| PROC
-;
-;	UART test code
-;
-;	; print boot_info address (r0) and page_vector start address (r1).
-;	mov	r4, r0
-;	mov	r5, r1
-;	mov	r0, #'I'
-;	bl	btputc
-;	mov	r0, r4
-;	bl	hexdump
-;	mov	r0, #'P'
-;	bl	btputc
-;	mov	r0, r5
-;	bl	hexdump
-;	mov	r7, r4
-;	mov	r2, r5		; start
-
-	mov	r7, r0		; if enabled above debug print, remove this.
-	mov	r2, r1		; if enabled above debug print, remove this.
-|page_loop|
-	mvn	r0, #0		; ~0
-	cmp	r2, r0
-	beq	|page_end|	; if (next == ~0) goto page_end
-
-	mov	r1, r2		; p = next
-	ldr	r2, [r1]	; next
-	ldr	r3, [r1, #4]	; src
-	ldr	r4, [r1, #8]	; dst
-	ldr	r5, [r1, #12]	; sz
-
-	cmp	r3, r0
-	add	r6, r4, r5	; end address
-	bne	|page_memcpy4|	; if (src != ~0) goto page_memcpy4
-
-	mov	r0, #0
-|page_memset|			; memset (dst, 0, sz) uncached.
-	str	r0, [r4], #4
-	cmp	r4, r6
-	blt	|page_memset|
-	b	|page_loop|
-
-|page_memcpy4|			; memcpy (dst, src, sz) uncached.
-	ldr	r0, [r3], #4
-	ldr	r5, [r3], #4
-	str	r0, [r4], #4
-	cmp	r4, r6
-	strlt	r5, [r4], #4
-	cmplt	r4, r6
-	blt	|page_memcpy4|
-
-	b	|page_loop|
-|page_end|
-	;
-	; jump to kernel
-	;
-;	mov	r0, #'E'
-;	bl	btputc
-;	ldr	r0, [r7]
-;	bl	hexdump
-;	ldr	r0, [r7]
-;	ldr	r0, [r0]
-;	bl	hexdump	
-
-	; set stack pointer
-	mov	r5, #4096
-	add	r6, r6, #8192
-	sub	r5, r5, #1
-	bic	sp, r6, r5
-
-	; set bootargs
-	ldr	r4, [r7]
-	ldr	r0, [r7, #4]
-	ldr	r1, [r7, #8]
-	ldr	r2, [r7, #12]
-	mov	pc, r4
-	; NOTREACHED
-
-|infinite_loop|
-	nop
-	nop
-	nop
-	nop
-	nop
-	b	|infinite_loop|
-	ENDP  ; |boot|
-
-|btputc| PROC
-	adr	r1, |$UARTTXBSY|
-	ldr	r1, [r1]
-|btputc_busy|
-	ldr	r2, [r1]
-	and	r2, r2, #1
-	cmp	r2, #1
-	beq	|btputc_busy|
-	adr	r1, |$UARTTXADR|
-	ldr	r1, [r1]
-	str	r0, [r1]
-	mov	pc, lr
-	ENDP	;|btputc|
-
-|hexdump| PROC
-	stmfd	sp!, {r4-r5, lr}
-	mov	r4, r0
-	mov	r0, #0x30
-	bl	btputc
-	mov	r0, #0x78
-	bl	btputc
-	mov	r0, r4
-	;	Transmit register address
-	adr	r1, |$UARTTXADR|
-	ldr	r1, [r1]
-	;	Transmit busy register address
-	adr	r2, |$UARTTXBSY|
-	ldr	r2, [r2]
-	mov	r5, #8
-|hex_loop|
-	mov	r3, r0, LSR #28
-	cmp	r3, #9
-	addgt	r3, r3, #0x41 - 10
-	addle	r3, r3, #0x30
-|hex_busyloop|
-	 ldr	r4, [r2]
-	and	r4, r4, #1
-	cmp	r4, #1
-	beq	|hex_busyloop|
-	str	r3, [r1]
-	mov	r0, r0, LSL #4
-	subs	r5, r5, #1
-	bne	|hex_loop|
-	mov	r0, #0x0d
-	bl	btputc
-	mov	r0, #0x0a
-	bl	btputc
-	ldmfd	sp!, {r4-r5, pc}
-	ENDP	;|hexdump|
-
-|$UARTTXADR|
-	DCD	0x80050014
-|$UARTTXBSY|
-	DCD	0x80050020
-
-	EXPORT	|boot_func_end| [ DATA ]
-|boot_func_end|	DCD	0x0
-
 	END
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_arch.h src/sys/arch/hpc/stand/hpcboot/arm/arm_arch.h
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_arch.h	2008-04-29 11:38:33.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_arch.h	2008-04-29 11:47:44.000000000 +0900
@@ -75,6 +75,7 @@
 void WritebackDCache(void);
 void InvalidateDCache(void);
 void WritebackInvalidateDCache(void);
+void WritebufferFlush(void);
 
 // MMU TLB access
 void FlushIDTLB(void);
@@ -87,6 +88,8 @@
 void SetSVCMode(void);
 void SetSystemMode(void);
 
+extern uint32_t dcachesize;
+
 __END_DECLS
 
 #endif // _HPCBOOT_ARM_ARCH_H_
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_boot.cpp src/sys/arch/hpc/stand/hpcboot/arm/arm_boot.cpp
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_boot.cpp	2008-04-29 11:38:33.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_boot.cpp	2008-04-29 11:47:44.000000000 +0900
@@ -69,6 +69,8 @@
 		args.architecture = ARCHITECTURE_ARM_SA1100;
 	else if (platid_match(&platid, &platid_mask_CPU_ARM_XSCALE_PXA250))
 		args.architecture = ARCHITECTURE_ARM_PXA250;
+	else if (platid_match(&platid, &platid_mask_CPU_ARM_XSCALE_PXA270))
+		args.architecture = ARCHITECTURE_ARM_PXA270;
 	else
 		return FALSE;
 
@@ -92,6 +94,7 @@
 		_arch = new SA1100Architecture(_cons, _mem);
 		break;
 	case ARCHITECTURE_ARM_PXA250:
+	case ARCHITECTURE_ARM_PXA270:
 		_arch = new PXA2X0Architecture(_cons, _mem);
 		break;
 	}
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_console.cpp src/sys/arch/hpc/stand/hpcboot/arm/arm_console.cpp
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_console.cpp	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_console.cpp	2008-04-29 11:47:44.000000000 +0900
@@ -50,6 +50,7 @@
 			break;
 
 		    case ARCHITECTURE_ARM_PXA250:
+		    case ARCHITECTURE_ARM_PXA270:
 			_instance = new PXA2x0Console(mem);
 			break;
 		}
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0.cpp src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0.cpp
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0.cpp	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0.cpp	2008-04-29 11:47:44.000000000 +0900
@@ -56,13 +56,13 @@
 __BEGIN_DECLS
 
 // 2nd bootloader
-void boot_func(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
-extern char boot_func_end[];
-#define	BOOT_FUNC_START		reinterpret_cast <vaddr_t>(boot_func)
-#define	BOOT_FUNC_END		reinterpret_cast <vaddr_t>(boot_func_end)
+void boot_func_pxa2x0(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
+extern char boot_func_end_pxa2x0[];
+#define	BOOT_FUNC_START		reinterpret_cast <vaddr_t>(boot_func_pxa2x0)
+#define	BOOT_FUNC_END		reinterpret_cast <vaddr_t>(boot_func_end_pxa2x0)
 
 /* jump to 2nd loader */
-void FlatJump(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
+void FlatJump_pxa2x0(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
 
 __END_DECLS
 
@@ -89,6 +89,10 @@
 	_mem->loadBank(DRAM_BANK2_START, DRAM_BANK_SIZE);
 	_mem->loadBank(DRAM_BANK3_START, DRAM_BANK_SIZE);
 
+	// set D-cache information
+	dcachesize = 32768 * 2;
+	DPRINTF((TEXT("D-cache size = %d\n"), dcachesize));
+
 #ifdef HW_TEST
 	DPRINTF((TEXT("Testing framebuffer.\n")));
 	testFramebuffer();
@@ -124,8 +128,44 @@
 	COM_CLR_INTS;							\
 __END_MACRO
 
+	// set ALT_FN_3_OUT at GPIO<99:98> for FFUART
+	vaddr_t gpio =
+	    _mem->mapPhysicalPage(0x40e00000, 0x1000, PAGE_READWRITE);
+	VOLATILE_REF(gpio + 0x6c) |= 0xf0;
+	_mem->unmapPhysicalPage(gpio);
+
 	vaddr_t uart =
-	    _mem->mapPhysicalPage(0x40100000, 0x100, PAGE_READWRITE);
+	    _mem->mapPhysicalPage(0x40100000, 0x1000, PAGE_READWRITE);
+
+	/* 8bit, no parity, stop bit = 1 */
+	VOLATILE_REF8(uart + 0x0c) = 0x80;
+	switch (HPC_PREFERENCE.serial_speed) {
+	default:
+	case 9600:
+		VOLATILE_REF8(uart + 0x00) = 96;
+		VOLATILE_REF8(uart + 0x04) = 0;
+		break;
+	case 19200:
+		VOLATILE_REF8(uart + 0x00) = 48;
+		VOLATILE_REF8(uart + 0x04) = 0;
+		break;
+	case 38400:
+		VOLATILE_REF8(uart + 0x00) = 24;
+		VOLATILE_REF8(uart + 0x04) = 0;
+		break;
+	case 57600:
+		VOLATILE_REF8(uart + 0x00) = 16;
+		VOLATILE_REF8(uart + 0x04) = 0;
+		break;
+	case 115200:
+		VOLATILE_REF8(uart + 0x00) = 8;
+		VOLATILE_REF8(uart + 0x04) = 0;
+		break;
+	}
+	VOLATILE_REF8(uart + 0x0c) = 0x03;
+	VOLATILE_REF8(uart + 0x10) = 0x03;
+	VOLATILE_REF8(uart + 0x08) = 0x00;
+	VOLATILE_REF8(uart + 0x04) = 0x40;
 
 	// Don't turn on the enable-UART bit in the IER; this seems to
 	// result in WinCE losing the port (and nothing working later).
@@ -184,6 +224,8 @@
 	WritebackDCache();
 
 	SetKMode(1);
-	FlatJump(info, pvec, sp, _loader_addr);
+	FlatJump_pxa2x0(info, pvec, sp, _loader_addr);
 	// NOTREACHED
+	SetKMode(0);
+	DPRINTF((TEXT("Return from FlatJump_pxa2x0.\n")));
 }
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm	2008-04-21 21:44:57.000000000 +0900
@@ -0,0 +1,243 @@
+;	$NetBSD$	
+;
+; Copyright (c) 2001 The NetBSD Foundation, Inc.
+; All rights reserved.
+;
+; This code is derived from software contributed to The NetBSD Foundation
+; by UCHIYAMA Yasushi.
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+; 1. Redistributions of source code must retain the above copyright
+;    notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must reproduce the above copyright
+;    notice, this list of conditions and the following disclaimer in the
+;    documentation and/or other materials provided with the distribution.
+; 3. All advertising materials mentioning features or use of this software
+;    must display the following acknowledgement:
+;        This product includes software developed by the NetBSD
+;        Foundation, Inc. and its contributors.
+; 4. Neither the name of The NetBSD Foundation nor the names of its
+;    contributors may be used to endorse or promote products derived
+;    from this software without specific prior written permission.
+;
+; THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+; PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+; POSSIBILITY OF SUCH DAMAGE.
+;
+
+	AREA	|.text|, CODE, PIC
+
+;
+;armasm.exe $(InputPath)
+;arm.obj
+;
+	; FlatJump_pxa2x0 (kaddr_t bootinfo, kaddr_t pvec, kaddr_t stack
+	;		kaddr_t jump)
+	;	bootinfo	boot information block address.
+	;	pvec		page vector of kernel.
+	;	stack		physical address of stack
+	;	jump		physical address of boot function
+	EXPORT	|FlatJump_pxa2x0|
+|FlatJump_pxa2x0| PROC
+	; disable interrupt
+	mrs	r4, cpsr
+	orr	r4, r4, #0xc0
+	msr	cpsr, r4
+	; Invalidate I/D-cache.
+	mcr	p15, 0, r4, c7, c7, 0
+	mov	r4, r4
+	sub	pc, pc, #4
+	; disable MMU, I/D-Cache, Writebuffer.
+	; interrupt vector address is 0xffff0000
+	; 32bit exception handler/address range.
+	ldr	r4, [pc, #20]
+	; Disable WB/Cache/MMU
+	mcr	p15, 0, r4, c1, c0, 0
+	; Invalidate TLB entries.
+	mcr	p15, 0, r4, c8, c7, 0
+	mov	r4, r4			; wait for it to complete
+	sub	pc, pc, #4		; branch to next insn
+	mov	pc, r3
+	; NOTREACHED
+	mov	pc, lr
+	DCD	0x00002030
+	ENDP  ; |FlatJump_pxa2x0|
+;
+;	UART test
+;
+	; boot_func (uint32_t mapaddr, uint32_t bootinfo, uint32_t flags)
+	;
+	EXPORT	|boot_func_pxa2x0|
+|boot_func_pxa2x0| PROC
+	nop				; cop15 hazard
+	nop				; cop15 hazard
+	nop				; cop15 hazard
+	mov	sp, r2			; set bootloader stack
+	bl	boot_pxa2x0
+	nop	; NOTREACHED
+	nop
+	ENDP  ; |boot_func_pxa2x0|
+
+	EXPORT	|boot_pxa2x0|
+|boot_pxa2x0| PROC
+	mov	r4, r0
+	mov	r5, r1
+
+;
+;	UART test code
+;
+;	; print boot_info address (r0) and page_vector start address (r1).
+;	mov	r0, #'I'
+;	bl	btputc
+;	mov	r0, r4
+;	bl	hexdump
+;	mov	r0, #'P'
+;	bl	btputc
+;	mov	r0, r5
+;	bl	hexdump
+
+	mov	r7, r4
+	mov	r2, r5		; start
+|page_loop|
+	mvn	r0, #0		; ~0
+	cmp	r2, r0
+	beq	|page_end|	; if (next == ~0) goto page_end
+
+	mov	r1, r2		; p = next
+	ldr	r2, [r1]	; next
+	ldr	r3, [r1, #4]	; src
+	ldr	r4, [r1, #8]	; dst
+	ldr	r5, [r1, #12]	; sz
+
+	bic	r4, r4, #0xff000000
+	orr	r4, r4, #0xa0000000
+
+	cmp	r3, r0
+	add	r6, r4, r5	; end address
+	bne	|page_memcpy4|	; if (src != ~0) goto page_memcpy4
+
+	mov	r0, #0
+|page_memset|			; memset (dst, 0, sz) uncached.
+	str	r0, [r4], #4
+	cmp	r4, r6
+	blt	|page_memset|
+	b	|page_loop|
+
+|page_memcpy4|			; memcpy (dst, src, sz) uncached.
+	ldr	r0, [r3], #4
+	ldr	r5, [r3], #4
+	str	r0, [r4], #4
+	cmp	r4, r6
+	strlt	r5, [r4], #4
+	cmplt	r4, r6
+	blt	|page_memcpy4|
+
+	b	|page_loop|
+|page_end|
+	;
+	; jump to kernel
+	;
+;	mov	r0, #'E'
+;	bl	btputc
+;	ldr	r0, [r7]
+;	bl	hexdump
+
+	; set stack pointer
+	mov	r5, #4096
+	add	r6, r6, #8192
+	sub	r5, r5, #1
+	bic	sp, r6, r5
+
+	; set bootargs
+	ldr	r4, [r7]
+	ldr	r0, [r7, #4]
+	ldr	r1, [r7, #8]
+	ldr	r2, [r7, #12]
+	bic	r4, r4, #0xff000000
+	orr	r4, r4, #0xa0000000
+	mov	pc, r4
+	; NOTREACHED
+
+|infinite_loop|
+	nop
+	nop
+	nop
+	nop
+	nop
+	b	|infinite_loop|
+	ENDP  ; |boot|
+
+|btputc| PROC
+	adr	r1, |$UARTTXBSY|
+	ldr	r1, [r1]
+|btputc_busy|
+	ldr	r2, [r1]
+	ands	r2, r2, #0x20
+	beq	|btputc_busy|
+	adr	r1, |$UARTTXADR|
+	ldr	r1, [r1]
+	str	r0, [r1]
+	adr	r1, |$UARTINTR|
+	ldr	r1, [r1]
+	mov	pc, lr
+	ENDP	;|btputc|
+
+|hexdump| PROC
+	stmfd	sp!, {r4-r5, lr}
+	mov	r4, r0
+	mov	r0, #0x30
+	bl	btputc
+	mov	r0, #0x78
+	bl	btputc
+	mov	r0, r4
+	;	Transmit register address
+	adr	r1, |$UARTTXADR|
+	ldr	r1, [r1]
+	;	Transmit busy register address
+	adr	r2, |$UARTTXBSY|
+	ldr	r2, [r2]
+	mov	r5, #8
+|hex_loop|
+	mov	r3, r0, LSR #28
+	cmp	r3, #9
+	addgt	r3, r3, #0x41 - 10
+	addle	r3, r3, #0x30
+|hex_busyloop|
+	ldr	r4, [r2]
+	ands	r4, r4, #0x20
+	beq	|hex_busyloop|
+	str	r3, [r1]
+	adr	r4, |$UARTINTR|
+	ldr	r4, [r4]
+	mov	r0, r0, LSL #4
+	subs	r5, r5, #1
+	bne	|hex_loop|
+	mov	r0, #0x0d
+	bl	btputc
+	mov	r0, #0x0a
+	bl	btputc
+	ldmfd	sp!, {r4-r5, pc}
+	ENDP	;|hexdump|
+
+	; FFUART
+|$UARTTXADR|
+	DCD	0x40100000
+|$UARTTXBSY|
+	DCD	0x40100014
+|$UARTINTR|
+	DCD	0x40100008
+
+	EXPORT	|boot_func_end_pxa2x0| [ DATA ]
+|boot_func_end_pxa2x0|	DCD	0x0
+
+	END
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_console.h src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_console.h
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_console.h	2008-03-08 11:26:03.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_console.h	2008-04-18 15:11:02.000000000 +0900
@@ -71,8 +71,16 @@
 
 public:
 	virtual BOOL init(void) {
+#if 0
 		if (!SerialConsole::init())
 			return FALSE;
+#endif
+
+		// set ALT_FN_3_OUT at GPIO<99:98> for FFUART
+		vaddr_t gpio =
+		    _mem->mapPhysicalPage(0x40e00000, 0x1000, PAGE_READWRITE);
+		*(volatile uint32_t *)(gpio + 0x6c) |= 0xf0;
+		_mem->unmapPhysicalPage(gpio);
 
 		_uart_base =
 		    _mem->mapPhysicalPage(0x40100000, 0x100, PAGE_READWRITE);
@@ -80,6 +88,36 @@
 		if (_uart_base == ~0)
 			return FALSE;
 
+		/* 8bit, no parity, stop bit = 1 */
+		VOLATILE_REF8(_uart_base + 0x0c) = 0x80;
+		switch (HPC_PREFERENCE.serial_speed) {
+		default:
+		case 9600:
+			VOLATILE_REF8(_uart_base + 0x00) = 96;
+			VOLATILE_REF8(_uart_base + 0x04) = 0;
+			break;
+		case 19200:
+			VOLATILE_REF8(_uart_base + 0x00) = 48;
+			VOLATILE_REF8(_uart_base + 0x04) = 0;
+			break;
+		case 38400:
+			VOLATILE_REF8(_uart_base + 0x00) = 24;
+			VOLATILE_REF8(_uart_base + 0x04) = 0;
+			break;
+		case 57600:
+			VOLATILE_REF8(_uart_base + 0x00) = 16;
+			VOLATILE_REF8(_uart_base + 0x04) = 0;
+			break;
+		case 115200:
+			VOLATILE_REF8(_uart_base + 0x00) = 8;
+			VOLATILE_REF8(_uart_base + 0x04) = 0;
+			break;
+		}
+		VOLATILE_REF8(_uart_base + 0x0c) = 0x03;
+		VOLATILE_REF8(_uart_base + 0x10) = 0x03;
+		VOLATILE_REF8(_uart_base + 0x08) = 0x00;
+		VOLATILE_REF8(_uart_base + 0x04) = 0x40;
+
 		return TRUE;
 	}
 };
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100.cpp src/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100.cpp
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100.cpp	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100.cpp	2008-04-29 11:47:44.000000000 +0900
@@ -56,13 +56,13 @@
 __BEGIN_DECLS
 
 // 2nd bootloader
-void boot_func(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
-extern char boot_func_end[];
-#define	BOOT_FUNC_START		reinterpret_cast <vaddr_t>(boot_func)
-#define	BOOT_FUNC_END		reinterpret_cast <vaddr_t>(boot_func_end)
+void boot_func_sa1100(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
+extern char boot_func_end_sa1100[];
+#define	BOOT_FUNC_START		reinterpret_cast <vaddr_t>(boot_func_sa1100)
+#define	BOOT_FUNC_END		reinterpret_cast <vaddr_t>(boot_func_end_sa1100)
 
 /* jump to 2nd loader */
-void FlatJump(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
+void FlatJump_sa1100(kaddr_t, kaddr_t, kaddr_t, kaddr_t);
 
 __END_DECLS
 
@@ -89,6 +89,10 @@
 	_mem->loadBank(DRAM_BANK2_START, DRAM_BANK_SIZE);
 	_mem->loadBank(DRAM_BANK3_START, DRAM_BANK_SIZE);
 
+	// set D-cache information
+	dcachesize = 8192;
+	DPRINTF((TEXT("D-cache size = %d\n"), dcachesize));
+
 	return TRUE;
 }
 
@@ -180,6 +184,6 @@
 	WritebackDCache();
 
 	SetKMode(1);
-	FlatJump(info, pvec, sp, _loader_addr);
+	FlatJump_sa1100(info, pvec, sp, _loader_addr);
 	// NOTREACHED
 }
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm src/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm
--- src.orig/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm	2008-04-18 16:35:04.000000000 +0900
@@ -0,0 +1,270 @@
+;	$NetBSD$	
+;
+; Copyright (c) 2001 The NetBSD Foundation, Inc.
+; All rights reserved.
+;
+; This code is derived from software contributed to The NetBSD Foundation
+; by UCHIYAMA Yasushi.
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+; 1. Redistributions of source code must retain the above copyright
+;    notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must reproduce the above copyright
+;    notice, this list of conditions and the following disclaimer in the
+;    documentation and/or other materials provided with the distribution.
+; 3. All advertising materials mentioning features or use of this software
+;    must display the following acknowledgement:
+;        This product includes software developed by the NetBSD
+;        Foundation, Inc. and its contributors.
+; 4. Neither the name of The NetBSD Foundation nor the names of its
+;    contributors may be used to endorse or promote products derived
+;    from this software without specific prior written permission.
+;
+; THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+; PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+; POSSIBILITY OF SUCH DAMAGE.
+;
+
+;
+;armasm.exe $(InputPath)
+;arm.obj
+;
+
+	AREA	|.text|, CODE, PIC
+
+	; FlatJump_sa1100 (kaddr_t bootinfo, kaddr_t pvec, kaddr_t stack
+	;		kaddr_t jump)
+	;	bootinfo	boot information block address.
+	;	pvec		page vector of kernel.
+	;	stack		physical address of stack
+	;	jump		physical address of boot function
+	; *** MMU and pipeline behavier are SA-1100 specific. ***
+	EXPORT	|FlatJump_sa1100|
+|FlatJump_sa1100| PROC
+	; disable interrupt
+	mrs	r4, cpsr
+	orr	r4, r4, #0xc0
+	msr	cpsr, r4
+	; disable MMU, I/D-Cache, Writebuffer.
+	; interrupt vector address is 0xffff0000
+	; 32bit exception handler/address range.
+	ldr	r4, [pc, #24]
+	; Disable WB/Cache/MMU
+	mcr	p15, 0, r4, c1, c0, 0
+	; Invalidate I/D-cache.
+	mcr	p15, 0, r4, c7, c7, 0	; Fetch translated	fetch
+	; Invalidate TLB entries.
+	mcr	p15, 0, r4, c8, c7, 0	; Fetch translated	decode
+	; jump to kernel entry physical address.
+	mov	pc, r3			; Fetch translated	execute
+	; NOTREACHED
+	nop				; Fetch nontranslated	cache access
+	nop				; Fetch nontranslated	writeback
+	mov	pc, lr			; Fetch nontranslated
+	DCD	0x00002030
+	ENDP  ; |FlatJump_sa1100|
+;
+;	UART test
+;
+	; boot_func (uint32_t mapaddr, uint32_t bootinfo, uint32_t flags)
+	;
+	EXPORT	|boot_func_sa1100|
+|boot_func_sa1100| PROC
+	nop				; Cop15 hazard
+	nop				; Cop15 hazard
+	nop				; Cop15 hazard
+	mov	sp, r2			; set bootloader stack
+;	mov	r4, r0
+;	mov	r5, r1
+;	bl	colorbar
+;	mov	r0, r4
+;	mov	r1, r5
+	bl	boot_sa1100
+	nop	; NOTREACHED
+	nop
+	ENDP  ; |boot_func_sa1100|
+
+	EXPORT |colorbar|
+|colorbar| PROC
+	stmfd	sp!, {r4-r7, lr}
+	adr	r4, |$FBADDR|
+	ldr	r4, [r4]
+
+	mov	r7, #8
+	add	r0, r0, r7
+|color_loop|
+	mov	r6, r0
+	and	r6, r6, #7
+	orr	r6, r6, r6, LSL #8
+	orr	r6, r6, r6, LSL #16
+	add	r5, r4, #0x9600
+|fb_loop|
+	str	r6, [r4], #4
+	cmp	r4, r5
+	blt	|fb_loop|
+
+	subs	r7, r7, #1
+	bne	|color_loop|
+
+	ldmfd	sp!, {r4-r7, pc}
+|$FBADDR|
+	DCD	0xc0003000	; use WindowsCE default.
+	ENDP  ; |colorbar|
+
+	EXPORT	|boot_sa1100|
+|boot_sa1100| PROC
+;
+;	UART test code
+;
+;	; print boot_info address (r0) and page_vector start address (r1).
+;	mov	r4, r0
+;	mov	r5, r1
+;	mov	r0, #'I'
+;	bl	btputc
+;	mov	r0, r4
+;	bl	hexdump
+;	mov	r0, #'P'
+;	bl	btputc
+;	mov	r0, r5
+;	bl	hexdump
+;	mov	r7, r4
+;	mov	r2, r5		; start
+
+	mov	r7, r0		; if enabled above debug print, remove this.
+	mov	r2, r1		; if enabled above debug print, remove this.
+|page_loop|
+	mvn	r0, #0		; ~0
+	cmp	r2, r0
+	beq	|page_end|	; if (next == ~0) goto page_end
+
+	mov	r1, r2		; p = next
+	ldr	r2, [r1]	; next
+	ldr	r3, [r1, #4]	; src
+	ldr	r4, [r1, #8]	; dst
+	ldr	r5, [r1, #12]	; sz
+
+	cmp	r3, r0
+	add	r6, r4, r5	; end address
+	bne	|page_memcpy4|	; if (src != ~0) goto page_memcpy4
+
+	mov	r0, #0
+|page_memset|			; memset (dst, 0, sz) uncached.
+	str	r0, [r4], #4
+	cmp	r4, r6
+	blt	|page_memset|
+	b	|page_loop|
+
+|page_memcpy4|			; memcpy (dst, src, sz) uncached.
+	ldr	r0, [r3], #4
+	ldr	r5, [r3], #4
+	str	r0, [r4], #4
+	cmp	r4, r6
+	strlt	r5, [r4], #4
+	cmplt	r4, r6
+	blt	|page_memcpy4|
+
+	b	|page_loop|
+|page_end|
+	;
+	; jump to kernel
+	;
+;	mov	r0, #'E'
+;	bl	btputc
+;	ldr	r0, [r7]
+;	bl	hexdump
+;	ldr	r0, [r7]
+;	ldr	r0, [r0]
+;	bl	hexdump	
+
+	; set stack pointer
+	mov	r5, #4096
+	add	r6, r6, #8192
+	sub	r5, r5, #1
+	bic	sp, r6, r5
+
+	; set bootargs
+	ldr	r4, [r7]
+	ldr	r0, [r7, #4]
+	ldr	r1, [r7, #8]
+	ldr	r2, [r7, #12]
+	mov	pc, r4
+	; NOTREACHED
+
+|infinite_loop|
+	nop
+	nop
+	nop
+	nop
+	nop
+	b	|infinite_loop|
+	ENDP  ; |boot|
+
+|btputc| PROC
+	adr	r1, |$UARTTXBSY|
+	ldr	r1, [r1]
+|btputc_busy|
+	ldr	r2, [r1]
+	and	r2, r2, #1
+	cmp	r2, #1
+	beq	|btputc_busy|
+	adr	r1, |$UARTTXADR|
+	ldr	r1, [r1]
+	str	r0, [r1]
+	mov	pc, lr
+	ENDP	;|btputc|
+
+|hexdump| PROC
+	stmfd	sp!, {r4-r5, lr}
+	mov	r4, r0
+	mov	r0, #0x30
+	bl	btputc
+	mov	r0, #0x78
+	bl	btputc
+	mov	r0, r4
+	;	Transmit register address
+	adr	r1, |$UARTTXADR|
+	ldr	r1, [r1]
+	;	Transmit busy register address
+	adr	r2, |$UARTTXBSY|
+	ldr	r2, [r2]
+	mov	r5, #8
+|hex_loop|
+	mov	r3, r0, LSR #28
+	cmp	r3, #9
+	addgt	r3, r3, #0x41 - 10
+	addle	r3, r3, #0x30
+|hex_busyloop|
+	ldr	r4, [r2]
+	and	r4, r4, #1
+	cmp	r4, #1
+	beq	|hex_busyloop|
+	str	r3, [r1]
+	mov	r0, r0, LSL #4
+	subs	r5, r5, #1
+	bne	|hex_loop|
+	mov	r0, #0x0d
+	bl	btputc
+	mov	r0, #0x0a
+	bl	btputc
+	ldmfd	sp!, {r4-r5, pc}
+	ENDP	;|hexdump|
+
+|$UARTTXADR|
+	DCD	0x80050014
+|$UARTTXBSY|
+	DCD	0x80050020
+
+	EXPORT	|boot_func_end_sa1100| [ DATA ]
+|boot_func_end_sa1100|	DCD	0x0
+
+	END
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.config src/sys/arch/hpc/stand/hpcboot/hpcboot.config
--- src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.config	2008-03-15 10:56:37.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/hpcboot.config	2008-04-18 15:49:30.000000000 +0900
@@ -42,6 +42,8 @@
 	arm\arm_boot.cpp
 	arm\arm_mmu.cpp
 	arm\arm.asm
+	arm\arm_sa1100_asm.asm
+	arm\arm_pxa2x0_asm.asm
 '
 SRCFILE_LIST_SH3='
 	sh3\sh_arch.cpp
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.h src/sys/arch/hpc/stand/hpcboot/hpcboot.h
--- src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.h	2008-04-29 11:38:33.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/hpcboot.h	2008-04-29 11:47:44.000000000 +0900
@@ -46,6 +46,7 @@
 #ifdef ARM
 	ARCHITECTURE_ARM_SA1100	= PLATID_CPU_ARM_STRONGARM_SA1100,
 	ARCHITECTURE_ARM_PXA250 = PLATID_CPU_ARM_XSCALE_PXA250,
+	ARCHITECTURE_ARM_PXA270 = PLATID_CPU_ARM_XSCALE_PXA270,
 #endif
 #ifdef SHx
 	ARCHITECTURE_SH3_7707	= PLATID_CPU_SH_3_7707,
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.vcproj src/sys/arch/hpc/stand/hpcboot/hpcboot.vcproj
--- src.orig/sys/arch/hpc/stand/hpcboot/hpcboot.vcproj	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/hpcboot.vcproj	2008-04-18 15:42:10.000000000 +0900
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="hpcboot"
+	ProjectGUID="{C23B9696-8B04-4802-BFCF-B7CA78449458}"
+	RootNamespace="hpcboot"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;res;..\include;..\libsa;..\..\..\..;..\..\..\..\..\common\dist\zlib"
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;LIBSA_RENAME_PRINTF;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				MinimalRebuild="true"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				AdditionalDependencies="libsa.lib libz.lib winsock.lib"
+				OutputFile="$(OutDir)/hpcboot.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;..\compile\libsa\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\compile\libz\$(PlatformName)\$(ConfigurationName)&quot;"
+				DelayLoadDLLs="$(NOINHERIT)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/hpcboot.pdb"
+				GenerateMapFile="true"
+				MapFileName="$(OutDir)/hpcboot.map"
+				SubSystem="9"
+				StackReserveSize="65536"
+				StackCommitSize="4096"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories=".;res;..\include;..\libsa;..\..\..\..;..\..\..\..\..\common\dist\zlib"
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;LIBSA_RENAME_PRINTF;NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				AdditionalDependencies="libsa.lib libz.lib winsock.lib"
+				OutputFile="$(OutDir)/hpcboot.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\compile\libsa\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\compile\libz\$(PlatformName)\$(ConfigurationName)&quot;"
+				DelayLoadDLLs="$(NOINHERIT)"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/hpcboot.pdb"
+				GenerateMapFile="true"
+				MapFileName="$(OutDir)/hpcboot.map"
+				SubSystem="9"
+				StackReserveSize="65536"
+				StackCommitSize="4096"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\arch.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\arm\arm_arch.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_boot.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_console.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_mmu.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_pxa2x0.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_pxa2x0_asm.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\arm\arm_sa1100.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\arm\arm_sa1100_asm.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing Custom Build Step. (armasm.exe)"
+						CommandLine="&quot;$(VCInstallDir)\ce\bin\x86_arm\armasm.exe&quot; -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;"
+						Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\boot.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\console.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\file.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\file_fat.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\file_http.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\file_manager.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\file_ufs.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\framebuffer.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\hpcboot.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\hpcmenu.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\load.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\load_coff.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\load_elf.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\machine_config.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\memory.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\menu.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\platform.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\platid.c"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\platid_mask.c"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\platid_name.c"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\rootwindow.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\tabwindow.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\menu\window.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\res\hpcmenu.rc"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/menu/menu.cpp src/sys/arch/hpc/stand/hpcboot/menu/menu.cpp
--- src.orig/sys/arch/hpc/stand/hpcboot/menu/menu.cpp	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/menu/menu.cpp	2008-04-29 11:47:45.000000000 +0900
@@ -41,6 +41,11 @@
 
 #include <menu/menu.h>
 
+#define SCALEX(x) (((x) * dpix) / 96/*DPI*/)
+#define SCALEY(y) (((y) * dpiy) / 96/*DPI*/)
+#define UNSCALEX(x) (((x) * 96) / dpix)
+#define UNSCALEY(y) (((y) * 96) / dpiy)
+
 TabWindow *
 TabWindowBase::boot(int id)
 {
@@ -208,6 +213,8 @@
 	HDC hdc = GetDC(0);
 	int width = GetDeviceCaps(hdc, HORZRES);
 	int height = GetDeviceCaps(hdc, VERTRES);
+	int dpix = GetDeviceCaps(hdc, LOGPIXELSX);
+	int dpiy = GetDeviceCaps(hdc, LOGPIXELSY);
 	ReleaseDC(0, hdc);
 
 	// set origin
@@ -222,17 +229,23 @@
 
 	HWND h;
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_V);
-	SetWindowPos(h, 0, x, y, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x), SCALEY(y),
+	    SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_S);
-	SetWindowPos(h, 0, x, y + 20, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x), SCALEY(y + 20),
+            SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_A);
-	SetWindowPos(h, 0, x, y + 40, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x), SCALEY(y + 40),
+	    SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_D);
-	SetWindowPos(h, 0, x, y + 60, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x), SCALEY(y + 60),
+	    SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_H);
-	SetWindowPos(h, 0, x, y + 80, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x), SCALEY(y + 80),
+	    SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 	h = GetDlgItem(_window, IDC_MAIN_OPTION_H_SPEED);
-	SetWindowPos(h, 0, x + 100, y + 80, 120, 10, SWP_NOSIZE | SWP_NOZORDER);
+	SetWindowPos(h, 0, SCALEX(x + 100), SCALEY(y + 80),
+	    SCALEX(120), SCALEY(10), SWP_NOSIZE | SWP_NOZORDER);
 }
 
 void
@@ -298,13 +311,18 @@
 OptionTabWindow::init(HWND w)
 {
 	struct HpcMenuInterface::HpcMenuPreferences &pref = HPC_PREFERENCE;
+	HDC hdc = GetDC(0);
+	int dpix = GetDeviceCaps(hdc, LOGPIXELSX);
+	int dpiy = GetDeviceCaps(hdc, LOGPIXELSY);
+	ReleaseDC(0, hdc);
 
 	_window = w;
 
 	TabWindow::init(_window);
 	_spin_edit = GetDlgItem(_window, IDC_OPT_AUTO_INPUT);
 	_spin = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE |
-	    UDS_SETBUDDYINT | UDS_ALIGNRIGHT, 80, 0, 50, 50, _window,
+	    UDS_SETBUDDYINT | UDS_ALIGNRIGHT,
+	    SCALEX(80), SCALEY(0), SCALEX(50), SCALEY(50), _window,
 	    IDC_OPT_AUTO_UPDOWN, _app._instance, _spin_edit, 60, 1, 30);
 	BOOL onoff = pref.auto_boot ? TRUE : FALSE;
 	EnableWindow(_spin_edit, onoff);
@@ -426,12 +444,18 @@
 void
 ConsoleTabWindow::init(HWND w)
 {
+	HDC hdc = GetDC(0);
+	int dpix = GetDeviceCaps(hdc, LOGPIXELSX);
+	int dpiy = GetDeviceCaps(hdc, LOGPIXELSY);
+	ReleaseDC(0, hdc);
+
 	// at this time _window is NULL.
 	// use argument of window procedure.
 	TabWindow::init(w);
 	_edit = GetDlgItem(w, IDC_CONS_EDIT);
-	MoveWindow(_edit, 5, 60, _rect.right - _rect.left - 10,
-	    _rect.bottom - _rect.top - 60, TRUE);
+	MoveWindow(_edit, SCALEX(5), SCALEY(60),
+	    SCALEX(UNSCALEX(_rect.right - _rect.left) - 10),
+	    SCALEY(UNSCALEY(_rect.bottom - _rect.top) - 60), TRUE);
 	Edit_FmtLines(_edit, TRUE);
 
 	// log file.
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/res/hpcmenu.rc src/sys/arch/hpc/stand/hpcboot/res/hpcmenu.rc
--- src.orig/sys/arch/hpc/stand/hpcboot/res/hpcmenu.rc	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/res/hpcmenu.rc	2008-04-29 11:47:45.000000000 +0900
@@ -53,6 +53,8 @@
 	IDS_DIR_CARD_JP1		L"\\\xFF92\xFF93\xFF98 \xFF76\xFF70\xFF84\xFF9E1\\"
 	IDS_DIR_CARD_JP2		L"\\\xFF92\xFF93\xFF98 \xFF76\xFF70\xFF84\xFF9E2\\"
 	IDS_DIR_CARD_MMCARD		"\\Multimedia Card\\"
+	IDS_DIR_CARD_MINISD_JP		L"\\miniSD\xFF76\xFF70\xFF84\xFF9E\\"
+	IDS_DIR_CARD_MICROSD_JP		L"\\microSD\xFF76\xFF70\xFF84\xFF9E\\"
 	IDS_DIR_USER_DEFINED		"user defined"
 }
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot/res/resource.h src/sys/arch/hpc/stand/hpcboot/res/resource.h
--- src.orig/sys/arch/hpc/stand/hpcboot/res/resource.h	2008-04-29 11:38:34.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot/res/resource.h	2008-04-29 11:47:45.000000000 +0900
@@ -121,7 +121,9 @@
 #define	IDS_DIR_CARD_JP1		10020
 #define	IDS_DIR_CARD_JP2		10022
 #define	IDS_DIR_CARD_MMCARD		10024
-#define	IDS_DIR_USER_DEFINED		10026
+#define	IDS_DIR_CARD_MINISD_JP		10026
+#define	IDS_DIR_CARD_MICROSD_JP		10028
+#define	IDS_DIR_USER_DEFINED		10030
 
 
 #define	IDS_DIR_START			IDS_DIR_FFS_ROOT1
Binary files src.orig/sys/arch/hpc/stand/hpcboot.ncb and src/sys/arch/hpc/stand/hpcboot.ncb differ
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/hpcboot.sln src/sys/arch/hpc/stand/hpcboot.sln
--- src.orig/sys/arch/hpc/stand/hpcboot.sln	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/hpcboot.sln	2008-04-11 18:18:58.000000000 +0900
@@ -0,0 +1,42 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hpcboot", "hpcboot\hpcboot.vcproj", "{C23B9696-8B04-4802-BFCF-B7CA78449458}"
+	ProjectSection(ProjectDependencies) = postProject
+		{EA178C60-A07C-47C8-97CC-A17511D7944A} = {EA178C60-A07C-47C8-97CC-A17511D7944A}
+		{2A044694-7027-4826-878F-A135F130EC1A} = {2A044694-7027-4826-878F-A135F130EC1A}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsa", "libsa\libsa.vcproj", "{2A044694-7027-4826-878F-A135F130EC1A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libz", "libz\libz.vcproj", "{EA178C60-A07C-47C8-97CC-A17511D7944A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{C23B9696-8B04-4802-BFCF-B7CA78449458}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{2A044694-7027-4826-878F-A135F130EC1A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{EA178C60-A07C-47C8-97CC-A17511D7944A}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Binary files src.orig/sys/arch/hpc/stand/hpcboot.suo and src/sys/arch/hpc/stand/hpcboot.suo differ
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/libsa/libsa.vcproj src/sys/arch/hpc/stand/libsa/libsa.vcproj
--- src.orig/sys/arch/hpc/stand/libsa/libsa.vcproj	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/libsa/libsa.vcproj	2008-04-14 18:09:10.000000000 +0900
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="utf-8"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libsa"
+	ProjectGUID="{2A044694-7027-4826-878F-A135F130EC1A}"
+	RootNamespace="libsa"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\libsa\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\libsa\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\include;..\..\..\.."
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__signed=signed;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;__daddr_t=int32_t;LIBSA_NO_TWIDDLE;LIBSA_RENAME_PRINTF;LIBSA_USE_MEMCPY;LIBSA_USE_MEMSET;LIBKERN_INLINE=__inline;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				MinimalRebuild="true"
+				RuntimeLibrary="1"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				OutputFile="$(OutDir)/libsa.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\libsa\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\libsa\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories=".;..\include;..\..\..\.."
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__signed=signed;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;__daddr_t=int32_t;LIBSA_NO_TWIDDLE;LIBSA_RENAME_PRINTF;LIBSA_USE_MEMCPY;LIBSA_USE_MEMSET;LIBKERN_INLINE=__inline;NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				RuntimeLibrary="0"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				OutputFile="$(OutDir)/libsa.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\lib\libsa\dkcksum.c"
+				>
+			</File>
+			<File
+				RelativePath=".\panic.c"
+				>
+			</File>
+			<File
+				RelativePath=".\stricmp.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\strtok.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\tolower.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\lib\libsa\ufs.c"
+				>
+			</File>
+			<File
+				RelativePath=".\winblk.c"
+				>
+			</File>
+			<File
+				RelativePath=".\winprintf.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpc/stand/libz/libz.vcproj src/sys/arch/hpc/stand/libz/libz.vcproj
--- src.orig/sys/arch/hpc/stand/libz/libz.vcproj	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpc/stand/libz/libz.vcproj	2008-04-14 18:10:44.000000000 +0900
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="utf-8"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libz"
+	ProjectGUID="{EA178C60-A07C-47C8-97CC-A17511D7944A}"
+	RootNamespace="libz"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\libz\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\libz\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="0"
+				AdditionalIncludeDirectories=".;..\..\..\..\..\common\dist\zlib;..\include;..\..\..\.."
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				MinimalRebuild="true"
+				RuntimeLibrary="1"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				OutputFile="$(OutDir)/libz.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
+			OutputDirectory="..\compile\libz\$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="..\compile\libz\$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				ExecutionBucket="7"
+				Optimization="2"
+				AdditionalIncludeDirectories=".;..\..\..\..\..\common\dist\zlib;..\include;..\..\..\.."
+				PreprocessorDefinitions="_STANDALONE;__STDC__;__COMPILER_INT64__=__int64;__COMPILER_UINT64__=unsigned __int64;NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
+				RuntimeLibrary="0"
+				StructMemberAlignment="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
+				Culture="1041"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				AdditionalOptions=" /subsystem:windowsce,5.01"
+				OutputFile="$(OutDir)/libz.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCCodeSignTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+			<DeploymentTool
+				ForceDirty="-1"
+				RemoteDirectory=""
+				RegisterOutput="0"
+				AdditionalFiles=""
+			/>
+			<DebuggerTool
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\adler32.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\crc32.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\inffast.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\inflate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\inftrees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\common\dist\zlib\uncompr.c"
+				>
+			</File>
+			<File
+				RelativePath=".\zalloc.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resouce Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/INSTALL_WS003SH src/sys/arch/hpcarm/conf/INSTALL_WS003SH
--- src.orig/sys/arch/hpcarm/conf/INSTALL_WS003SH	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/INSTALL_WS003SH	2008-04-21 23:58:50.000000000 +0900
@@ -0,0 +1,15 @@
+#
+# kernel config file for system install
+#
+# 	$NetBSD$
+#
+
+include		"arch/hpcarm/conf/WS003SH"
+
+# Enable the hooks used for initializing the root memory-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
+options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
+options 	MEMORY_DISK_ROOT_SIZE=8704	# size of memory disk, in blocks
+
+options		PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/IPAQ src/sys/arch/hpcarm/conf/IPAQ
--- src.orig/sys/arch/hpcarm/conf/IPAQ	2008-01-25 23:45:05.000000000 +0900
+++ src/sys/arch/hpcarm/conf/IPAQ	2008-04-25 17:03:26.000000000 +0900
@@ -3,7 +3,7 @@
 #	iPAQ H3600 -- Windows-CE based PDA
 #
 
-include	"arch/hpcarm/conf/std.hpcarm"
+include	"arch/hpcarm/conf/std.sa11x0"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/JORNADA720 src/sys/arch/hpcarm/conf/JORNADA720
--- src.orig/sys/arch/hpcarm/conf/JORNADA720	2008-01-25 23:45:05.000000000 +0900
+++ src/sys/arch/hpcarm/conf/JORNADA720	2008-04-25 17:03:34.000000000 +0900
@@ -3,7 +3,7 @@
 #	JORNADA -- Windows-CE based jornada 720
 #
 
-include	"arch/hpcarm/conf/std.hpcarm"
+include	"arch/hpcarm/conf/std.sa11x0"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/JORNADA820 src/sys/arch/hpcarm/conf/JORNADA820
--- src.orig/sys/arch/hpcarm/conf/JORNADA820	2008-01-25 23:45:05.000000000 +0900
+++ src/sys/arch/hpcarm/conf/JORNADA820	2008-04-25 17:03:40.000000000 +0900
@@ -3,7 +3,7 @@
 #	JORNADA -- Windows-CE based jornada 820
 #
 
-include	"arch/hpcarm/conf/std.hpcarm"
+include	"arch/hpcarm/conf/std.sa11x0"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/WS003SH src/sys/arch/hpcarm/conf/WS003SH
--- src.orig/sys/arch/hpcarm/conf/WS003SH	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/WS003SH	2008-05-15 23:43:01.000000000 +0900
@@ -0,0 +1,219 @@
+#	$NetBSD$
+#
+#	WS003SH -- Windows Mobile 5 based PDA
+#
+
+include	"arch/hpcarm/conf/std.pxa2x0"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#ident 		"GENERIC-$Revision$"
+
+# memory size
+options 	DRAM_PAGES="16384"	# 4Ki * 16384page = 64MiB
+
+# estimated number of users
+maxusers	32
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+# CPU options
+
+# For XScale systems
+options 	CPU_XSCALE_PXA270	# Support the XScale PXA27x core
+makeoptions 	CPUFLAGS="-mcpu=xscale"
+
+# Architecture options
+options 	XSCALE_CACHE_READ_WRITE_ALLOCATE
+options 	PXAGPIO_HAS_GPION_INTRS
+
+# File systems
+
+file-system	FFS		# UFS
+#file-system	LFS		# log-structured file system
+#file-system	MFS		# memory file system
+file-system	NFS		# Network file system
+#file-system 	ADOSFS		# AmigaDOS-compatible file system
+#file-system 	EXT2FS		# second extended file system (linux)
+file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+file-system	NULLFS		# loopback file system
+#file-system 	OVERLAY		# overlay filesystem
+#file-system	PORTAL		# portal filesystem (still experimental)
+file-system	PROCFS		# /proc
+#file-system	UMAPFS		# NULLFS + uid and gid remapping
+file-system	UNION		# union file system
+file-system	PTYFS		# /dev/pts/N support
+file-system	TMPFS		# Efficient memory file-system
+#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+
+# File system options
+#options 	QUOTA		# UFS quotas
+#options 	FFS_EI		# FFS Endian Independant support
+#options 	SOFTDEP		# FFS soft updates support.
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+#options 	NFSSERVER
+
+# Networking options
+
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
+#options 	IPSEC_NAT_T	# IPsec NAT traversal (NAT-T)
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	ISO,TPIP	# OSI
+#options 	EON		# OSI tunneling over IP
+#options 	NETATALK	# AppleTalk networking
+#options 	PFIL_HOOKS	# pfil(9) packet filter hooks
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+# Compatibility options
+
+#options 	COMPAT_43	# 4.3BSD compatibility.
+options 	COMPAT_40	# NetBSD 4.0 compatibility.
+options 	COMPAT_30	# NetBSD 3.0 compatibility.
+options 	COMPAT_20	# NetBSD 2.0 compatibility.
+#options 	COMPAT_16	# NetBSD 1.6 compatibility.
+#options 	COMPAT_15	# NetBSD 1.5 compatibility.
+#options 	COMPAT_14	# NetBSD 1.4 compatibility.
+#options 	COMPAT_13	# NetBSD 1.3 compatibility.
+#options 	COMPAT_12	# NetBSD 1.2 compatibility.
+#options 	COMPAT_11	# NetBSD 1.1 compatibility.
+#options 	COMPAT_10	# NetBSD 1.0 compatibility.
+#options 	COMPAT_09	# NetBSD 0.9 compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Shared memory options
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+
+# Miscellaneous kernel options
+options 	KTRACE		# system call tracing, a la ktrace(1)
+options 	IRQSTATS	# manage IRQ statistics
+#options 	LKM		# loadable kernel modules
+options 	KMEMSTATS	# kernel memory statistics
+#options 	SCSIVERBOSE	# Verbose SCSI errors
+options 	USERCONF	# userconf(4) support
+#options	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+options 	NFS_BOOT_DHCP
+
+#
+# wscons options
+#
+# builtin terminal emulations
+options 	WSEMUL_VT100
+# allocate a number of virtual screens at autoconfiguration time
+#options 	WSDISPLAY_DEFAULTSCREENS=2
+
+# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
+#options 	WSDISPLAY_CUSTOM_OUTPUT	# color customization from wsconsctl(8)
+#options 	WS_DEFAULT_FG=WSCOL_WHITE
+#options 	WS_DEFAULT_BG=WSCOL_BLACK
+#options 	WS_DEFAULT_COLATTR="(0)"
+#options 	WS_DEFAULT_MONOATTR="(0)"
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+#options 	WS_KERNEL_COLATTR=""
+#options 	WS_KERNEL_MONOATTR=""
+
+# Development and Debugging options
+
+#options 	VERBOSE_INIT_ARM
+#options 	BOOT_DUMP	# Enable memorydump at boot
+options 	DIAGNOSTIC	# internal consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+#options 	PMAP_DEBUG	# Enable pmap_debug_level code
+options 	DDB		# in-kernel debugger
+options 	DDB_HISTORY_SIZE=512	# Enable history editing in DDB
+#makeoptions	DEBUG="-g"	# compile full symbol table
+
+config		netbsd	root on ? type ?
+
+# The main bus device
+mainbus0 at root
+
+# The boot CPU
+cpu0 at mainbus?
+
+# integrated peripherals
+pxaip0	at mainbus?
+
+pxaintc0 at pxaip? addr 0x40d00000	# interrupt controller
+pxagpio0 at pxaip? addr 0x40e00000	# GPIO
+pxartc0 at pxaip? addr 0x40900000	# RTC
+
+# DMAC support
+pxadmac0 at pxaip? addr 0x40000000 intr 25
+options 	PXA2X0_DMAC_DMOVER_CONCURRENCY=4 # Enable dmover(9) backend
+#options 	PXA2X0_DMAC_FIXED_PRIORITY	# Don't want multiple priority
+
+# Serial
+# integrated 16550 UARTs
+options 	COM_PXA2X0
+com0 at pxaip?  addr 0x40100000 intr 22	# Full Function UART
+#options 	CONSPEED=115200
+
+# OS Timer
+saost*	at pxaip? addr 0x40a00000 size 0x20
+
+# Physical console
+lcd* at pxaip?
+wsdisplay* at lcd? console ?
+
+# Keyboard
+wzero3kbd0 at pxaip?
+hpckbd*	at wzero3kbd?
+wskbd0 at hpckbd? mux 1
+
+# Pseudo-devices
+pseudo-device	loop			# network loopback
+pseudo-device	bpfilter 		# packet filter
+pseudo-device	sl			# CSLIP
+pseudo-device	ppp			# PPP
+pseudo-device	tun			# network tunneling over tty
+#pseudo-device	gre			# generic L3 over IP tunnel
+#pseudo-device	ipfilter 		# ip filter
+#pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
+#pseudo-device	faith			# IPv[46] tcp relay translation i/f
+#pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
+#pseudo-device	strip			# STarmode Radio IP (Metricon Ricochet)
+
+#pseudo-device	vlan			# IEEE 802.1q encapsulation
+pseudo-device	pty			# pseudo-terminals
+pseudo-device	vnd			# disk-like interface to files
+#pseudo-device	ccd	2		# concatenated disk devices
+#pseudo-device	cgd	2		# cryptographic disk devices
+#pseudo-device	raid	4		# RAIDframe disk driver
+#options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
+#pseudo-device	fss	4		# file system snapshot device
+
+pseudo-device	biconsdev 1		# build-in console device
+#pseudo-device	wsmux
+
+pseudo-device	md	1		# Ramdisk driver
+pseudo-device	rnd			# /dev/random and in-kernel generator
+pseudo-device	clockctl		# user control of clock subsystem
+pseudo-device	ksyms			# /dev/ksyms
+#pseudo-device	bcsp			# BlueCore Serial Protocol
+#pseudo-device	btuart			# Bluetooth HCI UART (H4)
+
+# wscons pseudo-devices
+pseudo-device	wsmux			# mouse & keyboard multiplexor
+pseudo-device	wsfont
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/files.hpcarm src/sys/arch/hpcarm/conf/files.hpcarm
--- src.orig/sys/arch/hpcarm/conf/files.hpcarm	2008-04-29 11:38:35.000000000 +0900
+++ src/sys/arch/hpcarm/conf/files.hpcarm	2008-04-29 12:01:33.000000000 +0900
@@ -14,44 +14,19 @@
 
 define todservice {}
 
+defparam opt_dram_pages.h	DRAM_PAGES
+
 # Memory disk driver
 file	dev/md_root.c				memory_disk_hooks
 
+file	dev/cninit.c
+
 # Generic MD files
 file	arch/hpcarm/hpcarm/autoconf.c
-#file	arch/hpcarm/hpcarm/intr.c
-file	arch/hpcarm/hpcarm/spl.S
-file	arch/arm/arm32/intr.c
-file	arch/arm/arm32/spl.S
 
 # HPCARM specific files
 file	arch/hpcarm/hpcarm/hpc_machdep.c
 
-# Include hpcarm/StrongARM config definitions.
-include "arch/arm/conf/files.sa11x0"
-
-# SA-11[01]1 companion chips
-file	arch/hpcarm/dev/sacc_hpcarm.c		sacc
-
-# Jornada 720 dependent part of PCMCIA support.
-file	arch/hpcarm/dev/j720pcic.c		sacpcic
-
-# XXX iPAQ Virtual bus
-device	ipaqbus {}
-attach	ipaqbus at saip
-file	arch/hpcarm/dev/ipaq_saip.c		ipaqbus
-
-# iPAQ PCMCIA
-device	ipaqpcic: pcmciabus
-attach	ipaqpcic at ipaqbus
-file	arch/hpcarm/dev/ipaq_pcic.c		ipaqpcic needs-flag
-
-# PCMCIA
-include "dev/pcmcia/files.pcmcia"
-
-# XXX this is a hack to use dev/pcmcia without fdc.c
-device fdc
-
 #
 # H/PC Platform common files.
 #
@@ -63,59 +38,8 @@
 include	"dev/hpc/files.hpckbd"
 include	"dev/hpc/files.hpctp"
 
-# iPAQ LCD
-device	ipaqlcd: hpcfbif
-attach	ipaqlcd at ipaqbus
-file	arch/hpcarm/dev/ipaq_lcd.c		ipaqlcd
-
-# Epson SED1356 framebuffer
-device	sed: hpcfbif
-attach	sed at saip
-file	arch/hpcarm/dev/sed_saip.c		sed
-
-# Jornada 720 SSP port
-device	j720ssp {}
-attach	j720ssp at saip
-file	arch/hpcarm/dev/j720ssp.c		j720ssp
-
-# Jornada 720 keyboard
-device j720kbd: hpckbdif
-attach j720kbd at j720ssp
-file	arch/hpcarm/dev/j720kbd.c		j720kbd
-
-# Jornada 720 touch-panel
-device	j720tp: hpctpanel, wsmousedev, wskbddev
-attach	j720tp at j720ssp
-file	arch/hpcarm/dev/j720tp.c		j720tp
-defflag	opt_j720tp.h		J720TP_DEBUG
-defparam opt_j720tp.h		J720TP_SETTINGS_ICON_KEYSYM
-				J720TP_BACKUP_ICON_KEYSYM
-				J720TP_DIALUP_ICON_KEYSYM
-				J720TP_MEDIA_ICON_KEYSYM
-
-# Jornada 720 LCD screen
-device	j720lcd
-attach	j720lcd at j720ssp
-file	arch/hpcarm/dev/j720lcd.c		j720lcd
-
-# Jornada 720 power management
-device	j720pwr: hpcapmif
-attach	j720pwr at j720ssp
-file	arch/hpcarm/dev/j720pwr.c		j720pwr
-
-# Atmel microcontroller
-device	atmelgpioif {}
-device	atmelgpio: atmelgpioif
-attach	atmelgpio at ipaqbus
-file	arch/hpcarm/dev/ipaq_atmelgpio.c	atmelgpio
-
-# uda1341 Codec
-device	udaif {}
-device	uda: udaif
-attach	uda at ipaqbus
-file	arch/hpcarm/dev/uda1341.c		uda
-
-file	dev/cninit.c
+# Machine-independent PCMCIA
+include "dev/pcmcia/files.pcmcia"
 
 # Machine-independent ATA drivers
 include "dev/ata/files.ata"
@@ -123,10 +47,13 @@
 # Machine-independent SCSI/ATAPI drivers
 include "dev/scsipi/files.scsipi"
 
-# USB
+# Machine-independent USB
 include "dev/usb/files.usb"
 
-# Bluetooth
+# Machine-independent Bluetooth
 include "dev/bluetooth/files.bluetooth"
 
+# Machine-independent SD/MMC drivers
+include "dev/sdmmc/files.sdmmc"
+
 include "arch/hpcarm/conf/majors.hpcarm"
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/files.pxa2x0 src/sys/arch/hpcarm/conf/files.pxa2x0
--- src.orig/sys/arch/hpcarm/conf/files.pxa2x0	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/files.pxa2x0	2008-05-15 23:42:41.000000000 +0900
@@ -0,0 +1,20 @@
+#	$NetBSD$
+#
+# PXA2x0 specific configuration info
+#
+
+# Include hpcarm/XScale config definitions.
+include "arch/arm/xscale/files.pxa2x0"
+
+#
+# W-ZERO3 specific configuration info
+#
+
+# LCD frame buffer
+attach lcd at pxaip with wzero3lcd
+file arch/hpcarm/dev/wzero3_lcd.c	wzero3lcd needs-flag
+
+# keyboard
+device wzero3kbd: hpckbdif
+attach wzero3kbd at pxaip
+file arch/hpcarm/dev/wzero3_kbd.c	wzero3kbd
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/files.sa11x0 src/sys/arch/hpcarm/conf/files.sa11x0
--- src.orig/sys/arch/hpcarm/conf/files.sa11x0	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/files.sa11x0	2008-04-29 12:02:40.000000000 +0900
@@ -0,0 +1,89 @@
+#	$NetBSD$
+#
+# SA-11x0 model specific configuration info
+#
+
+# SA-11x0 specific files.
+#file	arch/hpcarm/hpcarm/intr.c
+file	arch/hpcarm/hpcarm/spl.S
+file	arch/arm/arm32/intr.c
+file	arch/arm/arm32/spl.S
+
+# Include hpcarm/StrongARM config definitions.
+include "arch/arm/conf/files.sa11x0"
+
+# SA-11[01]1 companion chips
+file	arch/hpcarm/dev/sacc_hpcarm.c		sacc
+
+#
+# iPaq specific configuration info
+#
+
+# XXX iPAQ Virtual bus
+device	ipaqbus {}
+attach	ipaqbus at saip
+file	arch/hpcarm/dev/ipaq_saip.c		ipaqbus
+
+# iPAQ PCMCIA
+device	ipaqpcic: pcmciabus
+attach	ipaqpcic at ipaqbus
+file	arch/hpcarm/dev/ipaq_pcic.c		ipaqpcic needs-flag
+
+# iPAQ LCD
+device	ipaqlcd: hpcfbif
+attach	ipaqlcd at ipaqbus
+file	arch/hpcarm/dev/ipaq_lcd.c		ipaqlcd
+
+# Atmel microcontroller
+device	atmelgpioif {}
+device	atmelgpio: atmelgpioif
+attach	atmelgpio at ipaqbus
+file	arch/hpcarm/dev/ipaq_atmelgpio.c	atmelgpio
+
+# uda1341 Codec
+device	udaif {}
+device	uda: udaif
+attach	uda at ipaqbus
+file	arch/hpcarm/dev/uda1341.c		uda
+
+#
+# JORNADA specific configuration info
+#
+
+# Jornada 720 dependent part of PCMCIA support.
+file	arch/hpcarm/dev/j720pcic.c		sacpcic
+
+# Epson SED1356 framebuffer
+device	sed: hpcfbif
+attach	sed at saip
+file	arch/hpcarm/dev/sed_saip.c		sed
+
+# Jornada 720 SSP port
+device	j720ssp {}
+attach	j720ssp at saip
+file	arch/hpcarm/dev/j720ssp.c		j720ssp
+
+# Jornada 720 keyboard
+device j720kbd: hpckbdif
+attach j720kbd at j720ssp
+file	arch/hpcarm/dev/j720kbd.c		j720kbd
+
+# Jornada 720 touch-panel
+device	j720tp: hpctpanel, wsmousedev, wskbddev
+attach	j720tp at j720ssp
+file	arch/hpcarm/dev/j720tp.c		j720tp
+defflag	opt_j720tp.h		J720TP_DEBUG
+defparam opt_j720tp.h		J720TP_SETTINGS_ICON_KEYSYM
+				J720TP_BACKUP_ICON_KEYSYM
+				J720TP_DIALUP_ICON_KEYSYM
+				J720TP_MEDIA_ICON_KEYSYM
+
+# Jornada 720 LCD screen
+device	j720lcd
+attach	j720lcd at j720ssp
+file	arch/hpcarm/dev/j720lcd.c		j720lcd
+
+# Jornada 720 power management
+device	j720pwr: hpcapmif
+attach	j720pwr at j720ssp
+file	arch/hpcarm/dev/j720pwr.c		j720pwr
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/std.pxa2x0 src/sys/arch/hpcarm/conf/std.pxa2x0
--- src.orig/sys/arch/hpcarm/conf/std.pxa2x0	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/std.pxa2x0	2008-04-29 17:29:45.000000000 +0900
@@ -0,0 +1,12 @@
+#	$NetBSD$
+#
+# standard NetBSD/hpcarm options for PXA2x0 model
+
+include		"arch/hpcarm/conf/std.hpcarm"   # arch standard options
+
+# Pull in iPaq config definitions.
+include		"arch/hpcarm/conf/files.pxa2x0"
+
+options 	ARM_INTR_IMPL="<arch/arm/xscale/pxa2x0_intr.h>"
+
+makeoptions	TEXTADDR=c0200000
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/conf/std.sa11x0 src/sys/arch/hpcarm/conf/std.sa11x0
--- src.orig/sys/arch/hpcarm/conf/std.sa11x0	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/conf/std.sa11x0	2008-04-25 17:03:12.000000000 +0900
@@ -0,0 +1,10 @@
+#	$NetBSD$
+#
+# standard NetBSD/hpcarm options for SA-11x0 model
+
+include		"arch/hpcarm/conf/std.hpcarm"   # arch standard options
+
+# Pull in iPaq config definitions.
+include		"arch/hpcarm/conf/files.sa11x0"
+
+options 	__OLD_INTERRUPT_CODE
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/dev/wzero3_gpioreg.h src/sys/arch/hpcarm/dev/wzero3_gpioreg.h
--- src.orig/sys/arch/hpcarm/dev/wzero3_gpioreg.h	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/dev/wzero3_gpioreg.h	2008-04-29 11:31:19.000000000 +0900
@@ -0,0 +1,53 @@
+/*	$NetBSD$	*/
+
+/*
+ * Copyright (c) 2008 NONAKA Kimihiro <nonaka@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Sharp WS003SH specific parameter
+ */
+/*
+port	I/O(Active)	name 	desc
+0	I(?)		KEY_DET	keyboard press/release detect
+9	I(L)		nSD_DET	miniSD card detect
+12	I(H)		SLIDE	LCD slider
+95	I(H)		PWR_BTN	button detect: power-on
+115	I(H)		ACDET	AC adapter detect
+
+Extended GPIO
+ */
+
+#define	GPIO_WS003SH_KEY_DETECT		0
+#define	GPIO_WS003SH_nSD_DETECT		9
+#define	GPIO_WS003SH_SLIDE		12
+#define	GPIO_WS003SH_POWER_BUTTON	95
+#define	GPIO_WS003SH_AC_DETECT		115
+
+#define	EGPIO_WS003SH_XXX		0
+
+#define	EGPIO_INIT	0
+
+#define	EGPIO_LCD_INIT	0
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/dev/wzero3_kbd.c src/sys/arch/hpcarm/dev/wzero3_kbd.c
--- src.orig/sys/arch/hpcarm/dev/wzero3_kbd.c	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/dev/wzero3_kbd.c	2008-05-15 23:56:28.000000000 +0900
@@ -0,0 +1,421 @@
+/*	$NetBSD$	*/
+#define	KEYTEST2
+/*
+ * Copyright (c) 2008 NONAKA Kimihiro <nonaka@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+
+#include <arm/xscale/pxa2x0cpu.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_gpio.h>
+
+#include <machine/bus.h>
+#include <machine/bootinfo.h>
+#include <machine/config_hook.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
+
+#include <dev/hpc/hpckbdvar.h>
+
+#include <arch/hpcarm/dev/wzero3_gpioreg.h>
+
+#ifdef DEBUG
+#define DPRINTF(arg)	printf arg
+#else
+#define DPRINTF(arg)	/* nothing */
+#endif
+
+#define	CSR_READ1(r)	bus_space_read_1(sc->sc_iot, sc->sc_ioh, (r))
+#define	CSR_WRITE1(r,v)	bus_space_write_1(sc->sc_iot, sc->sc_ioh, (r), (v))
+
+/* register */
+#define	KBDCOL_L	(0x00)	/* Write */
+#define	KBDCOL_U	(0x04)	/* Write */
+#define	KBDCHARGE	(0x08)	/* Write */
+#define	KBDDATA		(0x08)	/* Read */
+#define	REGMAPSIZE	0x0c
+
+#define	KEYWAIT		10
+
+#define	WS003SH_NCOLUMN	12
+#define	WS003SH_NROW	7
+
+struct wzero3kbd_softc {
+	struct device sc_dev;
+
+	bus_space_tag_t sc_iot;
+	bus_space_handle_t sc_ioh;
+
+	int sc_ncolumn;
+	int sc_nrow;
+	uint8_t *sc_okeystat;
+	uint8_t *sc_keystat;
+
+	void *sc_key_ih;
+	void *sc_pwrkey_ih;
+
+	int sc_key_pin;
+	int sc_pwrkey_pin;
+
+	struct hpckbd_ic_if sc_if;
+	struct hpckbd_if *sc_hpckbd;
+
+	int sc_enabled;
+
+#if defined(KEYTEST)
+	void *sc_test_ih;
+	int sc_test_pin;
+#endif
+};
+
+static int wzero3kbd_match(struct device *, struct cfdata *, void *);
+static void wzero3kbd_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(wzero3kbd, sizeof(struct wzero3kbd_softc),
+    wzero3kbd_match, wzero3kbd_attach, NULL, NULL);
+
+static int wzero3kbd_intr(void *arg);
+#if defined(KEYTEST)
+static int wzero3kbd_intr2(void *arg);
+#endif
+static int wzero3kbd_pwrkey_intr(void *arg);
+static int wzero3kbd_input_establish(void *arg, struct hpckbd_if *kbdif);
+static int wzero3kbd_poll(void *arg);
+
+/*
+ * WS003SH keyscan map
+	col#0	col#1	col#2	col#3	col#4	col#5	col#6	col#7	col#8	col#9	col#10	col#11
+row#0:	CTRL	1	3	5	6	7	9	0	BS	(none)	ROTATE	CAMERA
+row#1:	(none)	2	4	r	y	8	i	o	p	(none)	VOL-	VOL+
+row#2:	TAB	q	e	t	g	u	j	k	(none)	(none)	(none)	(none)
+row#3:	(none)	w	s	f	v	h	m	l	(none)	(none)	SHIFT	(none)
+row#4:	CALL	a	d	c	b	n	.	(none)	ENTER	(none)	WIN	(none)
+row#5:	MAIL	z	x	-	SPACE	/	(none)	UP	(none)	(none)	LSOFT	FN
+row#6:	IE	MOJI	(none)	OK	ACTION	,	LEFT	DOWN	RIGHT	(none)	RSOFT	(none)
+*/
+
+static const struct wzero3kbd_model {
+	platid_mask_t *platid;
+	const char *str;
+	int key_pin;
+	int pwrkey_pin;
+	int ncolumn;
+	int nrow;
+} wzero3kbd_table[] = {
+	/* WS003SH */
+	{
+		&platid_mask_MACH_SHARP_WZERO3_WS003SH,
+		"WS003SH",
+		GPIO_WS003SH_KEY_DETECT,
+		GPIO_WS003SH_POWER_BUTTON,
+		WS003SH_NCOLUMN,
+		WS003SH_NROW,
+	},
+	/* WS004SH */
+	{
+		&platid_mask_MACH_SHARP_WZERO3_WS004SH,
+		"WS004SH",
+		GPIO_WS003SH_KEY_DETECT,
+		GPIO_WS003SH_POWER_BUTTON,
+		WS003SH_NCOLUMN,
+		WS003SH_NROW,
+	},
+
+	{ NULL, "unknown model", -1, -1, 0, 0, }
+};
+
+static const struct wzero3kbd_model *
+wzero3kbd_lookup(void)
+{
+	const struct wzero3kbd_model *model;
+
+	for (model = wzero3kbd_table; model->platid != NULL; model++) {
+		if (platid_match(&platid, model->platid)) {
+			return model;
+		}
+	}
+	return NULL;
+}
+
+static int
+wzero3kbd_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+
+	if (strcmp(cf->cf_name, "wzero3kbd") != 0)
+		return 0;
+	if (wzero3kbd_lookup() == NULL)
+		return 0;
+	return 1;
+}
+
+static void
+wzero3kbd_attach(struct device *parent, struct device *self, void *aux)
+{
+	struct wzero3kbd_softc *sc = device_private(self);
+	struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux;
+	struct hpckbd_attach_args haa;
+	const struct wzero3kbd_model *model;
+
+	model = wzero3kbd_lookup();
+	if (model == NULL) {
+		aprint_error(": unknown model\n");
+		return;
+	}
+
+	sc->sc_key_pin = model->key_pin;
+	sc->sc_pwrkey_pin = model->pwrkey_pin;
+	sc->sc_ncolumn = model->ncolumn;
+	sc->sc_nrow = model->nrow;
+
+	aprint_normal(": %s keyboard\n", model->str);
+
+	sc->sc_iot = pxa->pxa_iot;
+	if (bus_space_map(sc->sc_iot, PXA2X0_CS2_START, REGMAPSIZE, 0,
+	    &sc->sc_ioh)) {
+		aprint_error_dev(self, ": couldn't map registers.\n");
+		return;
+	}
+
+	sc->sc_okeystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
+	    M_NOWAIT | M_ZERO);
+	sc->sc_keystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
+	    M_NOWAIT | M_ZERO);
+	if (sc->sc_okeystat == NULL || sc->sc_keystat == NULL) {
+		aprint_error_dev(self, ": couldn't alloc memory.\n");
+		if (sc->sc_okeystat)
+			free(sc->sc_okeystat, M_DEVBUF);
+		if (sc->sc_keystat)
+			free(sc->sc_keystat, M_DEVBUF);
+		return;
+	}
+
+	sc->sc_if.hii_ctx = sc;
+	sc->sc_if.hii_establish = wzero3kbd_input_establish;
+	sc->sc_if.hii_poll = wzero3kbd_poll;
+
+	/* Attach console if not using serial. */
+	if (!(bootinfo->bi_cnuse & BI_CNUSE_SERIAL))
+		hpckbd_cnattach(&sc->sc_if);
+
+	/* Install interrupt handler. */
+	sc->sc_key_ih = pxa2x0_gpio_intr_establish(sc->sc_key_pin,
+	    IST_EDGE_BOTH, IPL_TTY, wzero3kbd_intr, sc);
+	sc->sc_pwrkey_ih = pxa2x0_gpio_intr_establish(sc->sc_pwrkey_pin,
+	    IST_EDGE_BOTH, IPL_TTY, wzero3kbd_pwrkey_intr, sc);
+#if defined(KEYTEST) || defined(KEYTEST2)
+	/* TOUCH PANEL for WS003SH */
+	aprint_normal_dev(self, "touch panel test\n");
+	pxa2x0_gpio_set_function(11, GPIO_IN);
+	pxa2x0_gpio_intr_establish(11, IST_EDGE_BOTH, IPL_TTY,
+	    wzero3kbd_pwrkey_intr, sc);
+#endif
+
+	/* Attach hpckbd. */
+	haa.haa_ic = &sc->sc_if;
+	config_found(self, &haa, hpckbd_print);
+
+#ifdef KEYTEST
+	pxa2x0_gpio_set_function(11, GPIO_IN);
+	for (sc->sc_test_pin = 2;; sc->sc_test_pin++) {
+		if (sc->sc_test_pin != 86 /* Vsync? */
+		 && sc->sc_test_pin != 95 /* power key */
+		 && GPIO_IS_GPIO_IN(pxa2x0_gpio_get_function(sc->sc_test_pin))){
+			break;
+		}
+	}
+	printf("GPIO%d\n", sc->sc_test_pin);
+	sc->sc_test_ih = pxa2x0_gpio_intr_establish(sc->sc_test_pin,
+	    IST_EDGE_BOTH, IPL_TTY, wzero3kbd_intr2, sc);
+#endif
+}
+
+int
+wzero3kbd_intr(void *arg)
+{
+	struct wzero3kbd_softc *sc = device_private(arg);
+
+	(void) wzero3kbd_poll(arg);
+
+	pxa2x0_gpio_clear_intr(sc->sc_key_pin);
+
+	return 1;
+}
+
+#ifdef KEYTEST
+static int
+wzero3kbd_intr2(void *arg)
+{
+	struct wzero3kbd_softc *sc = device_private(arg);
+
+	printf("wzero3kbd_intr2: GPIO%d = %s\n", sc->sc_test_pin,
+	    pxa2x0_gpio_get_bit(sc->sc_test_pin) ? "on" : "off");
+
+	return 1;
+}
+#endif
+
+static int
+wzero3kbd_pwrkey_intr(void *arg)
+{
+#if defined(KEYTEST) || defined(KEYTEST2)
+	struct wzero3kbd_softc *sc = device_private(arg);
+#endif
+
+	DPRINTF(("wzero3kbd_pwrkey_intr: status = %s\n",
+	    pxa2x0_gpio_get_bit(GPIO_WS003SH_POWER_BUTTON) ? "on" : "off"));
+
+	pxa2x0_gpio_clear_intr(sc->sc_pwrkey_pin);
+
+	/* XXX send power key scan code: KC(83) */
+
+#ifdef KEYTEST
+	if (pxa2x0_gpio_get_bit(GPIO_WS003SH_POWER_BUTTON)) {
+		pxa2x0_gpio_intr_disestablish(sc->sc_test_ih);
+		sc->sc_test_ih = NULL;
+
+		for (;;) {
+			if (++sc->sc_test_pin > 120)
+				sc->sc_test_pin = 2;
+			if (sc->sc_test_pin != 86 /* Vsync? */
+			 && sc->sc_test_pin != 95 /* power key */
+			 && GPIO_IS_GPIO_IN(pxa2x0_gpio_get_function(sc->sc_test_pin)))
+				break;
+		}
+		printf("GPIO%d\n", sc->sc_test_pin);
+		sc->sc_test_ih = pxa2x0_gpio_intr_establish(sc->sc_test_pin, IST_EDGE_BOTH, IPL_TTY, wzero3kbd_intr, sc);
+	}
+#endif
+#ifdef KEYTEST2
+	if (pxa2x0_gpio_get_bit(GPIO_WS003SH_POWER_BUTTON)) {
+		sc->sc_enabled ^= 2;
+		if (sc->sc_enabled & 2) {
+			printf("print col/row\n");
+		} else {
+			printf("keyscan\n");
+		}
+	}
+#endif
+
+	return 1;
+}
+
+static int
+wzero3kbd_input_establish(void *arg, struct hpckbd_if *kbdif)
+{
+	struct wzero3kbd_softc *sc = device_private(arg);
+
+	/* Save hpckbd interface. */
+	sc->sc_hpckbd = kbdif;
+
+	sc->sc_enabled = 1;
+
+	return 0;
+}
+
+static int
+wzero3kbd_poll(void *arg)
+{
+	struct wzero3kbd_softc *sc = device_private(arg);
+	int row, col, data;
+	int keydown;
+	int i;
+	int s;
+
+	if (!sc->sc_enabled) {
+		DPRINTF(("wzero3kbd_poll: disabled\n"));
+		return 0;
+	}
+
+	s = spltty();
+
+	for (col = 0; col < sc->sc_ncolumn; col++) {
+		/* deselect column# and charge */
+		CSR_WRITE1(KBDCOL_L, 0);
+		CSR_WRITE1(KBDCOL_U, 0);
+		CSR_WRITE1(KBDCHARGE, 1);
+		delay(KEYWAIT);
+
+		/* discharge & select scan column# */
+		CSR_WRITE1(KBDCHARGE, 0);
+		if (col < 8) {
+			CSR_WRITE1(KBDCOL_L, 1U << col);
+			CSR_WRITE1(KBDCOL_U, 0);
+		} else {
+			CSR_WRITE1(KBDCOL_L, 0);
+			CSR_WRITE1(KBDCOL_U, 1U << (col - 8));
+		}
+		delay(KEYWAIT);
+
+		for (row = 0; row < sc->sc_nrow; row++) {
+			CSR_WRITE1(KBDCHARGE, 0);
+			data = CSR_READ1(KBDDATA);
+#ifdef KEYTEST2
+			if (!(sc->sc_enabled & 2)) {
+#endif
+				sc->sc_keystat[row + col * sc->sc_nrow] =
+				    (data >> row) & 1;
+#ifdef KEYTEST2
+			} else {
+				if (data & (1 << row)) {
+					printf("col = %d, row = %d, idx = %d, data = 0x%02x\n", col, row, row + col * sc->sc_nrow, data);
+				}
+			}
+#endif
+		}
+	}
+
+	/* deselect column# and charge */
+	CSR_WRITE1(KBDCOL_L, 0);
+	CSR_WRITE1(KBDCOL_U, 0);
+	CSR_WRITE1(KBDCHARGE, 1);
+	delay(KEYWAIT);
+
+	/* discharge for power management */
+	CSR_WRITE1(KBDCHARGE, 0);
+
+	/* send key scan code */
+	keydown = 0;
+	for (i = 0; i < sc->sc_nrow * sc->sc_ncolumn; i++) {
+		uint8_t keystat = sc->sc_keystat[i];
+		keydown |= keystat;
+		if (keystat != sc->sc_okeystat[i]) {
+			int type = keystat ? 1 : 0;
+			hpckbd_input(sc->sc_hpckbd, type, i);
+			sc->sc_okeystat[i] = keystat;
+		}
+	}
+
+	splx(s);
+
+	return keydown;
+}
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/dev/wzero3_lcd.c src/sys/arch/hpcarm/dev/wzero3_lcd.c
--- src.orig/sys/arch/hpcarm/dev/wzero3_lcd.c	1970-01-01 09:00:00.000000000 +0900
+++ src/sys/arch/hpcarm/dev/wzero3_lcd.c	2008-04-29 11:31:19.000000000 +0900
@@ -0,0 +1,386 @@
+/*	$NetBSD$	*/
+
+/*
+ * Copyright (c) 2008 NONAKA Kimihiro <nonaka@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <dev/cons.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wscons_callbacks.h>
+
+#include <dev/hpc/hpcfbio.h>
+
+#include <arm/xscale/pxa2x0cpu.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_lcd.h>
+
+#include <machine/bus.h>
+#include <machine/bootinfo.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
+
+#ifdef DEBUG
+#define DPRINTF(arg)	printf arg
+#else
+#define DPRINTF(arg)	/* nothing */
+#endif
+
+/*
+ * wsdisplay glue
+ */
+static struct pxa2x0_wsscreen_descr wzero3lcd_std_screen = {
+	.c = {
+		.name = "std",
+		.textops = &pxa2x0_lcd_emulops,
+		.fontwidth = 8,
+		.fontheight = 16,
+		.capabilities = WSSCREEN_WSCOLORS,
+	},
+	.depth = 16,			/* bits per pixel */
+	.flags = 0,
+};
+
+static const struct wsscreen_descr *wzero3lcd_scr_descr[] = {
+	&wzero3lcd_std_screen.c
+};
+
+static const struct wsscreen_list wzero3lcd_screen_list = {
+	.nscreens = __arraycount(wzero3lcd_scr_descr),
+	.screens = wzero3lcd_scr_descr,
+};
+
+static int wzero3lcd_ioctl(void *, void *, u_long, void *, int, struct lwp *);
+static int wzero3lcd_param(struct pxa2x0_lcd_softc *, u_long, struct wsdisplay_param *);
+static int wzero3lcd_show_screen(void *, void *, int, void (*)(void *, int, int), void *);
+
+static struct wsdisplay_accessops wzero3lcd_accessops = {
+	wzero3lcd_ioctl,
+	pxa2x0_lcd_mmap,
+	pxa2x0_lcd_alloc_screen,
+	pxa2x0_lcd_free_screen,
+	wzero3lcd_show_screen,
+	NULL,
+	NULL,
+	NULL,
+};
+
+/* WS003SH or WS004SH */
+static const struct lcd_panel_geometry sharp_ws003sh = {
+	480,			/* Width */
+	640,			/* Height */
+	0,			/* No extra lines */
+
+	LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP,
+	1,			/* clock divider */
+	0,			/* AC bias pin freq */
+
+	0x14,			/* horizontal sync pulse width */
+	0x4e,			/* BLW */
+	0x46,			/* ELW */
+
+	0,			/* vertical sync pulse width */
+	2,			/* BFW */
+	5,			/* EFW */
+};
+
+static int	wzero3lcd_match(struct device *, struct cfdata *, void *);
+static void	wzero3lcd_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(wzero3lcd, sizeof(struct pxa2x0_lcd_softc),
+	wzero3lcd_match, wzero3lcd_attach, NULL, NULL);
+
+static const struct lcd_panel_geometry *wzero3lcd_lookup(void);
+void wzero3lcd_cnattach(void);
+void wzero3lcd_power(int, void *);
+
+int screen_rotate = 0;	// XXX
+
+static const struct lcd_panel_geometry *
+wzero3lcd_lookup(void)
+{
+
+	if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH)
+	 || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH))
+		return &sharp_ws003sh;
+	return NULL;
+}
+
+static int
+wzero3lcd_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+
+	if (strcmp(cf->cf_name, "lcd") != 0)
+		return 0;
+	if (wzero3lcd_lookup() == NULL)
+		return 0;
+
+	return 1;
+}
+
+static void
+wzero3lcd_attach(struct device *parent, struct device *self, void *aux)
+{
+	struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self;
+	struct wsemuldisplaydev_attach_args aa;
+	const struct lcd_panel_geometry *panel;
+
+	panel = wzero3lcd_lookup();
+	if (panel == NULL) {
+		aprint_error(": unknown device\n");
+		return;
+	}
+
+	switch (screen_rotate) {
+	default:
+	case 0:
+		wzero3lcd_std_screen.flags &= ~RI_ROTATE_CW;
+		break;
+	
+	case 90:	/* quarter clockwise rotation */
+		wzero3lcd_std_screen.flags |= RI_ROTATE_CW;
+		break;
+
+#if 0
+	case 270:	/* quarter counter clockwise rotation */
+		lcd_std_screen.flags |= RI_ROTATE_CW; /* XXX */
+		break;
+#endif
+	}
+	pxa2x0_lcd_attach_sub(sc, aux, panel);
+
+	aa.console = (bootinfo->bi_cnuse != BI_CNUSE_SERIAL);
+	aa.scrdata = &wzero3lcd_screen_list;
+	aa.accessops = &wzero3lcd_accessops;
+	aa.accesscookie = sc;
+
+	(void) config_found(self, &aa, wsemuldisplaydevprint);
+}
+
+void
+wzero3lcd_cnattach(void)
+{
+	const struct lcd_panel_geometry *panel;
+
+	panel = wzero3lcd_lookup();
+	if (panel == NULL)
+		return;
+
+	pxa2x0_lcd_cnattach(&wzero3lcd_std_screen, panel);
+}
+
+/*
+ * wsdisplay accessops overrides
+ */
+static int
+wzero3lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
+{
+	struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)v;
+	struct hpcfb_fbconf *fbconf;
+	struct hpcfb_dspconf *dspconf;
+	int res = EINVAL;
+
+	switch (cmd) {
+	case WSDISPLAYIO_GETPARAM:
+	case WSDISPLAYIO_SETPARAM:
+		res = wzero3lcd_param(sc, cmd, (struct wsdisplay_param *)data);
+		break;
+
+	case HPCFBIO_GCONF:
+		fbconf = (struct hpcfb_fbconf *)data;
+		if (fbconf->hf_conf_index != 0 &&
+		    fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
+			break;
+		}
+
+		fbconf->hf_conf_index = 0;
+		fbconf->hf_nconfs = 1;
+		fbconf->hf_class = HPCFB_CLASS_RGBCOLOR;
+		strlcpy(fbconf->hf_name, "Sharp W-ZERO3 frame buffer",
+		    sizeof(fbconf->hf_name));
+		strlcpy(fbconf->hf_conf_name, "default",
+		    sizeof(fbconf->hf_conf_name));
+		fbconf->hf_width = sc->geometry->panel_width;
+		fbconf->hf_height = sc->geometry->panel_height;
+		fbconf->hf_baseaddr = (u_long)sc->active->buf_va;
+		fbconf->hf_offset = 0;
+		fbconf->hf_bytes_per_line = sc->geometry->panel_width *
+		    sc->active->depth / 8;
+		fbconf->hf_nplanes = 1;
+		fbconf->hf_bytes_per_plane = sc->geometry->panel_width *
+		    sc->geometry->panel_height * sc->active->depth / 8;
+		fbconf->hf_pack_width = sc->active->depth;
+		fbconf->hf_pixels_per_pack = 1;
+		fbconf->hf_pixel_width = sc->active->depth;
+		fbconf->hf_access_flags = (0
+					   | HPCFB_ACCESS_BYTE
+					   | HPCFB_ACCESS_WORD
+					   | HPCFB_ACCESS_DWORD);
+		fbconf->hf_order_flags = 0;
+		fbconf->hf_reg_offset = 0;
+
+		fbconf->hf_class_data_length = sizeof(struct hf_rgb_tag);
+		fbconf->hf_u.hf_rgb.hf_flags = 0;
+		fbconf->hf_u.hf_rgb.hf_red_width = 5;
+		fbconf->hf_u.hf_rgb.hf_red_shift = 11;
+		fbconf->hf_u.hf_rgb.hf_green_width = 6;
+		fbconf->hf_u.hf_rgb.hf_green_shift = 5;
+		fbconf->hf_u.hf_rgb.hf_blue_width = 5;
+		fbconf->hf_u.hf_rgb.hf_blue_shift = 0;
+		fbconf->hf_u.hf_rgb.hf_alpha_width = 0;
+		fbconf->hf_u.hf_rgb.hf_alpha_shift = 0;
+
+		fbconf->hf_ext_size = 0;
+		fbconf->hf_ext_data = NULL;
+
+		res = 0;
+		break;
+
+	case HPCFBIO_SCONF:
+		fbconf = (struct hpcfb_fbconf *)data;
+		if (fbconf->hf_conf_index != 0 &&
+		    fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
+			break;
+		}
+		/* nothing to do because we have only one configuration */
+		res = 0;
+		break;
+
+	case HPCFBIO_GDSPCONF:
+		dspconf = (struct hpcfb_dspconf *)data;
+		if ((dspconf->hd_unit_index != 0 &&
+		     dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
+		    (dspconf->hd_conf_index != 0 &&
+		     dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
+			break;
+		}
+
+		dspconf->hd_unit_index = 0;
+		dspconf->hd_nunits = 1;
+		dspconf->hd_class = HPCFB_DSP_CLASS_COLORLCD;
+		strlcpy(dspconf->hd_name, "Sharp W-ZERO3 LCD",
+		    sizeof(dspconf->hd_name));
+		dspconf->hd_op_flags = 0;
+		dspconf->hd_conf_index = 0;
+		dspconf->hd_nconfs = 1;
+		strlcpy(dspconf->hd_conf_name, "default",
+		    sizeof(dspconf->hd_conf_name));
+		dspconf->hd_width = sc->geometry->panel_width;
+		dspconf->hd_height = sc->geometry->panel_height;
+		dspconf->hd_xdpi = HPCFB_DSP_DPI_UNKNOWN;
+		dspconf->hd_ydpi = HPCFB_DSP_DPI_UNKNOWN;
+
+		res = 0;
+		break;
+
+	case HPCFBIO_SDSPCONF:
+		dspconf = (struct hpcfb_dspconf *)data;
+		if ((dspconf->hd_unit_index != 0 &&
+		     dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
+		    (dspconf->hd_conf_index != 0 &&
+		     dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
+			break;
+		}
+		/*
+		 * nothing to do
+		 * because we have only one unit and one configuration
+		 */
+		res = 0;
+		break;
+
+	case HPCFBIO_GOP:
+	case HPCFBIO_SOP:
+		/* curently not implemented...  */
+		break;
+	}
+
+	if (res == EINVAL)
+		res = pxa2x0_lcd_ioctl(v, vs, cmd, data, flag, l);
+	return res;
+}
+
+static int
+wzero3lcd_show_screen(void *v, void *cookie, int waitok, void (*cb_func)(void *, int, int), void *cb_arg)
+{
+	int error;
+
+	error = pxa2x0_lcd_show_screen(v, cookie, waitok, cb_func, cb_arg);
+	if (error)
+		return (error);
+
+	return 0;
+}
+
+/*
+ * wsdisplay I/O controls
+ */
+static int
+wzero3lcd_param(struct pxa2x0_lcd_softc *sc, u_long cmd, struct wsdisplay_param *dp)
+{
+	int res = EINVAL;
+
+	switch (dp->param) {
+	case WSDISPLAYIO_PARAM_BACKLIGHT:
+		/* unsupported */
+		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_BACKLIGHT) isn't supported\n", device_xname(&sc->dev)));
+		res = ENOTTY;
+		break;
+
+	case WSDISPLAYIO_PARAM_CONTRAST:
+		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_CONTRAST) isn't supported\n", device_xname(&sc->dev)));
+		/* unsupported */
+		res = ENOTTY;
+		break;
+
+	case WSDISPLAYIO_PARAM_BRIGHTNESS:
+		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_BRIGHTNESS) isn't supported\n", device_xname(&sc->dev)));
+		/* unsupported */
+		res = ENOTTY;
+	}
+
+	return res;
+}
+
+void
+wzero3lcd_power(int why, void *v)
+{
+
+	switch (why) {
+	case PWR_SUSPEND:
+	case PWR_STANDBY:
+		pxa2x0_lcd_power(why, v);
+		break;
+
+	case PWR_RESUME:
+		pxa2x0_lcd_power(why, v);
+		break;
+	}
+}
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/hpcarm/autoconf.c src/sys/arch/hpcarm/hpcarm/autoconf.c
--- src.orig/sys/arch/hpcarm/hpcarm/autoconf.c	2008-02-16 07:22:27.000000000 +0900
+++ src/sys/arch/hpcarm/hpcarm/autoconf.c	2008-04-20 00:46:26.000000000 +0900
@@ -53,7 +53,10 @@
 #include <machine/config_hook.h>
 #include <machine/intr.h>
 
+#include "opt_cputypes.h"
+#if defined(CPU_SA1100) || defined(CPU_SA1110)
 #include "sacom.h"
+#endif
 
 extern dev_t dumpdev;
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/hpcarm/hpc_machdep.c src/sys/arch/hpcarm/hpcarm/hpc_machdep.c
--- src.orig/sys/arch/hpcarm/hpcarm/hpc_machdep.c	2008-04-29 11:38:35.000000000 +0900
+++ src/sys/arch/hpcarm/hpcarm/hpc_machdep.c	2008-04-29 12:03:20.000000000 +0900
@@ -1,5 +1,5 @@
 /*	$NetBSD: hpc_machdep.c,v 1.85 2008/04/27 18:58:47 matt Exp $	*/
-
+#define	DEBUG_BEFOREMMU
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
@@ -43,10 +43,20 @@
 __KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.85 2008/04/27 18:58:47 matt Exp $");
 
 #include "opt_ddb.h"
+#include "opt_dram_pages.h"
 #include "opt_pmap_debug.h"
 #include "fs_nfs.h"
 #include "ksyms.h"
 
+#include "opt_cputypes.h"
+#if defined(CPU_SA1100) || defined(CPU_SA1110)
+#define	CPU_SA11X0
+#elif defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
+#define	CPU_PXA2X0
+#else
+#error	unknown cputype!!!
+#endif
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -57,6 +67,7 @@
 #include <sys/ksyms.h>
 #include <sys/boot_flag.h>
 #include <sys/conf.h>	/* XXX for consinit related hacks */
+#include <sys/termios.h>
 
 #if NKSYMS || defined(DDB) || defined(LKM)
 #include <machine/db_machdep.h>
@@ -71,17 +82,27 @@
 
 #include <uvm/uvm.h>
 
+#ifdef CPU_SA11X0
 #include <arm/sa11x0/sa11x0_reg.h>
+#endif
+#ifdef CPU_PXA2X0
+#include <arm/xscale/pxa2x0cpu.h>
+#include <arm/xscale/pxa2x0reg.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_gpio.h>
+#endif
 #include <arm/cpuconf.h>
 #include <arm/undefined.h>
 
 #include <machine/bootconfig.h>
 #include <machine/bootinfo.h>
+#include <machine/bus.h>
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/intr.h>
 #include <machine/io.h>
 #include <machine/platid.h>
+#include <machine/platid_mask.h>
 #include <machine/rtc.h>
 #include <machine/signal.h>
 
@@ -89,6 +110,16 @@
 #include <dev/hpc/apm/apmvar.h>
 #include <dev/hpc/bicons.h>
 
+#ifdef CPU_PXA2X0
+#include "com.h"
+#if (NCOM > 0)
+#include "opt_com.h"
+#include <dev/ic/comvar.h>
+#endif	/* NCOM > 0 */
+#include "lcd.h"
+#include "wzero3lcd.h"
+#endif	/* CPU_PXA2X0 */
+
 #ifdef NFS
 #include <sys/mount.h>
 #include <nfs/rpcv2.h>
@@ -97,8 +128,14 @@
 #include <nfs/nfsmount.h>
 #endif /* NFS */
 
+#ifdef CPU_SA11X0
 /* Kernel text starts 256K in from the bottom of the kernel address space. */
 #define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x00040000)
+#endif
+#ifdef CPU_PXA2X0
+/* Kernel text starts 2MB in from the bottom of the kernel address space. */
+#define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x00200000)
+#endif
 #define	KERNEL_VM_BASE		(KERNEL_BASE + 0x00C00000)
 #define	KERNEL_VM_SIZE		0x05000000
 
@@ -155,8 +192,8 @@
 #define	KERNEL_PT_IO		2	/* Page table for mapping IO */
 #define	KERNEL_PT_KERNEL	3	/* Page table for mapping kernel */
 #define	KERNEL_PT_KERNEL_NUM	4
-#define KERNEL_PT_VMDATA	(KERNEL_PT_KERNEL+KERNEL_PT_KERNEL_NUM)
-				        /* Page tables for mapping kernel VM */
+#define	KERNEL_PT_VMDATA	(KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
+					/* Page tables for mapping kernel VM */
 #define	KERNEL_PT_VMDATA_NUM	4	/* start with 16MB of KVM */
 #define	NUM_KERNEL_PTS		(KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
 
@@ -164,18 +201,24 @@
 
 struct user *proc0paddr;
 
+#ifdef CPU_SA11X0
 #define CPU_SA110_CACHE_CLEAN_SIZE (0x4000 * 2)
 extern unsigned int sa1_cache_clean_addr;
 extern unsigned int sa1_cache_clean_size;
 static vaddr_t sa1_cc_base;
 
+/* Non-buffered non-cacheable memory needed to enter idle mode */
+extern vaddr_t sa11x0_idle_mem;
+#endif
+
+#ifdef CPU_PXA2X0
+pv_addr_t minidataclean;
+#endif
+
 /* Mode dependent sleep function holder */
 void (*__sleep_func)(void *);
 void *__sleep_ctx;
 
-/* Non-buffered non-cacheable memory needed to enter idle mode */
-extern vaddr_t sa11x0_idle_mem;
-
 /* Prototypes */
 void		data_abort_handler(trapframe_t *);
 void		prefetch_abort_handler(trapframe_t *);
@@ -270,6 +313,7 @@
  * them while booting the kernel and stay at the same address
  * throughout whole kernel's life time.
  */
+#ifdef CPU_SA11X0
 static const struct pmap_devmap sa11x0_devmap[] = {
 	/* Physical/virtual address for UART #3. */
 	{
@@ -280,6 +324,94 @@
 	},
 	{ 0, 0, 0, 0, 0 }
 };
+#endif
+#ifdef CPU_PXA2X0
+#define	PXA2X0_GPIO_VBASE	0xfd000000
+#define	PXA2X0_CLKMAN_VBASE	0xfd100000
+#define	PXA2X0_INTCTL_VBASE	0xfd200000
+#define	PXA2X0_MEMCTL_VBASE	0xfd300000
+#define	PXA2X0_FFUART_VBASE	0xfd400000
+#define	PXA2X0_BTUART_VBASE	0xfd500000
+#define	PXA2X0_STUART_VBASE	0xfd600000
+
+#define	_A(a)	((a) & L1_S_FRAME)
+#define	_S(s)	(((s) + L1_S_SIZE - 1) & L1_S_FRAME)
+const struct pmap_devmap pxa2x0_devmap[] = {
+    {
+	    PXA2X0_GPIO_VBASE,
+	    _A(PXA2X0_GPIO_BASE),
+	    _S(PXA2X0_GPIO_SIZE),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_CLKMAN_VBASE,
+	    _A(PXA2X0_CLKMAN_BASE),
+	    _S(PXA2X0_CLKMAN_SIZE),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_INTCTL_VBASE,
+	    _A(PXA2X0_INTCTL_BASE),
+	    _S(PXA2X0_INTCTL_SIZE),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_MEMCTL_VBASE,
+	    _A(PXA2X0_MEMCTL_BASE),
+	    _S(PXA2X0_MEMCTL_SIZE),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_FFUART_VBASE,
+	    _A(PXA2X0_FFUART_BASE),
+	    _S(4 * COM_NPORTS),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_BTUART_VBASE,
+	    _A(PXA2X0_BTUART_BASE),
+	    _S(4 * COM_NPORTS),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+    {
+	    PXA2X0_STUART_VBASE,
+	    _A(PXA2X0_STUART_BASE),
+	    _S(4 * COM_NPORTS),
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE,
+    },
+
+    { 0, 0, 0, 0, 0, }
+};
+#undef	_A
+#undef	_S
+
+static struct pxa2x0_gpioconf ws003sh_boarddep_gpioconf[] = {
+	{  41, GPIO_ALT_FN_1_IN },	/* FFRXD */
+	{  99, GPIO_ALT_FN_3_OUT },	/* FFTXD */
+	{  98, GPIO_ALT_FN_3_OUT },	/* FFRTS */
+#if 0
+	{  40, GPIO_ALT_FN_2_OUT },	/* FFDTR */
+	{  100, GPIO_ALT_FN_1_IN },	/* FFCTS */
+#endif
+
+	{ -1 }
+};
+static struct pxa2x0_gpioconf *ws003sh_gpioconf[] = {
+	pxa27x_com_ffuart_gpioconf,
+	ws003sh_boarddep_gpioconf,
+	NULL
+};
+
+static inline pd_entry_t *
+read_ttb(void)
+{
+	u_long ttb;
+
+	__asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb));
+
+	return (pd_entry_t *)(ttb & ~((1 << 14) - 1));
+}
+#endif
 
 /*
  * Initial entry point on startup. This gets called before main() is
@@ -294,6 +426,12 @@
 u_int
 initarm(int argc, char **argv, struct bootinfo *bi)
 {
+#ifdef CPU_PXA2X0
+#ifdef DIAGNOSTIC
+	extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */
+#endif
+	extern vaddr_t xscale_cache_clean_addr;
+#endif
 	u_int kerneldatasize, symbolsize;
 	u_int l1pagetable;
 	vaddr_t freemempos;
@@ -306,11 +444,85 @@
 	__sleep_func = NULL;
 	__sleep_ctx = NULL;
 
+	/* parse kernel args */
+	boothowto = 0;
+	boot_file[0] = '\0';
+	strncpy(booted_kernel_storage, argv[0], sizeof(booted_kernel_storage));
+	for (i = 1; i < argc; i++) {
+		char *cp = argv[i];
+
+		switch (*cp) {
+		case 'b':
+			/* boot device: -b=sd0 etc. */
+			cp = cp + 2;
+#ifdef NFS
+			if (strcmp(cp, "nfs") == 0)
+				mountroot = nfs_mountroot;
+			else
+				strncpy(boot_file, cp, sizeof(boot_file));
+#else /* !NFS */
+			strncpy(boot_file, cp, sizeof(boot_file));
+#endif /* !NFS */
+			break;
+		default:
+			BOOT_FLAG(*cp, boothowto);
+			break;
+		}
+	}
+
+	/* copy bootinfo into known kernel space */
+	bootinfo_storage = *bi;
+	bootinfo = &bootinfo_storage;
+
+#ifdef BOOTINFO_FB_WIDTH
+	bootinfo->fb_line_bytes = BOOTINFO_FB_LINE_BYTES;
+	bootinfo->fb_width = BOOTINFO_FB_WIDTH;
+	bootinfo->fb_height = BOOTINFO_FB_HEIGHT;
+	bootinfo->fb_type = BOOTINFO_FB_TYPE;
+#endif
+
+	if (bootinfo->magic == BOOTINFO_MAGIC) {
+		platid.dw.dw0 = bootinfo->platid_cpu;
+		platid.dw.dw1 = bootinfo->platid_machine;
+	}
+
 	/*
 	 * Heads up ... Setup the CPU / MMU / TLB functions.
 	 */
 	set_cpufuncs();
 
+#ifdef CPU_PXA2X0
+	pxa2x0_memctl_bootstrap(PXA2X0_MEMCTL_BASE);
+	pxa2x0_intr_bootstrap(PXA2X0_INTCTL_BASE);
+	pmap_devmap_bootstrap((vaddr_t)read_ttb(), pxa2x0_devmap);
+	pxa2x0_memctl_bootstrap(PXA2X0_MEMCTL_VBASE);
+	pxa2x0_intr_bootstrap(PXA2X0_INTCTL_VBASE);
+	pxa2x0_clkman_bootstrap(PXA2X0_CLKMAN_VBASE);
+	pxa2x0_gpio_bootstrap(PXA2X0_GPIO_VBASE);
+	if (bi->magic == BOOTINFO_MAGIC) {
+		if ((bi->platid_cpu == PLATID_CPU_ARM_XSCALE_PXA270)
+		 && (bi->platid_machine == PLATID_MACH_SHARP_WZERO3_WS003SH)) {
+			pxa2x0_gpio_config(ws003sh_gpioconf);
+			pxa2x0_clkman_config(CKEN_FFUART, 1);
+			pxa2x0_clkman_config(CKEN_NSSP, 1); /* XXXOST */
+			pxa2x0_clkman_config(CKEN_PWM0, 0);
+			pxa2x0_clkman_config(CKEN_PWM1, 0);
+			pxa2x0_clkman_config(CKEN_AC97, 0);
+			pxa2x0_clkman_config(CKEN_SSP, 0);
+			pxa2x0_clkman_config(CKEN_HWUART, 0);
+			pxa2x0_clkman_config(CKEN_STUART, 0);
+			pxa2x0_clkman_config(CKEN_BTUART, 0);
+			pxa2x0_clkman_config(CKEN_I2S, 0);
+			pxa2x0_clkman_config(CKEN_USBHC, 0);
+			pxa2x0_clkman_config(CKEN_USBDC, 0);
+			pxa2x0_clkman_config(CKEN_MMC, 0);
+			pxa2x0_clkman_config(CKEN_FICP, 0);
+			pxa2x0_clkman_config(CKEN_I2C, 0);
+//			pxa2x0_clkman_config(CKEN_LCD, 0);
+		}
+	}
+#endif
+
 #ifdef DEBUG_BEFOREMMU
 	/*
 	 * At this point, we cannot call real consinit().
@@ -324,11 +536,16 @@
 	 * XXX for now, overwrite bootconfig to hardcoded values.
 	 * XXX kill bootconfig and directly call uvm_physload
 	 */
+#ifdef CPU_SA11X0
 	bootconfig.dram[0].address = 0xc0000000;
+#endif
+#ifdef CPU_PXA2X0
+	bootconfig.dram[0].address = 0xa0000000;
+#endif
 	bootconfig.dram[0].pages = DRAM_PAGES;
 	bootconfig.dramblocks = 1;
-	kerneldatasize = (uint32_t)&end - (uint32_t)KERNEL_TEXT_BASE;
 
+	kerneldatasize = (uint32_t)&end - (uint32_t)KERNEL_TEXT_BASE;
 	symbolsize = 0;
 #if NKSYMS || defined(DDB) || defined(LKM)
 	if (!memcmp(&end, "\177ELF", 4)) {
@@ -346,43 +563,6 @@
 	kerneldatasize = ((kerneldatasize - 1) & ~(PAGE_SIZE * 4 - 1)) +
 	    PAGE_SIZE * 8;
 
-	/* parse kernel args */
-	boothowto = 0;
-	boot_file[0] = '\0';
-	strncpy(booted_kernel_storage, argv[0], sizeof(booted_kernel_storage));
-	for (i = 1; i < argc; i++) {
-		char *cp = argv[i];
-
-		switch (*cp) {
-		case 'b':
-			/* boot device: -b=sd0 etc. */
-			cp = cp + 2;
-#ifdef NFS
-			if (strcmp(cp, "nfs") == 0)
-				mountroot = nfs_mountroot;
-			else
-				strncpy(boot_file, cp, sizeof(boot_file));
-#else /* !NFS */
-			strncpy(boot_file, cp, sizeof(boot_file));
-#endif /* !NFS */
-			break;
-		default:
-			BOOT_FLAG(*cp, boothowto);
-			break;
-		}
-	}
-
-	/* copy bootinfo into known kernel space */
-	bootinfo_storage = *bi;
-	bootinfo = &bootinfo_storage;
-
-#ifdef BOOTINFO_FB_WIDTH
-	bootinfo->fb_line_bytes = BOOTINFO_FB_LINE_BYTES;
-	bootinfo->fb_width = BOOTINFO_FB_WIDTH;
-	bootinfo->fb_height = BOOTINFO_FB_HEIGHT;
-	bootinfo->fb_type = BOOTINFO_FB_TYPE;
-#endif
-
 	/*
 	 * hpcboot has loaded me with MMU disabled.
 	 * So create kernel page tables and enable MMU.
@@ -404,9 +584,15 @@
     
 	/* XXX handle UMA framebuffer memory */
 
+#ifdef CPU_SA11X0
 	/* Use the first 256kB to allocate things */
 	freemempos = KERNEL_BASE;
 	memset((void *)KERNEL_BASE, 0, KERNEL_TEXT_BASE - KERNEL_BASE);
+#endif
+#ifdef CPU_PXA2X0
+	freemempos = 0xa0009000UL;
+	memset((void *)freemempos, 0, KERNEL_TEXT_BASE - KERNEL_BASE - 0x9000);
+#endif
 
 	/*
 	 * Right. We have the bottom meg of memory mapped to 0x00000000
@@ -414,7 +600,7 @@
 	 * After the kernel/args we allocate some of the fixed page tables
 	 * we need to get the system going.
 	 * We allocate one page directory and NUM_KERNEL_PTS page tables
-	 * and store the physical addresses in the kernel_pt_table array.	
+	 * and store the physical addresses in the kernel_pt_table array.
 	 * Must remember that neither the page L1 or L2 page tables are the
 	 * same size as a page !
 	 *
@@ -425,7 +611,7 @@
 	 * The start address will be page aligned.
 	 * We allocate the kernel page directory on the first free 16KB
 	 * boundary we find.
-	 * We allocate the kernel page tables on the first 1KB boundary we 
+	 * We allocate the kernel page tables on the first 1KB boundary we
 	 * find.  We allocate at least 9 PT's (12 currently).  This means
 	 * that in the process we KNOW that we will encounter at least one
 	 * 16KB boundary.
@@ -440,19 +626,42 @@
 
 	/* Define a macro to simplify memory allocation */
 #define	valloc_pages(var, np)			\
-	(var).pv_pa = (var).pv_va = freemempos;	\
-	freemempos += (np) * PAGE_SIZE;
+	alloc_pages((var).pv_pa, (np));		\
+	(var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
 #define	alloc_pages(var, np)			\
 	(var) = freemempos;			\
 	freemempos += (np) * PAGE_SIZE;
 
-
+#ifdef CPU_SA11X0
 	valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
 	for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
 		alloc_pages(kernel_pt_table[loop].pv_pa,
 		    L2_TABLE_SIZE / PAGE_SIZE);
 		kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa;
 	}
+#endif
+#ifdef CPU_PXA2X0
+	{
+		int loop1 = 0;
+		kernel_l1pt.pv_pa = 0;
+		kernel_l1pt.pv_va = 0;
+		for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
+			/* Are we 16KB aligned for an L1 ? */
+			if (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) == 0
+			    && kernel_l1pt.pv_pa == 0) {
+				valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
+			} else {
+				valloc_pages(kernel_pt_table[loop1],
+				    L2_TABLE_SIZE / PAGE_SIZE);
+				++loop1;
+			}
+		}
+	}
+#endif
+
+	/* This should never be able to happen but better confirm that. */
+	if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_SIZE-1)) != 0)
+		panic("initarm: Failed to align the kernel page directory");
 
 	/*
 	 * Allocate a page for the system page mapped to V0x00000000
@@ -461,7 +670,7 @@
 	 */
 	valloc_pages(systempage, 1);
 
-	pt_size = round_page(freemempos) - KERNEL_BASE;
+	pt_size = round_page(freemempos) - physical_start;
 
 	/* Allocate stacks for all modes */
 	valloc_pages(irqstack, IRQ_STACK_SIZE);
@@ -482,6 +691,7 @@
 
 	alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / PAGE_SIZE);
 
+#ifdef CPU_SA11X0
 	/*
 	 * XXX Actually, we only need virtual space and don't need
 	 * XXX physical memory for sa110_cc_base and sa11x0_idle_mem.
@@ -504,6 +714,17 @@
 	sa1_cache_clean_size = CPU_SA110_CACHE_CLEAN_SIZE / 2;
 
 	alloc_pages(sa11x0_idle_mem, 1);
+#endif
+#ifdef CPU_PXA2X0
+	/* Allocate enough pages for cleaning the Mini-Data cache. */
+	KASSERT(xscale_minidata_clean_size <= PAGE_SIZE);
+	valloc_pages(minidataclean, 1);
+#ifdef VERBOSE_INIT_ARM
+	printf("minidataclean: p0x%08lx v0x%08lx, size = %ld\n",
+	    minidataclean.pv_pa, minidataclean.pv_va,
+	    xscale_minidata_clean_size);
+#endif
+#endif
 
 	/*
 	 * Ok, we have allocated physical pages for the primary kernel
@@ -524,13 +745,15 @@
 	/* Map the L2 pages tables in the L1 page table */
 	pmap_link_l2pt(l1pagetable, 0x00000000,
 	    &kernel_pt_table[KERNEL_PT_SYS]);
+#ifdef CPU_SA11X0
 #define SAIPIO_BASE		0xd0000000		/* XXX XXX */
 	pmap_link_l2pt(l1pagetable, SAIPIO_BASE,
 	    &kernel_pt_table[KERNEL_PT_IO]);
-	for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
+#endif
+	for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; ++loop)
 		pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
 		    &kernel_pt_table[KERNEL_PT_KERNEL + loop]);
-	for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
+	for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop)
 		pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
 		    &kernel_pt_table[KERNEL_PT_VMDATA + loop]);
 
@@ -560,8 +783,8 @@
 	} else
 #endif
 		pmap_map_chunk(l1pagetable, KERNEL_TEXT_BASE,
-		    KERNEL_TEXT_BASE, kerneldatasize,
-		    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+		    KERNEL_TEXT_BASE - KERNEL_BASE + physical_start,
+		    kerneldatasize, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
 #ifdef VERBOSE_INIT_ARM
 	printf("Constructing L2 page tables\n");
@@ -580,30 +803,63 @@
 	pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
 	    L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
 
+#ifdef CPU_SA11X0
 	/* Map page tables */
-	pmap_map_chunk(l1pagetable, KERNEL_BASE, KERNEL_BASE, pt_size,
-	    VM_PROT_READ | VM_PROT_WRITE, PTE_PAGETABLE);
+	pmap_map_chunk(l1pagetable, KERNEL_BASE, physical_start, pt_size,
+	    VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
 
 	/* Map a page for entering idle mode */
 	pmap_map_entry(l1pagetable, sa11x0_idle_mem, sa11x0_idle_mem,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
+#endif
+#ifdef CPU_PXA2X0
+	/* Map page tables */
+	for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
+		pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
+		    kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
+		    VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
+	}
+
+	/* Map the Mini-Data cache clean area. */
+	xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
+	    minidataclean.pv_pa);
+#endif
 
 	/* Map the vector page. */
 	pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
+#ifdef CPU_SA11X0
 	/* Map the statically mapped devices. */
 	pmap_devmap_bootstrap(l1pagetable, sa11x0_devmap);
 
 	pmap_map_chunk(l1pagetable, sa1_cache_clean_addr, 0xe0000000,
 	    CPU_SA110_CACHE_CLEAN_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+#endif
+#ifdef CPU_PXA2X0
+	/*
+	 * map integrated peripherals at same address in l1pagetable
+	 * so that we can continue to use console.
+	 */
+	pmap_devmap_bootstrap(l1pagetable, pxa2x0_devmap);
+
+	/*
+	 * Give the XScale global cache clean code an appropriately
+	 * sized chunk of unmapped VA space starting at 0xff000000
+	 * (our device mappings end before this address).
+	 */
+	xscale_cache_clean_addr = 0xff000000U;
+#endif
+
 	/*
 	 * Now we have the real page tables in place so we can switch to them.
 	 * Once this is done we will be running with the REAL kernel page
 	 * tables.
 	 */
 
+#ifdef VERBOSE_INIT_ARM
 	printf("done.\n");
+#endif
 
 	/*
 	 * Pages were allocated during the secondary bootstrap for the
@@ -613,7 +869,9 @@
 	 * Since the ARM stacks use STMFD etc. we must set r13 to the top end
 	 * of the stack memory.
 	 */
+#ifdef VERBOSE_INIT_ARM
 	printf("init subsystems: stacks ");
+#endif
 
 	set_stackptr(PSR_IRQ32_MODE,
 	    irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
@@ -635,18 +893,27 @@
 	 * Initialization of the vectors will just panic on a data abort.
 	 * This just fills in a slightly better one.
 	 */
+#ifdef VERBOSE_INIT_ARM
 	printf("vectors ");
+#endif
 	data_abort_handler_address = (u_int)data_abort_handler;
 	prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
 	undefined_handler_address = (u_int)undefinedinstruction_bounce;
+#ifdef DEBUG
 	printf("%08x %08x %08x\n", data_abort_handler_address,
 	    prefetch_abort_handler_address, undefined_handler_address); 
+#endif
 
 	/* Initialize the undefined instruction handlers */
-	printf("undefined ");
+#ifdef VERBOSE_INIT_ARM
+	printf("undefined\n");
+#endif
 	undefined_init();
 
 	/* Set the page table address. */
+#ifdef VERBOSE_INIT_ARM
+	printf("switching to new L1 page table  @%#lx...\n", kernel_l1pt.pv_pa);
+#endif
 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
 	setttb(kernel_l1pt.pv_pa);
 	cpu_tlb_flushID();
@@ -663,12 +930,28 @@
 	dumppages((char *)0xc0000000, 16 * PAGE_SIZE);
 	dumppages((char *)0xb0100000, 64); /* XXX */
 #endif
+#ifdef CPU_SA11X0
 	/* Enable MMU, I-cache, D-cache, write buffer. */
 	cpufunc_control(0x337f, 0x107d);
+#endif
 
 	arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
 
 	consinit();
+#if 0	/* XXX */
+	printf("GPDR0 = 0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GPDR0));
+	printf("GPDR1 = 0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GPDR1));
+	printf("GPDR2 = 0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GPDR2));
+	printf("GPDR3 = 0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GPDR3));
+	printf("GAFR0U/L = 0x%08x/0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR0_U), *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR0_L));
+	printf("GAFR1U/L = 0x%08x/0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR1_U), *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR1_L));
+	printf("GAFR2U/L = 0x%08x/0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR2_U), *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR2_L));
+	printf("GAFR3U/L = 0x%08x/0x%08x\n", *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR3_U), *(volatile uint32_t *)(PXA2X0_GPIO_VBASE + GPIO_GAFR3_L));
+#endif	/* XXX */
+
+#ifdef VERBOSE_INIT_ARM
+	printf("bootstrap done.\n");
+#endif
 
 #ifdef VERBOSE_INIT_ARM
 	printf("freemempos=%08lx\n", freemempos);
@@ -713,11 +996,6 @@
 		Debugger();
 #endif /* DDB */
 
-	if (bootinfo->magic == BOOTINFO_MAGIC) {
-		platid.dw.dw0 = bootinfo->platid_cpu;
-		platid.dw.dw1 = bootinfo->platid_machine;
-	}
-
 	/* We return the new stack pointer address */
 	return (kernelstack.pv_va + USPACE_SVC_STACK_TOP);
 }
@@ -733,9 +1011,32 @@
 void
 machine_standby(void)
 {
-
 }
 
+#if (NCOM > 0) && defined(COM_PXA2X0)
+#ifndef	CONSPEED
+#define	CONSPEED 9600
+#endif
+#ifndef	CONMODE
+#define	CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
+#endif
+
+int comcnspeed = CONSPEED;
+int comcnmode = CONMODE;
+
+#if defined(HWUARTCONSOLE)
+#define	CONADDR	PXA2X0_HWUART_BASE
+#elsif defined(BTUARTCONSOLE)
+#define	CONADDR	PXA2X0_BTUART_BASE
+#elsif defined(STUARTCONSOLE)
+#define	CONADDR	PXA2X0_STUART_BASE
+#else
+#define	CONADDR	PXA2X0_FFUART_BASE
+#endif
+
+bus_addr_t comcnaddr = CONADDR;
+#endif	/* NCOM > 0 && COM_PXA2X0 */
+
 void
 consinit(void)
 {
@@ -745,13 +1046,24 @@
 		return;
 
 	consinit_called = 1;
-	if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL)
+	if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL) {
+#ifdef CPU_SA11X0
 		cninit();
-	else {
-		/*
-		 * Nothing to do here.  Console initialization is done at
-		 * autoconf device attach time.
-		 */
+#endif
+#if defined(CPU_PXA2X0) && (NCOM > 0) && defined(COM_PXA2X0)
+		comcnattach(&pxa2x0_a4x_bs_tag, comcnaddr, comcnspeed,
+		    PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode);
+#endif
+	} else {
+#if (NLCD > 0) && defined(CPU_PXA2X0)
+#if NWZERO3LCD > 0
+		if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH)
+		 || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH)) {
+			extern void wzero3lcd_cnattach(void);
+			wzero3lcd_cnattach();
+		}
+#endif
+#endif
 	}
 }
 
@@ -761,11 +1073,17 @@
 static void
 fakecninit(void)
 {
+#ifdef CPU_SA11X0
 	static struct consdev fakecntab = cons_init(sacom);
 	cn_tab = &fakecntab;
 
 	(*cn_tab->cn_init)(0);
 	cn_tab->cn_pri = CN_REMOTE;
+#endif
+#if defined(CPU_PXA2X0) && (NCOM > 0) && defined(COM_PXA2X0)
+	comcnattach(&pxa2x0_a4x_bs_tag, comcnaddr, comcnspeed,
+	    PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode);
+#endif
 }
 #endif
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/hpcarm/intr.c src/sys/arch/hpcarm/hpcarm/intr.c
--- src.orig/sys/arch/hpcarm/hpcarm/intr.c	2007-12-08 09:18:10.000000000 +0900
+++ src/sys/arch/hpcarm/hpcarm/intr.c	2008-04-20 02:19:26.000000000 +0900
@@ -39,6 +39,7 @@
 __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.15 2007/12/03 15:33:42 ad Exp $");
 
 #include "opt_irqstats.h"
+#include "opt_cputypes.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,10 +74,12 @@
 extern void comsoft(void);
 #endif	/* NCOM > 0 */
 
+#if defined(CPU_SA1100) || defined(CPU_SA1110)
 #include "sacom.h"
 #if NSACOM > 0
 extern void sacomsoft(void);
 #endif	/* NSACOM > 0 */
+#endif
 
 /* Eventually these will become macros */
 
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/hpcarm/locore.S src/sys/arch/hpcarm/hpcarm/locore.S
--- src.orig/sys/arch/hpcarm/hpcarm/locore.S	2008-01-25 23:45:05.000000000 +0900
+++ src/sys/arch/hpcarm/hpcarm/locore.S	2008-04-21 22:29:32.000000000 +0900
@@ -31,6 +31,7 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_cputypes.h"
 #include "assym.h"
 #include <sys/syscall.h>
 #include <sys/errno.h>
@@ -38,6 +39,11 @@
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/param.h>
+#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
+#include <arm/armreg.h>
+#include <arm/arm32/pte.h>
+#include <arm/arm32/pmap.h>     /* for PMAP_DOMAIN_KERNEL */
+#endif
 
 /* What size should this really be ? It is only used by init_arm() */
 #define INIT_ARM_STACK_SIZE	2048
@@ -53,7 +59,7 @@
 	/* Put the processer in SVC mode */
 	mov	r5, sp
 	mrs	r4, cpsr_all
-	bic	r4, r4, #31
+	bic	r4, r4, #(PSR_MODE)
 	orr	r4, r4, #(PSR_SVC32_MODE)
 	msr	cpsr_all, r4
 	mov	sp, r5
@@ -62,6 +68,95 @@
 	mov	r4, #0
 	mcr	15, 0, r4, c13, c0, 0
 
+#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
+/*
+ * CPWAIT -- Canonical method to wait for CP15 update.
+ * NOTE: Clobbers the specified temp reg.
+ * copied from arm/arm/cpufunc_asm_xscale.S
+ * XXX: better be in a common header file.
+ */
+#define	CPWAIT_BRANCH							 \
+	sub	pc, pc, #4
+
+#define	CPWAIT(tmp)							 \
+	mrc	p15, 0, tmp, c2, c0, 0	/* arbitrary read of CP15 */	;\
+	mov	tmp, tmp		/* wait for it to complete */	;\
+	CPWAIT_BRANCH			/* branch to next insn */
+
+	/*
+	 *  Kernel is loaded in SDRAM (0xa0200000..), and is expected to run
+	 *  in VA 0xc0200000..  
+	 */
+
+	/* build page table from scratch */
+	adr	r9, .Lstartup_pagetable
+	ldr	r9, [r9]
+	adr	r4, .Lmmu_init_table
+	b	3f
+
+2:
+	str	r8, [r9, r7]
+	add	r7, r7, #4
+	add	r8, r8, #(L1_S_SIZE)
+	subs	r6, r6, #1
+	bne	2b
+3:
+	ldmia	r4!, {r6,r7,r8}		/* # of sections, VA, PA|attr */
+	cmp	r6, #0
+	bne	2b
+
+	/* Set translation table */
+	mcr	p15, 0, r9, c2, c0, 0
+	mcr	p15, 0, r9, c8, c7, 0	/* flush I/D-TLBs */
+	CPWAIT(r9)
+
+	/* Set the Domain Access register.  Very important! */
+	mov	r9, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
+	mcr	p15, 0, r9, c3, c0, 0
+
+	/* Enable MMU */
+	mrc	p15, 0, r9, c1, c0, 0
+	orr	r9, r9, #CPU_CONTROL_SYST_ENABLE
+	orr	r9, r9, #CPU_CONTROL_MMU_ENABLE
+	mcr	p15, 0, r9, c1, c0, 0
+	CPWAIT(r9)
+
+	/* Jump to kernel code in TRUE VA */
+	adr	r9, .Lstart
+	ldmia	r9, {r9, sp}		/* and set stack pointer */
+	mov	pc, r9
+
+.Lstart:
+	.word	hpc_start
+	.word	svcstk + INIT_ARM_STACK_SIZE
+
+#define MMU_INIT(va,pa,n_sec,attr)					\
+	.word	(n_sec);						\
+	.word	4 * ((va) >> L1_S_SHIFT);				\
+	.word	(pa)|(attr);
+
+.Lstartup_pagetable:
+	.word	0xa0004000
+
+.Lmmu_init_table:	
+	/* fill all table VA==PA */
+	MMU_INIT(0x00000000, 0x00000000, 1<<(32-L1_S_SHIFT), L1_TYPE_S|L1_S_AP(AP_KRW))
+	/* map SDRAM VA==PA, WT cacheable */
+	MMU_INIT(0xa0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
+	/* map VA 0xc0000000..0xcfffffff to PA 0xa0000000..0xafffffff */
+	MMU_INIT(0xc0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
+
+	.word	0,0,0	/* end of table */
+
+	.bss
+svcstk:
+	.space	INIT_ARM_STACK_SIZE
+
+	.text
+	.align	0
+ASENTRY_NP(hpc_start)
+#endif
+
 	mov	fp, #0x00000000		/* trace back starts here */
 	bl	_C_LABEL(initarm)	/* Off we go */
 
@@ -74,19 +169,12 @@
 	sub	fp, ip, #4
 
 	/* Setup an initial trap frame for start_init to use */
-
 	PUSHFRAME
-
 	mov	r0, sp			/* parameter to main is trap frame */ 
-
 	bl	_C_LABEL(main)		/* Lets light the flame and start her up */
-
 	PULLFRAME			/* Pull the trap frame, now valid */
-
 	movs	pc, lr			/* Exit to user process */
-
 	/* Never gets here */
-
 	b	.
 
 	.text
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/arch/hpcarm/include/intr.h src/sys/arch/hpcarm/include/intr.h
--- src.orig/sys/arch/hpcarm/include/intr.h	2008-04-29 11:38:35.000000000 +0900
+++ src/sys/arch/hpcarm/include/intr.h	2008-04-29 12:13:55.000000000 +0900
@@ -36,6 +36,8 @@
 #ifndef _HPCARM_INTR_H_
 #define _HPCARM_INTR_H_
 
+#ifdef _KERNEL
+
 #ifdef __HAVE_FAST_SOFTINTS
 #define IPL_NONE	0
 #define IPL_SOFTCLOCK	1
@@ -66,7 +68,110 @@
 #define	IST_EDGE	2	/* edge-triggered */
 #define	IST_LEVEL	3	/* level-triggered */
 
+#define IST_LEVEL_LOW	 IST_LEVEL
+#define IST_LEVEL_HIGH   4
+#define IST_EDGE_FALLING IST_EDGE
+#define IST_EDGE_RISING  5
+#define IST_EDGE_BOTH    6
+
+#ifdef __OLD_INTERRUPT_CODE	/* XXX XXX XXX */
+
 #include <machine/irqhandler.h>
 #include <arm/arm32/psl.h>
 
-#endif	/* _HPCARM_INTR_H */
+#else	/* !__OLD_INTERRUPT_CODE */
+
+#define	__NEWINTR	/* enables new hooks in cpu_fork()/cpu_switch() */
+
+#ifndef _LOCORE
+
+#include <sys/device.h>
+#include <sys/queue.h>
+
+#if defined(_LKM)
+
+int	_splraise(int);
+int	_spllower(int);
+void	splx(int);
+void	_setsoftintr(int);
+
+#else	/* _LKM */
+
+#include "opt_arm_intr_impl.h"
+
+#if defined(ARM_INTR_IMPL)
+
+/*
+ * Each board needs to define the following functions:
+ *
+ * int	_splraise(int);
+ * int	_spllower(int);
+ * void	splx(int);
+ * void	_setsoftintr(int);
+ *
+ * These may be defined as functions, static inline functions, or macros,
+ * but there must be a _spllower() and splx() defined as functions callable
+ * from assembly language (for cpu_switch()).  However, since it's quite
+ * useful to be able to inline splx(), you could do something like the
+ * following:
+ *
+ * in <boardtype>_intr.h:
+ * 	static inline int
+ *	boardtype_splx(int spl)
+ *	{...}
+ *
+ *	#define splx(nspl)	boardtype_splx(nspl)
+ *	...
+ * and in boardtype's machdep code:
+ *
+ *	...
+ *	#undef splx
+ *	int
+ *	splx(int spl)
+ *	{
+ *		return boardtype_splx(spl);
+ *	}
+ */
+
+#include ARM_INTR_IMPL
+
+#else /* ARM_INTR_IMPL */
+
+#error ARM_INTR_IMPL not defined.
+
+#endif	/* ARM_INTR_IMPL */
+
+#endif /* _LKM */
+
+#define	splsoft()	_splraise(IPL_SOFT)
+
+typedef uint8_t ipl_t;
+typedef struct {
+	ipl_t _ipl;
+} ipl_cookie_t;
+
+static inline ipl_cookie_t
+makeiplcookie(ipl_t ipl)
+{
+
+	return (ipl_cookie_t){._ipl = ipl};
+}
+
+static inline int
+splraiseipl(ipl_cookie_t icookie)
+{
+
+	return _splraise(icookie._ipl);
+}
+
+#define	spl0()		_spllower(IPL_NONE)
+
+#include <sys/spl.h>
+
+#endif /* ! _LOCORE */
+
+#endif /* __OLD_INTERRUPT_CODE */
+
+#endif /* _KERNEL */
+
+#endif /* _HPCARM_INTR_H */
diff --exclude=CVS --exclude='obj.*' --exclude=compile --exclude='*.user' -uNr src.orig/sys/dev/hpc/hpckbdkeymap.h src/sys/dev/hpc/hpckbdkeymap.h
--- src.orig/sys/dev/hpc/hpckbdkeymap.h	2008-04-29 11:40:15.000000000 +0900
+++ src/sys/dev/hpc/hpckbdkeymap.h	2008-04-29 11:49:09.000000000 +0900
@@ -831,6 +831,75 @@
 	[KEY_SPECIAL_OFF]	= 127,
 	[KEY_SPECIAL_LIGHT]	= -1
 };
+
+/*
+ * Sharp W-ZERO3 WS003SH
+ */
+/*
+ * WS003SH keyscan map
+	CTRL	(none)	TAB	(none)	CALL	MAIL	IE
+	1	2	q	w	a	z	MOJI
+	3	4	e	s	d	x	(none)
+	5	r	t	f	c	-	OK
+	6	y	g	v	b	SPACE	ACTION
+	7	8	u	h	n	/	,
+	9	i	j	m	.	(none)	LEFT
+	0	o	k	l	(none)	UP	DOWN
+	BS	p	(none)	(none)	ENTER	(none)	RIGHT
+	(none)	(none)	(none)	(none)	(none)	(none)	(none)
+	ROTATE	VOL-	(none)	SHIFT	WIN	LSOFT	RSOFT
+	CAMERA	VOL+	(none)	(none)	(none)	FN	(none)
+*/
+/* Japanese */
+const uint8_t ws003sh_jp_keytrans[] = {
+/*	row#0,	row#1,	row#2,	row#3,	row#4,	row#5,	row#6	*/
+/*00*/	29,	UNK,	15,	UNK,	IGN,	IGN,	IGN,
+/*01*/	2,	3,	16,	17,	30,	44,	1,
+/*02*/	4,	5,	18,	31,	32,	45,	UNK,
+/*03*/	6,	19,	20,	33,	46,	12,	28,
+/*04*/	7,	21,	34,	47,	48,	57,	28,
+/*05*/	8,	9,	22,	35,	49,	53,	51,
+/*06*/	10,	23,	36,	50,	52,	UNK,	203,
+/*07*/	11,	24,	37,	38,	UNK,	200,	208,
+/*08*/	14,	25,	UNK,	UNK,	28,	UNK,	205,
+/*09*/	UNK,	UNK,	UNK,	UNK,	UNK,	UNK,	UNK,
+/*10*/	IGN,	174,	UNK,	42,	IGN,	IGN,	IGN,
+/*11*/	IGN,	176,	UNK,	UNK,	UNK,	184,	SPL,
+};
+
+const int ws003sh_special_keymap[] = {
+	[KEY_SPECIAL_OFF]	= 83,
+	[KEY_SPECIAL_LIGHT]	= -1
+};
+
+static const keysym_t ws003sh_jp_keydesc[] = {
+/*  pos		normal		shifted		altgr	*/
+    KC(4),	KS_3,		KS_numbersign,	KS_Cmd_BrightnessDown,
+    KC(5),	KS_4,		KS_dollar,	KS_Cmd_BrightnessUp,
+    KC(8),	KS_7,		KS_apostrophe,	KS_grave,
+    KC(9),	KS_8,		KS_parenleft,	KS_braceleft,
+    KC(10),	KS_9,		KS_parenright,	KS_braceright,
+    KC(12),	KS_minus,	KS_equal,	KS_backslash,
+    KC(14),	KS_Delete,	KS_Delete,	KS_BackSpace,
+    KC(15),	KS_Tab,		KS_Tab,		KS_Escape,
+    KC(17),	KS_w,		KS_W,		KS_asciicircum,
+    KC(18),	KS_e,		KS_E,		KS_asciitilde,
+    KC(19),	KS_r,		KS_R,		KS_bar,
+    KC(22),	KS_u,		KS_U,		KS_bracketleft,
+    KC(23),	KS_i,		KS_I,		KS_bracketright,
+    KC(24),	KS_o,		KS_O,		KS_underscore,
+    KC(25),	KS_p,		KS_P,		KS_at,
+    KC(37),	KS_k,		KS_K,		KS_plus,
+    KC(38),	KS_l,		KS_L,		KS_asterisk,
+    KC(42),	KS_Shift_L,	KS_Shift_L,	KS_Shift_Lock,
+    KC(51),	KS_comma,	KS_semicolon,	KS_less,
+    KC(52),	KS_period,	KS_colon,	KS_greater,
+    KC(184),	KS_Mode_switch,	KS_Multi_key,
+    KC(200),	KS_Up,		KS_Up,		KS_Prior,
+    KC(203),	KS_Left,	KS_Left,	KS_Home,
+    KC(205),	KS_Right,	KS_Right,	KS_End,
+    KC(208),	KS_Down,	KS_Down,	KS_Next,
+};
 #endif /* hpcarm */
 
 #if defined(hpcarm) || defined(hpcsh)
@@ -1227,6 +1296,9 @@
 
 #endif /* hpcsh */
 #ifdef hpcarm
+	/*
+	 * HP Jornada 710/720/728
+	 */
 	/* US (ABA), UK (ABU) */
 	{	&platid_mask_MACH_HP_JORNADA_720,
 		jornada7xx_us_keytrans,
@@ -1269,6 +1341,19 @@
 		jornada7xx_special_keymap,
 		CMDMAP(jornada_es_keydesc),
 		KB_ES },
+	/*
+	 * Sharp W-ZERO3 WS003SH
+	 */
+	{	&platid_mask_MACH_SHARP_WZERO3_WS003SH,
+		ws003sh_jp_keytrans,
+		ws003sh_special_keymap,
+		CMDMAP(ws003sh_jp_keydesc),
+		KB_JP },
+	{	&platid_mask_MACH_SHARP_WZERO3_WS004SH,
+		ws003sh_jp_keytrans,
+		ws003sh_special_keymap,
+		CMDMAP(ws003sh_jp_keydesc),
+		KB_JP },
 #endif /* hpcarm */
 
 	{ .ht_platform = NULL } /* end mark */
