From owner-freebsd-acpi@FreeBSD.ORG Fri Aug 1 19:40:41 2014 Return-Path: Delivered-To: freebsd-acpi@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 BB3C64DD for ; Fri, 1 Aug 2014 19:40:41 +0000 (UTC) Received: from mail-yh0-x233.google.com (mail-yh0-x233.google.com [IPv6:2607:f8b0:4002:c01::233]) (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 758E62C87 for ; Fri, 1 Aug 2014 19:40:41 +0000 (UTC) Received: by mail-yh0-f51.google.com with SMTP id f73so2863006yha.10 for ; Fri, 01 Aug 2014 12:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wJHOWfl/Vrd5bMAy9mIJ/mTHz1YCTOJQE00Nwz86r7A=; b=BABp/ePYfVamxC3iEenG0Ap7uOMaQ5w/IJVQfqT+KYZWpXcQPKCkLtaZWfdivK3eXR Usvkmn8NgugfP6PBoBDQj+nbeB598btmmG6/N9/bMa2Y0aU1K/Xfo5S/cGPsar7M4DS9 GH2M2ny5KVaGOqCO4bCa3SXkMMUe+EDnRxhSG5BsBZLwjIids+OkFM3fhmZXs2n0+MGE Nct1v+jt1UQLkXFkchhKQqZhNIBiAVLuFxFI+ZRoCuiTFFUDWWxoj8a0YLCVFvwwGTFw l2F9ypHR9YB+/bVUQqN/TLQ/uauPrlO8yWcuH3B9iPLBIQXDsFr3rGHWQIfSjvwajja5 0GHQ== MIME-Version: 1.0 X-Received: by 10.236.85.10 with SMTP id t10mr10729144yhe.86.1406922040238; Fri, 01 Aug 2014 12:40:40 -0700 (PDT) Received: by 10.170.210.86 with HTTP; Fri, 1 Aug 2014 12:40:40 -0700 (PDT) In-Reply-To: References: <20140722033156.E8638@sola.nimnet.asn.au> <1405965655.15937.YahooMailAndroidMobile@web181606.mail.ne1.yahoo.com> <20140721213352.GA64025@hell> <20140722180506.GA67094@hell> <20140725221954.GA42012@hell> Date: Fri, 1 Aug 2014 21:40:40 +0200 Message-ID: Subject: Re: ACPI support - Freebsd 10 on Sony Vaio VPCCA3C5E From: Daniele Mazzotti To: Kevin Oberman Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: "freebsd-acpi@freebsd.org" 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: Fri, 01 Aug 2014 19:40:41 -0000 Hello everybody, after several tries I finally managed to fix two out of three issue I had on my Sony Vaio. After I switched to Intel driver I was forced to update my system to STABLE (@Kevin: thanks for the support - I tried to write a set of scripts to download the required VT sources and copy them to the correct folders, but after two nights of work I decided that it was more the efforts than the benefits). Then I recompiled the GENERIC Kernel from STABLE and added the support for VT instead of the original SC and I am now able to switch through different terminals (@all: thanks for suggesting me to remove Vesa and use proper video drivers). Finally I have applied Anthony's patch and the suspend/resume mode works like a charm! The only thing which is now missing is the battery support, but debugging that stuff is definitively out of my skill set! Would you think is it worth trying? Cheers, Daniele. 2014-07-26 19:40 GMT+02:00 Daniele Mazzotti : > Hi Kevin, > > that is a good news but I have a RELEASE therefore if I am not wrong I > should recompile my kernel. Did I miss something? > > Cheers, > Daniele. > > > 2014-07-26 18:52 GMT+02:00 Kevin Oberman : > > On Sat, Jul 26, 2014 at 9:31 AM, Kevin Oberman >> wrote: >> >>> On Sat, Jul 26, 2014 at 1:46 AM, Daniele Mazzotti >>> wrote: >>> >>>> Hi, >>>> >>>> thanks again for your precious help. The suspend mode is not working >>>> yet as VESA option is still in my kernel configuration. I wanted to wait >>>> before removing it as I was not sure that intel video driver would have >>>> worked. My intention was to have a working setup with intel and being able >>>> to switch amongst vt(s) before getting rid of vesa, as I would peferer >>>> having the possibility to switch amongst vt(s) than putting my laptop to >>>> suspend. >>>> >>>> By the way I have a 10-RELEASE therefore I suspect I will have to >>>> recompile the kernel with VT. Did I get you right? >>>> >>>> I googled a bit and it seems that the only thing I have to do is to add >>>> these devices to my kernel: >>>> >>>> device vt >>>> device vt_vga >>>> >>>> This is the source I am referring to: https://wiki.freebsd.org/Newcons. >>>> Is this it? >>>> >>>> Cheers and thanks again, >>>> Daniele. >>>> >>>> >>> Maybe and maybe not. The wiki page needs updating. >>> >>> Look at /sys/ARCH/conf for a VT configuration. If it is there, just >>> build a kernel with: >>> # make buildkernel kernconf=VT && make installkernel kernconf=VT >>> (You probably want to add a reasonable -j option for your hardware to >>> the buildkernel.) >>> >>> If you don't have a VT config file, than just set the kern.vty=vt >>> loadable in /boot/loader.conf. No need to build a new kernel. >>> >> >> I just looked at teh repo an can say that just adding kern.vty=vt to >> /boot/loader.conf will work on head r 267965 or newer and 10-Stable r268366 >> or newer. Looks like this has not been MFCed to 9. >> >> -- >> R. Kevin Oberman, Network Engineer, Retired >> E-mail: rkoberman@gmail.com >> >> >> >>>> >>>> 2014-07-26 8:14 GMT+02:00 Kevin Oberman : >>>> >>>>> On Fri, Jul 25, 2014 at 3:19 PM, Bykov Vladislav <> < >>>>> envolyse@gmail.com> wrote: >>>>> >>>>>> On Fri, Jul 25, 2014 at 10:43:11PM +0200, Daniele Mazzotti wrote: >>>>>> > The error I get anytime I try to switch between terminals is the >>>>>> following >>>>>> > one " drmDropMaster failed: Unknown error: -22" >>>>>> This is okay, if you can't switch back to tty after starting Xorg in >>>>>> KMS >>>>>> mode using old syscons driver. There is already work going on with new >>>>>> driver, vt. I didn't test it though. >>>>>> >>>>>> At least, suspend is works now? >>>>>> >>>>> >>>>> Try adding kern.vty=vt to /boot/loader.conf. In recent 9-stable, >>>>> 10-stable, and head kernels, this is all it takes to switch to vt(4). If >>>>> you have an older kernel or are running any release, you will need to >>>>> rebuild the kernel using the VT configuration. The loader option may have >>>>> made 9.3, but I'm not sure. I don't believe vt(4) is available for 8. >>>>> -- >>>>> R. Kevin Oberman, Network Engineer, Retired >>>>> E-mail: rkoberman@gmail.com >>>>> >>>>> >>>> >>>> >>> >> > From owner-freebsd-acpi@FreeBSD.ORG Sat Aug 2 21:58:20 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 0CE575F6 for ; Sat, 2 Aug 2014 21:58:20 +0000 (UTC) Received: from nm14-vm2.access.bullet.mail.bf1.yahoo.com (nm14-vm2.access.bullet.mail.bf1.yahoo.com [216.109.115.17]) (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 A539723DA for ; Sat, 2 Aug 2014 21:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s2048; t=1407016544; bh=7r+BS6UZEP42g5n2FNswSTm5hgwX99+SEc7Mvc5xpQ8=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=dJeRgxWOPyhg9W8lXRAA1yQ9Y4bOXIxmid/75sPm0VvY2B8FSnPo3T052gwUQIyp17Wf9iDrdAV46CAIqxPC3WBSwuKjoMFZfMavH9LnuWd3sOabI6LC5MprpBW1/kutKiUm8zzP7o8v6/HlZnfiTUYLXTs+su93jFpEP4FK/VCB90MNIIeYoi2Qwc7LClONeaxYB1IEDhTqHzRLL+RPaNWAsmS5YLo20c9Py3odvUvt22Bv91q08qn/s9UOgXMf4rlIltfGpWwZaV6CzSIKj+FtLwzCQ72NyD04n4qVH45RsMqaB7Yuh8YQKV37tK1WmbMnlsJ9FRdTcgOE6lRemw== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=att.net; b=RchFKVhh5BfPnVqBLotWgKNoryxi2Q++IQm/YaM/Bl4Q+hVDeaXAO1CFd9+ybxDGIXVdcKnrKty9YUcxI4htMRTMiEtu9ptEdiBl4xSZVoYrIv3o3rZmIHxQowPKpMByRxpDBR86uxEQq55RE85b8bOJ8x7DS2m4ZzLL04HS4uHhu9eyojlDk/qhF0qE9qaAKLXzw4BgIv/s6FpLxRWYYKiqN73nHOONVz6LJGPvQ9jaR+Qc22i4mYJBnjg0E+CHGVazV1BW7TV1mUpintlV0CF8qQPCa6EHbvpPNP+br3zmvA572IBieawkZLoJBC+HIfjT5o2zUvMeuhv3B12JXQ==; Received: from [66.196.81.163] by nm14.access.bullet.mail.bf1.yahoo.com with NNFMP; 02 Aug 2014 21:55:44 -0000 Received: from [98.138.226.242] by tm9.access.bullet.mail.bf1.yahoo.com with NNFMP; 02 Aug 2014 21:55:44 -0000 Received: from [127.0.0.1] by smtp113.sbc.mail.ne1.yahoo.com with NNFMP; 02 Aug 2014 21:55:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1407016544; bh=7r+BS6UZEP42g5n2FNswSTm5hgwX99+SEc7Mvc5xpQ8=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=DmB+tiRI/7iSGW5Wju9DsSi1hN4K+8GuWIxZGxwOOwav1LuVdkmE77wGguWaw4+6PKJYWdOKfb8byM0aLGRS/TKO7fcKqxjd4VHXmxB5dFe7VXzUPKp0zzfcNo2OIYjQERDZUtIcvr4cKsDdj3jBMWZ0Um0d7MNj5GmLCE5eHuQ= X-Yahoo-Newman-Id: 479526.74214.bm@smtp113.sbc.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: nXOjD1YVM1kTqbBRlV8nvpX2fnpbGNwzNBuCkWjWBfiD2N_ lphmx_ECWW_NEgfnXOhWnx4OlB6F1p_KjIUz5bjnc1clD0xy9DjOrTDEWAil 0gTEf1Tw95s56Ml6jzlbf6Vwmyfv_9jiGKr4ZP3q7ZPHqYGzP9ARSbwoi2Oz THmyNXWHrrGsKI02LTB8ZnNCcPBwoJ4LPtje1_AJHdns3mzrX_B8EUQKuwEp pGF2zDrXNyviEDGW1g_EF0z0VNwgJydGUKAL00M1ExFoPyq4AdJMX2T3opas 2meUT4ayq.oQYtRRyGo7LEvHKWkWPmgG_GlCpGyIIsXre61CyKFxGTYutdpk RGjRvvqg2RspZYMJYWTgmIwKXGtYuYGX41ALH9FH8yzAsKZJy6WgUZNBLm5V wCe7twbjxo4E8dbXRUZ72s7hh4HI5H981lDKsleKuePP._VHe2W3RFhlvGkI sF9gDxDvecY5t.QBwUmnoQistzZFylwvzu9p.jzBJxE1qW3KUUjQn9kWR3jB .jcWEUO.MpguBFw4ydqyfYjciedC03qieFypkDvAvJCEXorEeCsY54lBEHPN 8ZX0- X-Yahoo-SMTP: OKD1keCswBBTAmAF1s00hLyKW3wE3YfSK0Eazl6b4VZG4LTqJxg- Message-ID: <53DD5E4D.3070505@att.net> Date: Sat, 02 Aug 2014 17:55:25 -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: Daniele Mazzotti , Kevin Oberman Subject: Re: ACPI support - Freebsd 10 on Sony Vaio VPCCA3C5E References: <20140722033156.E8638@sola.nimnet.asn.au> <1405965655.15937.YahooMailAndroidMobile@web181606.mail.ne1.yahoo.com> <20140721213352.GA64025@hell> <20140722180506.GA67094@hell> <20140725221954.GA42012@hell> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "freebsd-acpi@freebsd.org" 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: Sat, 02 Aug 2014 21:58:20 -0000 Awesome! The battery thing is kind of baffling, as a developer I'd start by tracking down where we're (FreeBSD) getting the bogus values (I don't recall the battery problem details). i'm gonna work to get my ACPI CMOS region support patch into the codebase, seems to be helpful to a lot of people. Looks like a lot of manufacturers use CMOS to implement their suspend/resume functionality. Good luck, I'll try to think of stuff to try with the battery. Anthony On 08/01/2014 15:40, Daniele Mazzotti wrote: > Hello everybody, > > after several tries I finally managed to fix two out of three issue I had > on my Sony Vaio. After I switched to Intel driver I was forced to update my > system to STABLE (@Kevin: thanks for the support - I tried to write a set > of scripts to download the required VT sources and copy them to the correct > folders, but after two nights of work I decided that it was more the > efforts than the benefits). > > Then I recompiled the GENERIC Kernel from STABLE and added the support for > VT instead of the original SC and I am now able to switch through different > terminals (@all: thanks for suggesting me to remove Vesa and use proper > video drivers). > > Finally I have applied Anthony's patch and the suspend/resume mode works > like a charm! > The only thing which is now missing is the battery support, but debugging > that stuff is definitively out of my skill set! Would you think is it worth > trying? > > Cheers, > Daniele. > > > > 2014-07-26 19:40 GMT+02:00 Daniele Mazzotti : > >> Hi Kevin, >> >> that is a good news but I have a RELEASE therefore if I am not wrong I >> should recompile my kernel. Did I miss something? >> >> Cheers, >> Daniele. >> >> >> 2014-07-26 18:52 GMT+02:00 Kevin Oberman : >> >> On Sat, Jul 26, 2014 at 9:31 AM, Kevin Oberman >>> wrote: >>> >>>> On Sat, Jul 26, 2014 at 1:46 AM, Daniele Mazzotti >>>> wrote: >>>> >>>>> Hi, >>>>> >>>>> thanks again for your precious help. The suspend mode is not working >>>>> yet as VESA option is still in my kernel configuration. I wanted to wait >>>>> before removing it as I was not sure that intel video driver would have >>>>> worked. My intention was to have a working setup with intel and being able >>>>> to switch amongst vt(s) before getting rid of vesa, as I would peferer >>>>> having the possibility to switch amongst vt(s) than putting my laptop to >>>>> suspend. >>>>> >>>>> By the way I have a 10-RELEASE therefore I suspect I will have to >>>>> recompile the kernel with VT. Did I get you right? >>>>> >>>>> I googled a bit and it seems that the only thing I have to do is to add >>>>> these devices to my kernel: >>>>> >>>>> device vt >>>>> device vt_vga >>>>> >>>>> This is the source I am referring to: https://wiki.freebsd.org/Newcons. >>>>> Is this it? >>>>> >>>>> Cheers and thanks again, >>>>> Daniele. >>>>> >>>>> >>>> Maybe and maybe not. The wiki page needs updating. >>>> >>>> Look at /sys/ARCH/conf for a VT configuration. If it is there, just >>>> build a kernel with: >>>> # make buildkernel kernconf=VT && make installkernel kernconf=VT >>>> (You probably want to add a reasonable -j option for your hardware to >>>> the buildkernel.) >>>> >>>> If you don't have a VT config file, than just set the kern.vty=vt >>>> loadable in /boot/loader.conf. No need to build a new kernel. >>>> >>> I just looked at teh repo an can say that just adding kern.vty=vt to >>> /boot/loader.conf will work on head r 267965 or newer and 10-Stable r268366 >>> or newer. Looks like this has not been MFCed to 9. >>> >>> -- >>> R. Kevin Oberman, Network Engineer, Retired >>> E-mail: rkoberman@gmail.com >>> >>> >>> >>>>> 2014-07-26 8:14 GMT+02:00 Kevin Oberman : >>>>> >>>>>> On Fri, Jul 25, 2014 at 3:19 PM, Bykov Vladislav <> < >>>>>> envolyse@gmail.com> wrote: >>>>>> >>>>>>> On Fri, Jul 25, 2014 at 10:43:11PM +0200, Daniele Mazzotti wrote: >>>>>>>> The error I get anytime I try to switch between terminals is the >>>>>>> following >>>>>>>> one " drmDropMaster failed: Unknown error: -22" >>>>>>> This is okay, if you can't switch back to tty after starting Xorg in >>>>>>> KMS >>>>>>> mode using old syscons driver. There is already work going on with new >>>>>>> driver, vt. I didn't test it though. >>>>>>> >>>>>>> At least, suspend is works now? >>>>>>> >>>>>> Try adding kern.vty=vt to /boot/loader.conf. In recent 9-stable, >>>>>> 10-stable, and head kernels, this is all it takes to switch to vt(4). If >>>>>> you have an older kernel or are running any release, you will need to >>>>>> rebuild the kernel using the VT configuration. The loader option may have >>>>>> made 9.3, but I'm not sure. I don't believe vt(4) is available for 8. >>>>>> -- >>>>>> R. Kevin Oberman, Network Engineer, Retired >>>>>> E-mail: rkoberman@gmail.com >>>>>> >>>>>> >>>>> > _______________________________________________ > 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" > From owner-freebsd-acpi@FreeBSD.ORG Sat Aug 2 22:13:23 2014 Return-Path: Delivered-To: freebsd-acpi@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 609B6740 for ; Sat, 2 Aug 2014 22:13:23 +0000 (UTC) Received: from nm26-vm3.access.bullet.mail.gq1.yahoo.com (nm26-vm3.access.bullet.mail.gq1.yahoo.com [216.39.63.84]) (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 239DE252F for ; Sat, 2 Aug 2014 22:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s2048; t=1407017420; bh=JOwUzElgl7ADwp7kqoeQrDg91WsHVxyf7kNvsRZheXA=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type; b=CEA3bhkMizl2MeSEtJXE6nzdDM78MJrrzdwIQUWBJnDqErvitw/j/CiBRv/V8fACA67Cwemt/TaNFgkYIYDQ7iBMCe5r2Sh8GYmhbuBksQgZAQ7pdgfm4PRmfvsnZY8jo38M8sSiwfGvmVw5DjQvV8NmQqHI3ZFSop4ZSmuZCt0tufoxg6HE/fwZfH0R99xzYRT2Q4XRzX7v8iDQHQRW2mtAvuc05TCkGbsMhP+e1ga3xRnTe/DjaXJkyluTcm86euPeyjHpe17vUiModShj0CYfn/mxXMKQSXUKp3k8AAhfFmfyWJN4Us0lSt/RIRZvO2Fz5aSoh0ndgQhsNCHwUw== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=att.net; b=azw3+ZXlitSIMq9zM/K5JAxpV90jSDUzNrJzNlIXfDG6q5kjbGhbKFbJ5jlQC+wL/FcrvITd7EWveQPcSPtu28T6dwNStoWqLWWoX6amJQh0NK/q4m/EiEwwrUS31aZiBpGyRljw0E38Ps8n5gDns3C6EPz28fpnhLFR5vbu1pO6ghSfMXydEiUDoxVb3GIbTIsfW0uFbv+TfjHdyayds/Bpmucx9pY+rSt7/Pj6dYwsvhA5o2JG3KDFUCJF4X67KejDL3ZC2iLbzHhvcZgPANARUPPJRUGFWU0FmTSKP4fEOQTICthqVuSS7nVsQh2AvnHS4DY+hXAXLdpK4uVqMg==; Received: from [216.39.60.173] by nm26.access.bullet.mail.gq1.yahoo.com with NNFMP; 02 Aug 2014 22:10:20 -0000 Received: from [67.195.22.113] by tm9.access.bullet.mail.gq1.yahoo.com with NNFMP; 02 Aug 2014 22:10:20 -0000 Received: from [127.0.0.1] by smtp115.sbc.mail.gq1.yahoo.com with NNFMP; 02 Aug 2014 22:10:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1407017420; bh=JOwUzElgl7ADwp7kqoeQrDg91WsHVxyf7kNvsRZheXA=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type; b=ZcLoEZWZoZXtkTpe5fbb4WGMvBXZCuq35VecOtq4L9IpvQzcQ3+L83tcSKaiuk3PT0mzpWHKwr2hXWlhpFcHPS+u8mLD3csCsgy5wNhq8wMreJ5dAi5HXuQDkFb6bJVL2IBJxixbvCn578BbsrK5imo57Hhj8KhA3GnpyLkOcJA= X-Yahoo-Newman-Id: 238623.41817.bm@smtp115.sbc.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: fs4cwYkVM1k7heLw8JgsV5On.NeKjNjxcTPbB1F5_0.SjG2 QaXBEvl9cOT1SIChB7tJOwfTU6JjPOVhFk7641zbSgMrVuxNyxB19F_J77h3 Djb7l2BsrddH4y_bIlqeuiIS6ZuRoUk0Ilqz6kCzHL8qCRviSZgkX.fTC_aq xrHh2_.hc3oHJWo4kOsu6LxlCoaaQUW_7QPDpPNB6I4qJyUzLarGBPcUjlXP PE8M7Hr1rtWV0kWYvnNz9wNNcMUbhVdjLHpN5HNREGBcUMuFDGV.lmuOI6l1 Sni5P4oW3MavK0y9vj7JFFfeDe4XTvbGvCDb2PENfLzg8rzJklSH7sBKhKg0 CrRLwgh9ZP3YfyhQ5a4I9bi3bsbfDPkxhpGJRuC.A0qxeUi4qSZvkv.KlRQr 9182cN5rXF9.BpKQyViNERTlnJ45PphEPePp23ccaQLYifmkTGtLd71wWKTU cqX0OQTWIV_z195kslZpo3_dBQY6N7VOGnG9DUiU40le4XpcDPdOKOtcW3IB MgmcCJePeb1RE.SIFmzkuQ2LpS2CHL79UM9kfLdsiGjq_J1xuvLwD16MwoCK u5g-- X-Yahoo-SMTP: OKD1keCswBBTAmAF1s00hLyKW3wE3YfSK0Eazl6b4VZG4LTqJxg- Message-ID: <53DD61BD.7050508@att.net> Date: Sat, 02 Aug 2014 18:10:05 -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: freebsd-acpi@freebsd.org Subject: [PATCH] ACPI CMOS region support - submission? Content-Type: multipart/mixed; boundary="------------050105070904000203050100" 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: Sat, 02 Aug 2014 22:13:23 -0000 This is a multi-part message in MIME format. --------------050105070904000203050100 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Okay how do I get this bad boy into -CURRENT? Do I need a sponsor to do the commit? Get my own FreeBSD developer status? I made a few minor changes since the last incarnation: - Defined the CMOS address/data register addresses as macros - Defined the (apparent) I/O delay as a macro I also verified the ACPI CMOS region code only accesses up to register 63 (0x3F - in previous emails I mistakenly said 0x7F). If/when this gets in, I'd like to add sysctl controls to e.g. allow ACPI access to the date/time registers (I currently return failure when attempting to write them via ACPI). I don't see anything in the spec (after re-reading it) that disallows ACPI from touching those. Thanks, Anthony Jenkins --------------050105070904000203050100 Content-Type: text/x-patch; name="atrtc.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="atrtc.c.patch" Index: sys/x86/isa/atrtc.c =================================================================== --- sys/x86/isa/atrtc.c (revision 268728) +++ sys/x86/isa/atrtc.c (working copy) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" +#include "opt_acpi.h" #include #include @@ -53,12 +54,19 @@ #include #include "clock_if.h" +#include +#include +#include + #define RTC_LOCK do { if (!kdb_active) mtx_lock_spin(&clock_lock); } while (0) #define RTC_UNLOCK do { if (!kdb_active) mtx_unlock_spin(&clock_lock); } while (0) +#define IO_DELAY() (void)inb(0x84) +#define IO_RTC_ADDR (IO_RTC + 0) +#define IO_RTC_DATA (IO_RTC + 1) + int atrtcclock_disable = 0; -static int rtc_reg = -1; static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; static u_char rtc_statusb = RTCSB_24HR; @@ -66,39 +74,50 @@ * RTC support routines */ -int -rtcin(int reg) +static void acpi_cmos_read(ACPI_PHYSICAL_ADDRESS address, UINT8 *buf, UINT32 buflen) { - u_char val; + UINT32 offset; RTC_LOCK; - if (rtc_reg != reg) { - inb(0x84); - outb(IO_RTC, reg); - rtc_reg = reg; - inb(0x84); + for (offset = 0U; offset < buflen; ++offset) { + IO_DELAY(); + outb(IO_RTC_ADDR, ((address + offset) | 0x80) & 0xFF); + IO_DELAY(); + buf[offset] = inb(IO_RTC_DATA); } - val = inb(IO_RTC + 1); RTC_UNLOCK; - return (val); } -void -writertc(int reg, u_char val) +static void acpi_cmos_write(ACPI_PHYSICAL_ADDRESS address, const UINT8 *buf, UINT32 buflen) { + UINT32 offset; RTC_LOCK; - if (rtc_reg != reg) { - inb(0x84); - outb(IO_RTC, reg); - rtc_reg = reg; - inb(0x84); + for (offset = 0U; offset < buflen; ++offset) { + IO_DELAY(); + outb(IO_RTC_ADDR, ((address + offset) | 0x80) & 0xFF); + IO_DELAY(); + outb(IO_RTC_DATA, buf[offset]); } - outb(IO_RTC + 1, val); - inb(0x84); + IO_DELAY(); RTC_UNLOCK; } +int +rtcin(int reg) +{ + u_char val; + + acpi_cmos_read(reg & 0xFF, &val, 1); + return (val); +} + +void +writertc(int reg, u_char val) +{ + acpi_cmos_write(reg & 0xFF, &val, 1); +} + static __inline int readrtc(int port) { @@ -144,7 +163,6 @@ { /* Restore all of the RTC's "status" (actually, control) registers. */ - rtcin(RTC_STATUSA); /* dummy to get rtc_reg set */ writertc(RTC_STATUSB, RTCSB_24HR); writertc(RTC_STATUSA, rtc_statusa); writertc(RTC_STATUSB, rtc_statusb); @@ -161,9 +179,52 @@ struct resource *intr_res; void *intr_handler; struct eventtimer et; + ACPI_HANDLE acpi_handle; /* Handle of the PNP0B00 node */ }; static int +is_datetime_reg(ACPI_PHYSICAL_ADDRESS address) +{ + return address == 0x00 || + address == 0x02 || + address == 0x04 || + address == 0x04 || + (address >= 0x06 && address <= 0x09); +} + +static ACPI_STATUS +acpi_rtc_cmos_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address, UINT32 width, + UINT64 *value, void *context, void *region_context) +{ + struct atrtc_softc *sc; + + sc = (struct atrtc_softc *)context; + if (!value || !sc) + return AE_BAD_PARAMETER; + if (width > 32 || (width & 0x07) || address >= 64U) + return AE_BAD_PARAMETER; + if (function == ACPI_WRITE && + (is_datetime_reg(address) || + (width > 8 && address <= 0x09))) + return AE_BAD_PARAMETER; + + switch (function) { + case ACPI_READ: + acpi_cmos_read(address, (UINT8 *)value, width >> 3); + break; + case ACPI_WRITE: + acpi_cmos_write(address, (const UINT8 *)value, width >> 3); + break; + default: + return AE_BAD_PARAMETER; + } + printf("%s: %-5s%02u address=%04lx value=%08x\n", + __FUNCTION__, function == ACPI_READ ? "READ" : "WRITE", + width >> 3, address, *((UINT32 *)value)); + return AE_OK; +} + +static int rtc_start(struct eventtimer *et, sbintime_t first, sbintime_t period) { @@ -245,10 +306,17 @@ int i; sc = device_get_softc(dev); + sc->acpi_handle = acpi_get_handle(dev); sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE); if (sc->port_res == NULL) device_printf(dev, "Warning: Couldn't map I/O.\n"); + if (ACPI_FAILURE(AcpiInstallAddressSpaceHandler(sc->acpi_handle, + ACPI_ADR_SPACE_CMOS, acpi_rtc_cmos_handler, NULL, sc))) + { + device_printf(dev, "Error registering ACPI CMOS address space handler.\n"); + return 0; + } atrtc_start(); clock_register(dev, 1000000); bzero(&sc->et, sizeof(struct eventtimer)); @@ -286,6 +354,15 @@ return(0); } +static int atrtc_detach(device_t dev) +{ + struct atrtc_softc *sc; + + sc = device_get_softc(dev); + AcpiRemoveAddressSpaceHandler(sc->acpi_handle, ACPI_ADR_SPACE_CMOS, acpi_rtc_cmos_handler); + return bus_generic_detach(dev); +} + static int atrtc_resume(device_t dev) { @@ -366,7 +443,7 @@ /* Device interface */ DEVMETHOD(device_probe, atrtc_probe), DEVMETHOD(device_attach, atrtc_attach), - DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_detach, atrtc_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */ --------------050105070904000203050100--