Subject: Re: iBook Powermanagement status query
To: Michael Lorenz <macallan@netbsd.org>
From: Cherry G. Mathew <cherry.g.mathew@gmail.com>
List: port-macppc
Date: 03/30/2006 01:16:50
------=_Part_4916_18689592.1143661610163
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 3/7/06, Cherry G. Mathew <cherry.g.mathew@gmail.com> wrote:

> Great, thanks! I could at least report what I see, and it could be a star=
t.

So the current deal on my iBook is:

- No Sound ( applications are happy, but there's not even a pin drop! )
- Repeated tapping of the Brightness keys resets the machine.

I've attached the results of the power-hooks.

Doesn't look like I'll be sleeping my iBook anytime soon :-(

I may try to add some sleep code when I'm bored over the next ... heh :-)

--
~Cherry

------=_Part_4916_18689592.1143661610163
Content-Type: application/octet-stream; name=OFW
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="OFW"

dev /
.properties
model PowerBook 4,3
compatible	PowerBook4,3
		MacRISC2
		MacRISC

dev mac-io
.properties
model		AAPL, KeyLargo
compatible	KeyLargo

dev via-pmu
.properties
compatible	pmu

dev power-mgt
.properties

name		power-mgt
compatible	via-pmu-2000
		via-pmu-99




------=_Part_4916_18689592.1143661610163
Content-Type: application/octet-stream; name=dmesg
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="dmesg"

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 3.99.17 (IBOOK) #1: Mon Mar 27 23:54:42 IST 2006
	cherry@:/home/cherry/Workspace/obj/sys/arch/macppc/compile/IBOOK
total memory = 640 MB
avail memory = 609 MB
mainbus0 (root)
cpu0 at mainbus0: 750FX (Revision 2.3), ID 0 (primary)
cpu0: HID0 8092c0a4<EMCP,DOZE,DPM,res,ICE,DCE,SGE,BTIC,BHT>
cpu0: 800.00 MHz, 512KB WB L2 cache
uni_n0 at mainbus0 address 0xf8000000
ki2c0 at uni_n0 address 0xf8001000
iic0 at ki2c0: I2C bus
adm1030c0 at ki2c0 ADM1030 thermal monitor and fan controller
cereal at ki2c0 address 0x1c0 not configured
uninorth0 at mainbus0
pci0 at uninorth0 bus 0
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 11 function 0
pchb0: Apple Computer Pangea AGP Interface (rev. 0x00)
ofb0 at pci0 dev 16 function 0: ATI Technologies Radeon Mobility M7 LW (AGP)
ofb0: 1024 x 768, 8bpp
wsdisplay0 at ofb0 kbdmux 1: console (std, vt100 emulation)
wsmux1: connecting to wsdisplay0
uninorth1 at mainbus0
pci1 at uninorth1 bus 0
pci1: i/o space, memory space enabled
pchb1 at pci1 dev 11 function 0
pchb1: Apple Computer Pangea Host-PCI Bridge (rev. 0x00)
obio0 at pci1 dev 23 function 0: addr 0x80000000
zsc0 at obio0 offset 0x13000: irq 22,23
zstty0 at zsc0 channel 0
zstty1 at zsc0 channel 1
snapper0 at obio0 offset 0x10000: irq 30,1,2
adb0 at obio0 offset 0x16000 irq 47: 3 targets
aed0 at adb0 addr 0: ADB Event device
akbd0 at adb0 addr 2: PowerBook G3 keyboard
wskbd0 at akbd0: console keyboard, using wsdisplay0
ams0 at adb0 addr 3: EMP trackpad <tpad> 2-button, 400 dpi
wsmouse0 at ams0 mux 0
abtn0 at adb0 addr 7: buttons
apm0 at adb0: battery flags 0x5, 94% charged
battery at obio0 offset 0x0 not configured
backlight at obio0 offset 0xf300 not configured
ki2c1 at obio0
iic1 at ki2c1: I2C bus
cereal at ki2c1 address 0x1c0 not configured
deq0 at ki2c1 Apple Digital Equalizer, addr 6a
wdc0 at obio0 offset 0x1f000 irq 19: DMA transfer
atabus0 at wdc0 channel 0
ohci0 at pci1 dev 24 function 0: Apple Computer Pangea USB Controller (rev. 0x00)
ohci0: interrupting at irq 27
ohci0: OHCI version 1.0
usb0 at ohci0: USB revision 1.0
uhub0 at usb0
uhub0: Apple Computer OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
ohci1 at pci1 dev 25 function 0: Apple Computer Pangea USB Controller (rev. 0x00)
ohci1: interrupting at irq 28
ohci1: OHCI version 1.0
usb1 at ohci1: USB revision 1.0
uhub1 at usb1
uhub1: Apple Computer OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uninorth2 at mainbus0
pci2 at uninorth2 bus 0
pci2: i/o space, memory space enabled
pchb2 at pci2 dev 11 function 0
pchb2: Apple Computer Pangea Host-PCI Bridge (rev. 0x00)
fwohci0 at pci2 dev 14 function 0: Apple Computer Pangea Firewire (rev. 0x00)
fwohci0: interrupting at irq 40
fwohci0: OHCI version 1.0 (ROM=0)
fwohci0: No. of Isochronous channels is 8.
fwohci0: EUI64 00:0a:95:ff:fe:eb:ca:ee
fwohci0: Phy 1394a available S400, 1 ports.
fwohci0: Link S400, max_rec 2048 bytes.
ieee1394if0 at fwohci0: IEEE1394 bus
fwip0 at ieee1394if0: IP over IEEE1394
fwohci0: Initiate bus reset
gem0 at pci2 dev 15 function 0: Apple Computer GMAC Ethernet (rev. 0x00)
gem0: interrupting at irq 41
gem0: Ethernet address 00:0a:95:eb:ca:ee, 10KB RX fifo, 4KB TX fifo
bmtphy0 at gem0 phy 0: BCM5221 10/100 media interface, rev. 4
bmtphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fwohci0: node_id=0xc800ffc0, gen=2, CYCLEMASTER mode
ieee1394if0: 1 nodes, maxhop <= 0, cable IRM = 0 (me)
ieee1394if0: bus manager 0 (me)
audio0 at snapper0: full duplex
raidattach: Asked for 8 units
Kernelized RAIDframe activated
atapibus0 at atabus0: 2 targets
cd0 at atapibus0 drive 1: <SONY CD-RW/DVD-ROM CRX820E, , 3.3c> cdrom removable
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
wd0 at atabus0 drive 0: <TOSHIBA MK3021GAS>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 28615 MB, 58140 cyl, 16 head, 63 sec, 512 bytes/sect x 58605120 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
ata4 conf[0] = 0xc519465, cyc = 2 (30 ns), act = 6 (90 ns), inact = 3
ata4 conf[1] = 0x10919465, cyc = 4 (60 ns), act = 8 (120 ns), inact = 3
wd0(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4 (Ultra/66) (using DMA)
cd0(wdc0:0:1): using PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33) (using DMA)
ugen0 at uhub1 port 2
ugen0: HCF USB V.90 Data/Fax Modem Apple internal modem, rev 1.10/1.00, addr 2
Searching for RAID components...
boot device: wd0
root on wd0a dumps on wd0b
mountroot: trying lfs...
mountroot: trying ffs...
root file system type: ffs
init: copying out path `/sbin/init' 11
gem0: link state changed to DOWN
gem0: link state changed to UP
ffs_snapshot_mount: non-snapshot inode 16384
ffs_snapshot_mount: non-snapshot inode 64
abtn0: eject not implemented
abtn0: volume setting not implemented
abtn0: volume setting not implemented
abtn0: volume setting not implemented
Resuming from suspend. 
atabus0: resuming...
fwohci0: Phy 1394a available S400, 1 ports.
fwohci0: Link S400, max_rec 2048 bytes.
fwohci0: resume iso receive ch: 0
fwohci0: Initiate bus reset
fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=3, CYCLEMASTER mode
ieee1394if0: 1 nodes, maxhop <= 0, cable IRM = 0 (me)
ieee1394if0: bus manager 0 (me)




------=_Part_4916_18689592.1143661610163
Content-Type: application/octet-stream; name=apm.c.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="apm.c.diff"

Warning: Permanently added the RSA host key for IP address '204.152.190.16' to the list of known hosts.
Index: apm.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/apm.c,v
retrieving revision 1.15
diff -c -r1.15 apm.c
*** apm.c	11 Dec 2005 12:18:03 -0000	1.15
--- apm.c	29 Mar 2006 19:34:43 -0000
***************
*** 87,92 ****
--- 87,93 ----
  	int    sc_flags;
  	int	event_count;
  	int	event_ptr;
+ 	int	sc_power_state;
  	struct lock sc_lock;
  	struct	apm_event_info event_list[APM_NEVENTS];
  };
***************
*** 107,114 ****
--- 108,119 ----
  #define APM_UNLOCK(apmsc)
  #endif
  
+ static int apm_spl;		/* saved spl while suspended */
+ 
  int apmmatch(struct device *, struct cfdata *, void *);
  void apmattach(struct device *, struct device *, void *);
+ static void	apm_standby(struct apm_softc *);
+ static void	apm_resume(struct apm_softc *);
  
  #ifdef __NetBSD__
  #if 0
***************
*** 199,204 ****
--- 204,212 ----
  	sc->event_ptr = 0;
  	sc->event_count = 0;
  	lockinit(&sc->sc_lock, PWAIT, "apmlk", 0, 0);
+ 
+ 	/* Initial state is `resumed'. */
+ 	sc->sc_power_state = PWR_RESUME;
  }
  
  int
***************
*** 301,306 ****
--- 309,317 ----
  	case APM_IOC_SUSPEND:
  		if ((flag & FWRITE) == 0)
  			error = EBADF;			
+ 
+ 		apm_standby(sc);
+ 
  		break;
  	case APM_IOC_PRN_CTL:
  		if ((flag & FWRITE) == 0)
***************
*** 475,477 ****
--- 486,543 ----
  
  	return (0);
  }
+ 
+ static void
+ apm_standby(sc)
+ 	struct apm_softc *sc;
+ {
+ 
+ 	if (sc->sc_power_state == PWR_STANDBY) {
+ #ifdef APMDEBUG
+ 		printf("%s: apm_standby: already standing by?\n",
+ 		    sc->sc_dev.dv_xname);
+ #endif
+ 		return;
+ 	}
+ 	sc->sc_power_state = PWR_STANDBY;
+ 
+ 	dopowerhooks(PWR_SOFTSTANDBY);
+ 
+ 	apm_spl = splhigh();
+ 
+ 	dopowerhooks(PWR_STANDBY);
+ 
+ 	printf("Resuming from suspend. \n");
+ 
+ 	apm_resume(sc);
+ }
+ 
+ 
+ static void
+ apm_resume(sc)
+ 	struct apm_softc *sc;
+ {
+ 
+ 	if (sc->sc_power_state == PWR_RESUME) {
+ #ifdef APMDEBUG
+ 		printf("%s: apm_resume: already running?\n",
+ 		    sc->sc_dev.dv_xname);
+ #endif
+ 		return;
+ 	}
+ 	sc->sc_power_state = PWR_RESUME;
+ 
+ 	/*
+ 	 * Resync system time.
+ 	 */
+ 
+ 	inittodr(time.tv_sec);
+ 
+ 	dopowerhooks(PWR_RESUME);
+ 
+ 	splx(apm_spl);
+ 
+ 	dopowerhooks(PWR_SOFTRESUME);
+ 
+ }
+ 




------=_Part_4916_18689592.1143661610163--