From owner-freebsd-acpi@FreeBSD.ORG Thu Jun 26 11:47:17 2014 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81ABF81F for ; Thu, 26 Jun 2014 11:47:17 +0000 (UTC) Received: from nm4-vm3.access.bullet.mail.bf1.yahoo.com (nm4-vm3.access.bullet.mail.bf1.yahoo.com [216.109.114.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30BF02F2E for ; Thu, 26 Jun 2014 11:47:16 +0000 (UTC) Received: from [66.196.81.164] by nm4.access.bullet.mail.bf1.yahoo.com with NNFMP; 26 Jun 2014 11:44:36 -0000 Received: from [98.138.104.96] by tm10.access.bullet.mail.bf1.yahoo.com with NNFMP; 26 Jun 2014 11:44:36 -0000 Received: from [127.0.0.1] by smtp116.sbc.mail.ne1.yahoo.com with NNFMP; 26 Jun 2014 11:44:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1403783076; bh=LCFp+zfbs6G4C8dg/bNpL6X37a+MufayrvMrY2U+ios=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=bIPdqkB4vJwAPB9ivEv74C1BtIX1yfvvhpPs2qbxLEhWNOuv+V8x+amnCmoTngUz49/g58CUQvZSXfpV4QUXZZgM9krMOlwU536aXK71NCVhAYkvf9BXAD1BNqTkTPXEPCQ0P9jpSyHByxk7Jh4zLVlfbAQDO+jP4dZX7b5Stkc= X-Yahoo-Newman-Id: 389642.31944.bm@smtp116.sbc.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: u0zQrz4VM1mm01ZIHPrYn8kHt6hu5vfvITIY1cbjHxgwrZi Kl0OhMm7HlENTTObjb1BhaZUTyfUz9wGa3424KQeqYBk5DYQgXycefm92Ey2 LBWTOEcsgljQBmXh0lc_KYFFeos2qr1oliMG0.F4VmD5dIAL.P6nZd9pDcmK gCStE3jo4Lq4oiRRIaJIYftS0wVAZ_.4DJz0haQguClS.mWQHuj9TW2VO6VE AYYGHqzstzBHWdgcp5OOZBMH5Ri16zANSYkqn0kRtNsb1m9WQxfaQXR5ksWa f2WPSkftcudb9wBvdxLjYd5P4N8_F_QSNDJu9j9rXZPQJKa91a2.5pAimwmj Lq3_DLYrTUE..hrTmTwOfPSWCLMiJRVLtWT9H4PNvxaxq6bhj1EiCAWeTi9s JTkkww4ib_URdXp6YTQP1s0u3AD64lzIbrTEJOGLBPPUcif56D1Gon.k6jKB ptgvbCkDXWcowSiZrY1FU2GPv.GoDmm06tqM3a1KGq0uY2ywFzGSZ8WCP3on WbXGTBzrZq2y174wf1yvJcLCon.5finXvBsMIXsjCfRcnb3cvdJ8- X-Yahoo-SMTP: OKD1keCswBBTAmAF1s00hLyKW3wE3YfSK0Eazl6b4VZG4LTqJxg- X-Rocket-Received: from [10.0.1.177] (Anthony.B.Jenkins@70.90.74.161 with plain [98.138.84.52]) by smtp116.sbc.mail.ne1.yahoo.com with SMTP; 26 Jun 2014 11:44:36 +0000 UTC Message-ID: <53AC07A3.7070904@att.net> Date: Thu, 26 Jun 2014 07:44:35 -0400 From: Anthony Jenkins User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Bykov Vladislav , freebsd-acpi@freebsd.org Subject: Re: Impossible shutdown References: <20140625222911.GA34447@hellgate.Dlink> In-Reply-To: <20140625222911.GA34447@hellgate.Dlink> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2014 11:47:17 -0000 On 06/25/2014 18:29, Bykov Vladislav wrote: > Hello. > > I have a problem with ACPI on HP Envy 4 that causes in impossible shutdown. It > reaches an error while prepairing to shutdown, and reboots the machine. > > I already did sent a bug report about 2-3 months ago, but things doesn't seems > to move on. > > Here's an error when booting the machine: > > ACPI Error: No handler for Region [RCM0] (0xfffffe0002b0f800) [SystemCMOS] (20110527/evregion-421) > ACPI Error: Region SystemCMOS (ID=5) has no handler (20110527/exfldio-310) > ACPI Error: Method parse/execution failed [\134_SB_.WMID.ESDT] (Node 0xfffffe0002aee440), AE_NOT_EXIST (20110527/psparse-560) > ACPI Error: Method parse/execution failed [\134_SB_.PCI0.LPCB.EC0_._Q42] (Node 0xfffffe0002b16d40), AE_NOT_EXIST (20110527/psparse-560) > acpi_ec0: evaluation of query method _Q42 failed: AE_NOT_EXIST > > And here's the one when I'm trying to shut it down: > > usbus2: Controller shutdown complete > ACPI Error: No handler for Region [RCM0] (0xfffffe0002b15900) [SystemCMOS] (20110527/evregion-421) > ACPI Error: Region SystemCMOS (ID=5) has no handler (20110527/exfldio-310) > ACPI Error: Method parse/execution failed [\_SB_.WMID.ESDT] (Node 0xfffffe0002af5800), AE_NOT_EXIST (20110527/psparse-560) > ACPI Error: Method parse/execution failed [\_PTS] (Node 0xfffffe0002af86c0), AE_NOT_EXIST (20110527/psparse-560) > acpi0: AcpiEnterSleepStatePrep failed - AE_NOT_EXIST > Rebooting... > > I've tried FreeBSD 9, FreeBSD 10, and -CURRENT. All have the same problem. Here's a case where my patch to implement the SystemCMOS region handler should help; it allows my HP Envy to power down and allows it to suspend/resume except the LCD backlight doesn't come back when resuming. Biggest problem with the patch IMHO is I'm stealing ("borrowing") from the real time clock (RTC) I/O region, but I don't think we have an "actual" FreeBSD driver for that. Reposting here, or search this list for "Naive implementation of AcpiExCmosSpaceHandler", let me know if it doesn't apply cleanly to your version of FreeBSD . I've posted it upstream to the acpica mailing list, but no response. diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c index d17411e..4f341ca 100644 --- a/source/components/events/evhandler.c +++ b/source/components/events/evhandler.c @@ -142,6 +142,7 @@ UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_ADR_SPACE_SYSTEM_IO, ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_CMOS, ACPI_ADR_SPACE_DATA_TABLE }; @@ -451,9 +452,12 @@ AcpiEvInstallSpaceHandler ( */ if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_PROCESSOR) && + (Node->Type != ACPI_TYPE_REGION) && (Node->Type != ACPI_TYPE_THERMAL) && (Node != AcpiGbl_RootNode)) { + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, + "Device %p not a DEVICE, PROCESSOR, REGION, THERMAL type or root node.\n", Node)); Status = AE_BAD_PARAMETER; goto UnlockAndExit; } diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index ea10a01..bfdd721 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -521,6 +521,20 @@ AcpiExPciConfigSpaceHandler ( return_ACPI_STATUS (Status); } +static UINT8 AcpiExCmosRead(ACPI_PHYSICAL_ADDRESS Address) +{ + UINT32 Value32; + + AcpiHwWritePort((ACPI_IO_ADDRESS) 0x70, (UINT32) Address, 8); + AcpiHwReadPort ((ACPI_IO_ADDRESS) 0x71, &Value32, 8); + return Value32 & 0xFF; +} + +static void AcpiExCmosWrite(ACPI_PHYSICAL_ADDRESS Address, UINT8 Value) +{ + AcpiHwWritePort((ACPI_IO_ADDRESS) 0x70, (UINT32) Address, 8); + AcpiHwWritePort((ACPI_IO_ADDRESS) 0x71, (UINT32) Value, 8); +} /******************************************************************************* * @@ -545,7 +559,7 @@ AcpiExCmosSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT64 *Value, + UINT64 *Value64, void *HandlerContext, void *RegionContext) { @@ -554,7 +568,23 @@ AcpiExCmosSpaceHandler ( ACPI_FUNCTION_TRACE (ExCmosSpaceHandler); - + if (Address < 0x80 && + (Function == ACPI_READ || Function == ACPI_WRITE) && + BitWidth <= 64) + { + UINT32 i; + UINT8 *Value = (UINT8 *)Value64; + + for (i = 0; i < (BitWidth + 7) / 8; ++i, ++Address, ++Value) { + if (Function == ACPI_READ) { + *Value = AcpiExCmosRead(Address); + } else { + AcpiExCmosWrite(Address, *Value); + } + } + } else { + Status = AE_BAD_PARAMETER; + } return_ACPI_STATUS (Status); } diff --git a/source/include/acconfig.h b/source/include/acconfig.h index 6b34484..7fe2eac 100644 --- a/source/include/acconfig.h +++ b/source/include/acconfig.h @@ -270,7 +270,7 @@ /* Maximum SpaceIds for Operation Regions */ #define ACPI_MAX_ADDRESS_SPACE 255 -#define ACPI_NUM_DEFAULT_SPACES 4 +#define ACPI_NUM_DEFAULT_SPACES 5 /* Array sizes. Used for range checking also */ Sincerely, Vladislav. _______________________________________________ freebsd-acpi@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-acpi To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@freebsd.org"