Subject: Re: newer G4 models and panic: lockmgr: pid 0, not exclusive lock holder
To: None <port-macppc@netbsd.org>
From: Makoto Fujiwara <makoto@ki.nu>
List: port-macppc
Date: 07/05/2002 10:41:12
PPC 7450 issue: (model here is G4/800MP)

Aymeric> It has the same problems you describe. "my personal workaround" for
Aymeric> that is to attach the ADB keyboard unconditionnally in
Aymeric> macppc/machdep.c:cninit_kd().

Thanks for information, Aymeric, yeah, I have the same situation. 

(1) -current (seems to be 20020702 version, kern/kern_proc.c is still with 1.47)
...
 start=0x1000000
trap: kernel read DSI @ 0x6db6db71 by 0x31a7d8 (DSISR 0x40000000, err=14)
Press a key to panic.
panic: trap
Stopped in pid 0 () at 0x30df64:    lwz r0, r1, 0x14
db> (not able to type in)

method <`usb-kbd-ihandles> not found; ihandle=ffbc8740 phandle=ff931210 _
------
0031a6a0 <cninit_kd>:
...
  31a7a0:       48 06 61 39     bl      3808d8 <akbd_cnattach>
  31a7a4:       48 00 01 20     b       31a8c4 <cninit_kd+0x224>
  31a7a8:       3c 60 00 3f     lis     r3,63
  31a7ac:       80 81 00 18     lwz     r4,24(r1)
  31a7b0:       38 63 7c 04     addi    r3,r3,31748
  31a7b4:       38 a0 00 00     li      r5,0
  31a7b8:       38 c0 00 01     li      r6,1
  31a7bc:       38 e1 00 1c     addi    r7,r1,28
  31a7c0:       4b ff a5 99     bl      314d58 <OF_call_method>
  31a7c4:       2c 03 ff ff     cmpwi   r3,-1
  31a7c8:       41 82 00 3c     beq     31a804 <cninit_kd+0x164>
  31a7cc:       80 61 00 1c     lwz     r3,28(r1)
  31a7d0:       2c 03 00 00     cmpwi   r3,0
  31a7d4:       41 82 00 30     beq     31a804 <cninit_kd+0x164>
> 31a7d8:       80 63 00 04     lwz     r3,4(r3)
  31a7dc:       2c 03 00 00     cmpwi   r3,0
  31a7e0:       41 82 00 24     beq     31a804 <cninit_kd+0x164>
  31a7e4:       4b ff a1 75     bl      314958 <OF_instance_to_package>
------
where it maps in
sys/arch/macppc/macppc/machdep.c
------
    981 #if NUKBD > 0
    982         if (OF_call_method("`usb-kbd-ihandles", stdin, 0, 1, &ukbds) != -1 &&
    983             ukbds != NULL && ukbds->ihandle != 0 &&
    984             OF_instance_to_package(ukbds->ihandle) != -1) {
    985                 printf("console keyboard type: USB\n");
------
'ukbds->ihandle'  reference in line  983 is suspicious, isn't it ?

(2) with patch applied.

It works, but freeze shortly with random timing, I belive.

# I needed to change int_types.h, don't know why anyway..

--- sys/arch/powerpc/include/int_types.h-1.5	Sun Apr 29 00:41:32 2001
+++ sys/arch/powerpc/include/int_types.h	Fri Jul  5 08:45:38 2002
@@ -40,7 +40,7 @@
 
 /* 7.18.1.1 Exact-width integer types */
 
-typedef	__signed char		 __int8_t;
+typedef	signed char		 __int8_t;
 typedef	unsigned char		__uint8_t;
 typedef	short int		__int16_t;
 typedef	unsigned short int     __uint16_t;

---
Makoto Fujiwara, 
Chiba, Japan, Narita Airport and Disneyland prefecture.