From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 09:29:06 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91DD1864 for ; Wed, 18 Jun 2014 09:29:06 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26E202B0A for ; Wed, 18 Jun 2014 09:29:06 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id hi2so752026wib.1 for ; Wed, 18 Jun 2014 02:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ki2G/ft6vsmj64Uv8BM//w+L970RJAval4sgWCjA60E=; b=luH6mWgKpRyeblDj9PXOArYBofuz+tcJz/BWttS9RHuCdYU9y0Jp7DZZRq6Qa8fpZf kvMoZ8qbgfs1UTM1Q+cFmSel7DwqPCB7quFu8ORvnF/8RwWf1iJDRFiHbJb0yqlmevNQ uiVkr+ToF4qnieqHloeJeEbBTuINoI4vPe/r+3AwD7XjjLvpC6nGsZs//qtQbLCnDpaq 9gDP2/1lSYZqu1vPIt4SF2FplHttLtZEX1maIG40Qv9rPUekf57iZZOaXd1LzPPxG1IY y4BIlHcivV+wbXHLEPMmrSlRKxPv46GNKuYVhXhltFjOCOaMMiABqepPwhOtJlJJaPm9 hb0g== X-Received: by 10.180.14.40 with SMTP id m8mr3595767wic.50.1403083744439; Wed, 18 Jun 2014 02:29:04 -0700 (PDT) Received: from brick.home (adhc141.neoplus.adsl.tpnet.pl. [79.184.158.141]) by mx.google.com with ESMTPSA id i4sm3469160eeo.44.2014.06.18.02.29.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jun 2014 02:29:03 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 18 Jun 2014 11:29:01 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Alexandr Krivulya Subject: Re: [patch] USB after second suspend/resume on ThinkPads. Message-ID: <20140618092901.GB7662@brick.home> Mail-Followup-To: Alexandr Krivulya , freebsd-current@freebsd.org References: <20140616192155.GE13481@brick.home> <53A14910.2090303@shurik.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <53A14910.2090303@shurik.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2014 09:29:06 -0000 On 0618T1108, Alexandr Krivulya wrote: > 16.06.2014 22:21, Edward Tomasz Napierała пишет: > > Hi. Patch below should fix a problem where USB stops working after > > _second_ suspend/resume, which happens on various ThinkPad models. > > Please test, and report both success stories and failures. If nothing > > comes up, I'll commit it in a week or so. > > > > (Btw, has anyone encountered the problem on hardware other than ThinkPads?) > > > > > > Index: sys/dev/acpi_support/acpi_ibm.c > > =================================================================== > > --- sys/dev/acpi_support/acpi_ibm.c (revision 267417) > > +++ sys/dev/acpi_support/acpi_ibm.c (working copy) > > @@ -169,6 +169,9 @@ struct acpi_ibm_softc { > > int light_get_supported; > > int light_set_supported; > > > > + /* USB power workaround */ > > + ACPI_HANDLE power_handle; > > + > > /* led(4) interface */ > > struct cdev *led_dev; > > int led_busy; > > @@ -365,6 +368,7 @@ acpi_ibm_attach(device_t dev) > > { > > struct acpi_ibm_softc *sc; > > devclass_t ec_devclass; > > + ACPI_STATUS status; > > > > ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); > > > > @@ -448,6 +452,17 @@ acpi_ibm_attach(device_t dev) > > if (sc->light_set_supported) > > sc->led_dev = led_create_state(ibm_led, sc, "thinklight", sc->light_val); > > > > + /* > > + * Obtain a handle to the power resource available on many models. > > + * This must be turned on manually upon resume. Otherwise the system > > + * may, for instance, resume from S3 with usb(4) powered down. > > + */ > > + status = AcpiGetHandle(sc->handle, "\\_SB.PCI0.LPC.EC.PUBS", &sc->power_handle); > > + if (ACPI_FAILURE(status)) { > > + device_printf(dev, "Failed to get power handle\n"); > > + return (status); > > + } > > + > > return (0); > > } > > > > @@ -476,6 +491,7 @@ static int > > acpi_ibm_resume(device_t dev) > > { > > struct acpi_ibm_softc *sc = device_get_softc(dev); > > + ACPI_STATUS status; > > > > ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); > > > > @@ -495,6 +511,15 @@ acpi_ibm_resume(device_t dev) > > > > acpi_ibm_sysctl_set(sc, i, val); > > } > > + if (sc->power_handle != NULL) { > > + status = AcpiEvaluateObject(sc->power_handle, > > + "_ON", NULL, NULL); > > + if (ACPI_FAILURE(status)) { > > + device_printf(dev, "failed to switch %s on - %s\n", > > + acpi_name(sc->power_handle), > > + AcpiFormatException(status)); > > + } > > + } > > ACPI_SERIAL_END(ibm); > > > > return (0); > Hi. I've never seen this problem before on my ThinkPad E530. However, I > have applied this patch and after reboot all sysctl oids related to > acpi_ibm disappeared. > > root@thinkpad:/home/shurik # kldstat|grep ibm > 9 1 0xffffffff82190000 77e8 acpi_ibm.ko > > root@thinkpad:/home/shurik # sysctl dev.acpi_ibm > root@thinkpad:/home/shurik # > > And in dmesg I see this errors: > > root@thinkpad:/home/shurik # dmesg -a|grep ibm > acpi_ibm0: on acpi0 > acpi_ibm0: Failed to get power handle > device_attach: acpi_ibm0 attach returned 5 Ok, I'll make that attach problem non-fatal. Just to make sure: without the patch you don't have any problems with USB after multiple suspend/resume cycles, and you don't use any workarounds to make it work, eg. setting the dev.uhci.0.wake=1, or making USB ports always powered on in BIOS?