Subject: Clio Patches...
To: None <port-hpcmips@netbsd.org>
From: Matthew Orgass <darkstar@city-net.com>
List: port-hpcmips
Date: 03/25/2006 22:04:36
On 2006-03-26 tsutsui@ceres.dti.ne.jp wrote:

> >   Thanks for your recent PR commits.  Would you be willing to commit the
> > diff at: http://www.city-net.com/~darkstar/netbsd/hpcmips2.diff
>
> Well, could you please split this patch for each fix?
> "Fixing all in one jumbo patch" might cause some future
> problem (makes it harder to pullup or back out, etc.)
> and people might hesitate investigate/integrate such one.

  The individual patches are at (also attached below):
http://www.city-net.com/~darkstar/netbsd/clio-kernel.diff
http://www.city-net.com/~darkstar/netbsd/clio-keymap.diff
http://www.city-net.com/~darkstar/netbsd/delay.diff
http://www.city-net.com/~darkstar/netbsd/dbsym.diff

> >   This will make the Clio C-1050 work without pbsdboot changes (and still
> > work on the C-1000; this would close port-hpcmips/28228, although I see I
> > never got that patch listed in the PR),
>
> I'm not sure which part of the diff affects this, but
> are you sure that it won't break existing SHARP_TRIPAD support?
> How did you make this changes?

  This is the clio-kernel.diff that changes isaportoffset to zero.  I
think the current value was copied from other machines that need it and it
works on the C-1000 presumably due to limited address lines being used. My
understanding is that the tripad hardware layout is identical to the
C-1000 internally, however I don't have one.

  The patchs in the PR also change pbsdboot and hpcboot to use the
correct id for the 1050 (currently all use the tripad) and only applied
the change to the C-1050 since I didn't notice until later that it worked
on the C-1000 also.  But this means that pbsdboot and hpcboot must be
updated.

Index: sys/arch/hpcmips/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/conf/GENERIC,v
retrieving revision 1.165.2.5
diff -u -p -r1.165.2.5 GENERIC
--- sys/arch/hpcmips/conf/GENERIC	14 Aug 2005 21:13:54 -0000	1.165.2.5
+++ sys/arch/hpcmips/conf/GENERIC	25 Feb 2006 07:14:17 -0000
@@ -323,8 +325,8 @@ pcic0	at isa2 port 0x3e0 iomem 0x70000 i
 #
 # Vadem Clio and Sharp Tripad
 #
-vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x1000000
-vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x1000000
+vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x0
+vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x0
 isa3	at vrisab3
 pcic0	at isa3 port 0x3e0 iomem 0x70000 iosiz 0x4000 irq 0x000d0003

Index: sys/arch/hpcmips/conf/MPC303
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/conf/MPC303,v
retrieving revision 1.33.4.1
diff -u -p -r1.33.4.1 MPC303
--- sys/arch/hpcmips/conf/MPC303	18 Jul 2005 21:13:43 -0000	1.33.4.1
+++ sys/arch/hpcmips/conf/MPC303	25 Feb 2006 07:14:20 -0000
@@ -376,8 +376,8 @@ pcic0	at isa2 port 0x3e0 iomem 0x70000 i
 #
 # Vadem Clio and Sharp Tripad
 #
-vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x1000000
-vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x1000000
+vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x0
+vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x0
 isa3	at vrisab3
 pcic0	at isa3 port 0x3e0 iomem 0x70000 iosiz 0x4000 irq 0x000d0003

Index: sys/arch/hpcmips/conf/VR41XX
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/conf/VR41XX,v
retrieving revision 1.24.4.2
diff -u -p -r1.24.4.2 VR41XX
--- sys/arch/hpcmips/conf/VR41XX	18 Jul 2005 21:14:39 -0000	1.24.4.2
+++ sys/arch/hpcmips/conf/VR41XX	25 Feb 2006 07:14:20 -0000
@@ -306,8 +306,8 @@ pcic0	at isa2 port 0x3e0 iomem 0x70000 i
 #
 # Vadem Clio and Sharp Tripad
 #
-vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x1000000
-vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x1000000
+vrisab3	at vrgiu? platform SHARP_TRIPAD isaportoffset 0x0
+vrisab3	at vrgiu? platform VADEM_CLIO_C isaportoffset 0x0
 isa3	at vrisab3
 pcic0	at isa3 port 0x3e0 iomem 0x70000 iosiz 0x4000 irq 0x000d0003


> > allows use of dbsym,
>
> I'm not familiar with hpcmips, but doesn't pbsdboot load
> symbol table? If so, shouldn't we check if bootinfo is
> processed properly first rather than just using dbsym(8)?

  It doesn't work.  I don't have any way of building pbsdboot so I didn't
look at why.  I sent port-hpcmips/26426 about this and included this patch
as a workaround.  The patch uses the loaded symbols if present (if
pbsdboot is set to load symbols then dbsym will not work and the symbol
loading does not work either).  I didn't change anything to run dbsym by
default, just to allow it to be used.

Index: sys/arch/hpcmips/hpcmips/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/hpcmips/machdep.c,v
retrieving revision 1.86
diff -u -p -r1.86 machdep.c
--- sys/arch/hpcmips/hpcmips/machdep.c	13 Feb 2004 11:36:13 -0000	1.86
+++ sys/arch/hpcmips/hpcmips/machdep.c	25 Feb 2006 07:14:21 -0000
@@ -452,6 +452,8 @@ mach_init(int argc, char *argv[], struct
 	/* init symbols if present */
 	if (esym)
 		ksyms_init(symbolsz, &end, esym);
+	else /* try symbols via dbsym */
+		ksyms_init(0, NULL, NULL);
 #endif /* DDB */
 	/*
 	 * Alloc u pages for lwp0 stealing KSEG0 memory.

> > fixes delay
> > time on the VR4111,
>
> Do you have any article, errata or measurement for us
> to confirm this?

  I noticed it with cycle counter tests of delay time while working on my
updated slhci driver, but I don't know any Nec documentation mentioning
the correction.  Later VR series CPUs all are documented to have two clock
branch delays.  Earlier VR series CPUs had a single clock delay, so I
would guess it was just overlooked in creating the 4111 manual.  I don't
care much about this one, though, since my C-1000's display is almost
dead anyway.

Index: sys/arch/hpcmips/vr/bcu_vrip.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/vr/bcu_vrip.c,v
retrieving revision 1.25
diff -u -p -r1.25 bcu_vrip.c
--- sys/arch/hpcmips/vr/bcu_vrip.c	13 Feb 2004 11:36:13 -0000	1.25
+++ sys/arch/hpcmips/vr/bcu_vrip.c	25 Feb 2006 07:14:23 -0000
@@ -442,8 +442,9 @@ vrbcu_vrip_getcpuclock(void)
 		break;
 	case BCUREVID_RID_4111:
 		cpuclock = CLKX / clksp * 64;
-		/* branch delay is 1 clock; 2 clock/loop */
-		cpuspeed = (cpuclock / 2 + MHZ / 2) / MHZ;
+		/* branch delay is 2 clock; 3 clock/loop */
+		/* manual incorrectly says 1 clock delay */
+		cpuspeed = (cpuclock / 3 + MHZ / 2) / MHZ;
 		break;
 	case BCUREVID_RID_4121:
 		cpuclock = CLKX / clksp * 64;

> > and improves Clio keymaps (would close
> > port-hpcmips/28383).
>
> Hmm, maybe this is harmless for other machines,
> but still I'd like to see separate patch for this.

  Done.

Index: sys/dev/hpc/hpckbdkeymap.h
===================================================================
RCS file: /cvsroot/src/sys/dev/hpc/hpckbdkeymap.h,v
retrieving revision 1.34.6.2
diff -u -p -r1.34.6.2 hpckbdkeymap.h
--- sys/dev/hpc/hpckbdkeymap.h	4 Aug 2005 18:31:25 -0000	1.34.6.2
+++ sys/dev/hpc/hpckbdkeymap.h	25 Feb 2006 07:14:34 -0000
@@ -255,7 +255,7 @@ static uint8_t tripad_keytrans[] = {
 /*10*/	 56,	 57,	 46,	 47,	 32,	 33,	 19,	  4,
 /*18*/	 48,	 49,	 34,	 35,	 20,	 21,	  5,	  6,
 /*20*/	 50,	 51,	 36,	 37,	 22,	 23,	  7,	  8,
-/*28*/	105,	 58,	 38,	 24,	 25,	  9,	 10,	 11,
+/*28*/	184,	 58,	 38,	 24,	 25,	  9,	 10,	 11,
 /*30*/	 26,	 27,	203,	 52,	 53,	 39,	 12,	 13,
 /*38*/	 54,	205,	200,	208,	 40,	 28,	 43,	 14,
 /*40*/	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,
@@ -264,6 +264,32 @@ static uint8_t tripad_keytrans[] = {
 /*58*/	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,	IGN,
 };

+static const keysym_t tripad_cmdmap[] = {
+/*  pos      command		normal		shifted		fn    */
+KC(2),	 KS_Cmd_Screen0,	KS_1,		KS_exclam,	KS_f1,
+KC(3),	 KS_Cmd_Screen1,	KS_2,		KS_at,		KS_f2,
+KC(4),	 KS_Cmd_Screen2,	KS_3,		KS_numbersign,	KS_f3,
+KC(5),	 KS_Cmd_Screen3,	KS_4,		KS_dollar,	KS_f4,
+KC(6),	 KS_Cmd_Screen4,	KS_5,		KS_percent,	KS_f5,
+KC(7),	 KS_Cmd_Screen5,	KS_6,		KS_asciicircum,	KS_f6,
+KC(8),	 KS_Cmd_Screen6,	KS_7,		KS_ampersand,	KS_f7,
+KC(9),	 KS_Cmd_Screen7,	KS_8,		KS_asterisk,	KS_f8,
+KC(10),  KS_Cmd_Screen8,	KS_9,		KS_parenleft,	KS_f9,
+KC(11),  KS_Cmd_Screen9,	KS_0,		KS_parenright,	KS_f10,
+KC(12),  KS_Cmd_BrightnessDown,	KS_minus,	KS_underscore,	KS_f11,
+KC(13),  KS_Cmd_BrightnessUp,	KS_equal,	KS_plus,	KS_f12,
+KC(20),  KS_Cmd_BacklightToggle, KS_t,
+KC(33),  KS_Cmd_BacklightOff,	KS_f,
+KC(49),  KS_Cmd_BacklightOn,	KS_n,
+KC(51),  KS_Cmd_ContrastDown,	KS_comma,	KS_less,
+KC(52),  KS_Cmd_ContrastUp,	KS_period,	KS_greater,
+KC(184), KS_Mode_switch,	KS_Multi_key,
+KC(200), KS_Cmd_ScrollSlowUp,	KS_Up,		KS_Up,		KS_Prior,
+KC(203), KS_Cmd_ScrollFastUp,	KS_Left,	KS_Left,	KS_Home,
+KC(205), KS_Cmd_ScrollFastDown,	KS_Right,	KS_Right,	KS_End,
+KC(208), KS_Cmd_ScrollSlowDown,	KS_Down,	KS_Down,	KS_Next,
+};
+
 /* NEC Mobile Gear MCCS series */
 static uint8_t mccs_keytrans[] = {
 /*00	caps	cr	rar	p	.	y	b	z	*/
@@ -977,12 +1003,12 @@ const struct hpckbd_keymap_table {
 	{	&platid_mask_MACH_SHARP_TRIPAD,
 		tripad_keytrans,
 		NULL,
-		NULLCMDMAP,
+		CMDMAP(tripad_cmdmap),
 		KB_US },
 	{	&platid_mask_MACH_VADEM_CLIO_C,
 		tripad_keytrans,
 		NULL,
-		NULLCMDMAP,
+		CMDMAP(tripad_cmdmap),
 		KB_US },
 	{	&platid_mask_MACH_NEC_MCCS,
 		mccs_keytrans,

> >  Currently the C-1050 does not work without building
> > a new kernel.  I can verify everything in the next day or two from clean
> > sources if you commit it.
>
> Well, I may be able to fix mips generic one, but
> I'll subscribe port-hpcmips, so please post diffs
> for individual problems to the list again.
> (though I'm afraid currently hpcmips guys aren't so active. sorry)

Matthew Orgass
darkstar@city-net.com