Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Nov 2000 10:55:25 +0900
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        n_hibma@qubesoft.com
Cc:        keichii@peorth.iteration.net, mobile@freebsd.org
Subject:   Re: usb0 not resuming and APM/ACPI weirdness
Message-ID:  <20001119105525E.iwasaki@jp.FreeBSD.org>
In-Reply-To: <Pine.BSF.4.20.0011181740430.68638-100000@henny.webweaving.org>
References:  <20001028051133.A409@peorth.iteration.net> <Pine.BSF.4.20.0011181740430.68638-100000@henny.webweaving.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

> > The old "usb0: host controller halted" problem has returned
> > to my laptop after resume for suspend-to-disk on the latest current
> > for some time.  After resume, usb0 floods my /var/log/messages
> > with thousands of the same messages.
> 
> This is most probably a problem related to ACPI, it suspending the USB
> host controller when suspending and the USB driver getting it wrong when
> unsuspending. I have no idea how to fix this.

Yes, most of modern laptops has power management related methods on
various devices (including USB host controller) in ACPI Machine
Language format.  And these methods should to be executed by AML
interpreter in order to maintain (or re-initialize?) the devices when
the machine is going to sleep/wakeup.

I guess that the problem is
 - When suspend-to-{RAM|disk} by APM, any AML methods won't be executed.
 - Currently, our ACPI code supports limited sleep state only
   (suspend/hibernation in APM haven't supported yet).

so I think that implement sleep/wakeup code in device driver which
equivalent to AML methods would be a short-term solution...
# acpidump(8) and amldb(8) maybe help us.
Of course I know that ACPI support improvement is better solution.

BTW Michael, what laptop are you using?  and could you send me ACPI
data?
# please see acpidump(8)

Following is a example of USB sleep/wakeup methods in disassembled AML
format which is from Sony PCG-Z505SX.
# _S3 is for sleep (suspending in APM), _S0 is for wakeup (resuming).

Scope(_SB_) {
	:
    Device(PCI0) {
	:
        Device(USB0) {
		:
            Name(_PSC, 0x0)
            Method(_PS0) {
                If(LEqual(_PSC, 0x3)) {
                    PHS_(0xf2)
                    Store(0x0, _PSC)
                }
            }
            Method(_PS3) {
                If(LEqual(_PSC, 0x0)) {
                    PHS_(0xf1)
                    Store(0x3, _PSC)
                }
            }
        }
	:
    }
	:
}
	:
OperationRegion(SMI0, SystemMemory, 0x07fffdbc, 0x00000200)
Field(SMI0, AnyAcc, NoLock, Preserve) {
    BCMD,       8,
    DID_,       32,
    INFO,       4000
}
	:
Field(SMI0, AnyAcc, NoLock, Preserve) {
    Offset(0x5),
    INFD,       32
}
OperationRegion(SMI1, SystemIO, 0x00008040, 0x00000002)
Field(SMI1, AnyAcc, NoLock, Preserve) {  
    SMIC,       8
}

Mutex(MPHS, 0)
Method(PHS0, 1) {
    Store(Arg0, BCMD)
    Store(Zero, SMIC)
    While(LEqual(BCMD, Arg0)) {
    }
    Store(0x0, BCMD)
}
Method(PHS_, 1, Serialized) {
    Acquire(MPHS, 0xffff)
    Store(0x0, DID_)
    PHS0(Arg0)
    Store(INFD, Local0)   
    Release(MPHS)
    Return(Local0)
}


And runing amldb(8) give us a lot of hints to implement sleep/wakeup code.

% amldb PCG-Z505SX-R0205Z0.dsdt
Loading PCG-Z505SX-R0205Z0.dsdt...done
AML>r \_SB_.PCI0.USB0._PS3
Method: Arg 0 From 0x28060c4b To 0x28060c61
==== Running \_SB_.PCI0.USB0._PS3. ====
AML>s
[\_SB_.PCI0.USB0._PS3. START]
If(LEqual(_PSC, 0x0)){
    PHS_(0xf1)
AML>
[\PHS_. START]
Acquire(MPHS, 0xffff)
AML>
Store(0x0, DID_)
[aml_region_write(0, 0, 0x0, 0x7fffdbc, 0x20, 0x20)]
        [0:0x0@0x7fffdc0:0,32]  ->[0:0x0@0x7fffdc0:0,32]
[write(0, 0x0, 0x7fffdc0)]
[aml_region_read(0, 0, 0x7fffdbc, 0x20, 0x20)]
        [0:0x0@0x7fffdc0:0,32]
DEBUG[read(0, 0x7fffdc0)&mask:0x0](default: 0x0 / 0) >>
[read(0, 0x7fffdc0)->0x0]
AML>
PHS0(Arg0)
AML>
[\PHS0. START]
Store(Arg0, BCMD)
[aml_region_write(0, 0, 0xf1, 0x7fffdbc, 0x0, 0x8)]
        [0:0x0@0x7fffdbc:0,8]   ->[0:0xf1@0x7fffdbc:0,8]
[write(0, 0xf1, 0x7fffdbc)]
[aml_region_read(0, 0, 0x7fffdbc, 0x0, 0x8)]
        [0:0xf1@0x7fffdbc:0,8]
DEBUG[read(0, 0x7fffdbc)&mask:0xf1](default: 0xf1 / 241) >>
	:

Thanks


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001119105525E.iwasaki>