Dear Sally,

I am running 4.2-stable on a Dell Latitude LS (dmesg bellow) with the
BIOS upgraded to A09 (the latest available). It also dual-boots FreeBSD;
I would like to get rid of that, and what stops me is power management
support. I want to scale CPU frequency according to the load, I want
some intelligent FAN control, I want my battery to last.

Starting from the beginning, I _disabled_ both apm and acpi
during boot (-c). That way, the machine boots into a state when

(1) /dev/apm, /dev/apmctl, and /dev/acpi do exist
    (which doesn't really worry me, I guess I need
    to understand how /dev/ really works)

(2) apm(8) will run, reporting the status of battery and AC adapter
    as unknown (without parameters), and will complain about apmd
    not running when run with parameters (indeed, apmd is not running).

(3) apmd _will_ start (manually), which confuses me a bit. Shouldn't it
    refuse, when apm is not even enabled on the running kernel? (It will even
    hapilly start twice.) Looking at the source, the starting routine
    only checks if it can open(fname) which is /dev/apmctl which _is_
    there.

(4) When apmd is started without -m, it tries to disable the power state
    messages issued by the APM driver (which is not there); so apmd says
    "can't disable driver messages, error: Bad file descriptor". But it
    will run anyway. Looking at the source, only when trying to -m 
    (!messages) it finds out that the ioctl on the ctl_fd didn't work.

(5) After I start apmd (or two) manually, apm will run the commands that
    need to communicate with apmd; apm -A will make apmd say "setting
    hw.setperf automatically", only to realize "cannot read hw.setperf"
    a moment later - there is no hw.setperf

(6) apm -S|-z will say "system will enter "stanby|suspend mode
    momentarilly", but nothing will happen.

As APM is not in the running kernel, I don't excpect APM to work. But
shouldn't apm(d) rather refuse to run? (Why I really tried this is just
to find out what will appear when i _do_ enable apm.)


So next, I enabled apm in the kernel (that is, reboot and boot -c). Now

(1) dmesg | grep apm says

        UKC> enable apm
        307 apm0 enabled
        apm0 at bios0: Power Management spec V1.2
        apm0: battery life expectancy 100%
        apm0: AC on, battery charge high
        apm0: flags 30102 dobusy 0 doidle 1

According to apm(4), the lower two bytes "0102" of the flags correspond
to the version 1.2 of the spec. So does apm0 say "Power Management spec
V 1.2" because the flags say so, or does APM detect a "V1.2 - capable"
hardware regardles of its own flags? (Then I am happy that they agree.)
I see that in GENERIC, apm has flags 0x0000 - so is it that the flags
are figured out during boot?

I also tried changing the next byte from 3 to 0 during boot -c (which
disables interrupts when calling APM BIOS routines, and disables some
SONY-specific battery life estimation) as in

        > boot -c
        > change apm
        307 apm0 at bios0 flags 0x30102
        change (y/n)
        flags [0x30102] 0x000102
        307 apm0 changed
        307 apm0 at bios0 flags 0x102
        > quit

but it still boots with flags 0x30102; that is, dmesg after I boot says
"apm0: flags 30102 dobusy 0 doidle 1" as if I hadn't done the above. Why
is that? OTOH, if I "config -ufe /bsd" after the boot, it says

        > find apm
        307 apm0 at bios0 flags 0x102

which is what I did indeed. Why doesn't it boot with these flags (and
reflect it in the dmesg?) 

Also, what exactly is "dobusy 0 doidle 1"?

(2) After the boot, apm without arguments correctly reports AC connected etc.

(3) apmd will start; with -m the messages will (correctly) appear twice.
    It will refuse to start twice (/dev/apmctl busy).

(4) apm -A will make apmd say "setting hw.setperf automatically",
    but now apmd will not realize that hw.setperf doesn't exist.

(5) apm -S says
    "apm0: APM set power state: unable to enter requested state (96)"
    This message is not (grep) in the apm(d) source. Who is saying that
    really? Does that mean the machine itself doesn't support standby?

(6) apm -z says "system will enter suspend mode momentarilly",
    and the machine stops responding; the screen does not blank,
    the cursor keeps blinking, but no reaction. I cannot ping the
    machine from outside. Pressing the power button shortly does
    nothing, pressing it for longer time shuts the laptop down;
    then I reboot and curse and fsck and all that.
    
(7) Pressing Fn+Suspend (the laptop blue keys) does the same as (6).

What can I do to find out what really happened (besides APMDEBUG)? Is
there any chance that switching off the 0x10000 byte of the apm0 flags
(= not leaving interrupts enabled during APM BIOS routines) will change
the suspend behaviour?

Generally, what is the status of APM, especially on laptops? Is there
any interrest in APMDEBUG for me, is it worth the time trying to make
APM work on this laptop, or should I forget about APM (as various posts
suggest) and try to get ACPI working, which I understand is the
replacement for APM (and more)?

Also, not having hw.setperf, is there any chance I can get
CPU scaling to work?

And before I move to ACPI: I need to be running -current, right?
(At least http://openbsd.org/i386-laptop.html says
"There is currently neither Firewire nor ACPI support in OpenBSD".)


        Thanks for your time

                Jan


hw.machine=i386
hw.model=Intel Pentium III ("GenuineIntel" 686-class)
hw.ncpu=1
hw.byteorder=1234
hw.physmem=267939840
hw.usermem=267935744
hw.pagesize=4096
hw.disknames=wd0
hw.diskcount=1
hw.cpuspeed=399
hw.vendor=Dell Computer Corp.
hw.product=Latitude LS
hw.version=00h

Please note the discrepancy in apm0 flags
(or I probably need to be educated):

OpenBSD 4.2-stable (GENERIC) #2: Wed Jan 16 15:30:08 CET 2008
    [EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class) 399 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,SER,MMX,FXSR,SSE
real mem  = 267939840 (255MB)
avail mem = 251043840 (239MB)
User Kernel Config
UKC> find acpi
396 acpi0 at mainbus0 disable bus -1 flags 0x0
UKC> find apm
307 apm0 at bios0 flags 0x102
UKC> quit
Continuing...
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 12/07/01, BIOS32 rev. 0 @ 0xfd7b0, SMBIOS 
rev. 2.3 @ 0xdc010 (25 entries)
bios0: vendor Quanta Computer version "A09(J3K13) " date 12/07/2000
bios0: Dell Computer Corp. Latitude LS
apm0 at bios0: Power Management spec V1.2
apm0: battery life expectancy 100%
apm0: AC on, battery charge high
apm0: flags 30102 dobusy 0 doidle 1
pcibios0 at bios0: rev 2.1 @ 0xfd7b0/0x850
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf50/144 (7 entries)
pcibios0: PCI Interrupt Router at 000:07:0 ("Intel 82371FB ISA" rev 0x00)
pcibios0: PCI bus #2 is the last bus
bios0: ROM list: 0xc0000/0xc000 0xcc000/0x800! 0xdc000/0x4000!
cpu0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "Intel 82443BX AGP" rev 0x03
ppb0 at pci0 dev 1 function 0 "Intel 82443BX AGP" rev 0x03
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "Neomagic Magicgraph NM2200" rev 0x20
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
"Neomagic MagicMedia 256AV" rev 0x20 at pci1 dev 0 function 1 not configured
piixpcib0 at pci0 dev 7 function 0 "Intel 82371AB PIIX4 ISA" rev 0x02
pciide0 at pci0 dev 7 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <IC25N020ATMR04-0>
wd0: 16-sector PIO, LBA48, 19077MB, 39070080 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
uhci0 at pci0 dev 7 function 2 "Intel 82371AB USB" rev 0x01: irq 10
piixpm0 at pci0 dev 7 function 3 "Intel 82371AB Power" rev 0x03: SMI
iic0 at piixpm0
cbb0 at pci0 dev 10 function 0 "TI PCI1211 CardBus" rev 0x00: irq 10
xl0 at pci0 dev 13 function 0 "3Com 3c905C 100Base-TX" rev 0x78: irq 10, 
address 00:b0:d0:4d:ae:31
bmtphy0 at xl0 phy 24: Broadcom 3C905C internal PHY, rev. 7
isa0 at piixpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
usb0 at uhci0: USB revision 1.0
uhub0 at usb0: Intel UHCI root hub, rev 1.00/1.00, addr 1
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 2 device 0 cacheline 0x8, lattimer 0x20
pcmcia0 at cardslot0
biomask ef6d netmask ef6d ttymask ffef
pctr: 686-class user-level performance counters enabled
mtrr: Pentium Pro MTRR support
dkcsum: wd0 matches BIOS drive 0x80
root on wd0a swap on wd0b dump on wd0b

Reply via email to