Subject: iBook G4 keyboard fixed
To: None <port-macppc@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: port-macppc
Date: 06/21/2004 00:45:07
Hi

I committed two patches that fix the iBook G4 missing keyboard problem.
I
beleive it fixes the same problem on iMac G4 (anyone can try?).

The patches are probably harmless for other machines, but let me know if
something got broken with either interrupt handling or console keyboard.

While I was looking for fixes in FreeBSD and OpenBSD CVS, I found two
bugfixes
in code that they got from us, but I don't know if this is revelant to
our tree
or not. I did not committed them, but they might be useful, I don't
know. Could
someone with good understanding of the code review that?

This is from OpenBSD. It is a delay related problem when talking with
the PMU.
Index: arch/macppc/dev/pm_direct.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/pm_direct.c,v
retrieving revision 1.20
diff -r1.20 pm_direct.c
1020c1020
<       delay(10000);
---
>       delay(1000);
1028c1028
<       timo = 0x80000;
---
>       timo = 0x8000;
1030c1030
<               if (read_via_reg(VIA1, vIFR) & 0x14)
---
>               if (read_via_reg(VIA1, vIFR) != 0)
1054a1055
>                       delay(10);


This is from FreeBSD. It deals with a wrong way of reading OF
properties. 
Index: arch/macppc/pci/pci_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/pci/pci_machdep.c,v
retrieving revision 1.25
diff -r1.25 pci_machdep.c
297c297
<       pcireg_t csr, intr;
---
>       pcireg_t csr, intr, npintr, paddr[4];
360a361
> #if 0
365c366,373
<                       len = find_node_intr(node, &iaddr.phys_hi,
irqs);
---      
> #endif 
>                       npintr = 0;
>                       OF_getprop(node, "interrupts", &npintr, 4);
>                       paddr[0] = addr[0].phys_hi;
>                       paddr[1] = 0;
>                       paddr[2] = 0;
>                       paddr[3] = npintr;
>                       len = find_node_intr(node, paddr, irqs);
484d491
< #if 0
494d500
< #endif
497,503d502
< #if 0
<       /* XXX This may be wrong... */
<       len = OF_getprop(node, "interrupts", intr, 4) ;
<       if (len == 4)
<               return len;
< #endif
<
-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@netbsd.org