From owner-freebsd-acpi@FreeBSD.ORG Tue Mar 17 04:11:17 2015 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 001971ED for ; Tue, 17 Mar 2015 04:11:16 +0000 (UTC) Received: from nm11-vm3.bullet.mail.gq1.yahoo.com (nm11-vm3.bullet.mail.gq1.yahoo.com [98.136.218.158]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9DAC9B8 for ; Tue, 17 Mar 2015 04:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1426565158; bh=/8xxFRn4VO2aDKl4YRkHv0wMic9VQo+KMHoCrz3vHoY=; h=Date:From:To:CC:Subject:References:In-Reply-To:From:Subject; b=f/kJnEAwY41+FLaeLM+7iMmO+d0zwe/2Y4WgY/e2aJFrJOuClr11bckvAqxAklYWH7keekQ8J3kMuUUY9VJw8/bSVUpsxP7V1zWuONOhX6w8R28WF+8rKzlXsAy8lVT2pIgmbZRcvbpvoGdu9nTycpyWeEZJahrc4c3UHjcrSw4= Received: from [216.39.60.180] by nm11.bullet.mail.gq1.yahoo.com with NNFMP; 17 Mar 2015 04:05:58 -0000 Received: from [98.138.226.62] by tm16.bullet.mail.gq1.yahoo.com with NNFMP; 17 Mar 2015 04:05:58 -0000 Received: from [127.0.0.1] by smtp213.mail.ne1.yahoo.com with NNFMP; 17 Mar 2015 04:05:58 -0000 X-Yahoo-Newman-Id: 468124.31228.bm@smtp213.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: QqU2RjgVM1l4gaAAv6lgV8VLjJ_P9MuMkDZQg5Boi6FInrK AWcskpJv6sTlbpsbmsB7VM.vDPHdkXat5P10NXfgWbjQkZfAkGyyfhRJZzUI X9wuFWDc3uRkAA9fTWltiyP5jgb0MTSVCn.up58vzKAhFjXwIa0wX06wODtm gfHn8WXCKEL3c7LSHyR3SbmJqEBvByUPX0GRHXeZTN1MSNKqlPyRuhyrkQyn 2B3qpsQoueZN1Ib0InrandrJZPyD6QIPVrv1tJm2hojsHc583crxebdW7_rK kelsHICas8ZeDmNb8ksYvHQPCpY4O59SgDOIuXJIMyvc4wdTCRhTvZtJwQaW DzFa63ehuO2JJTF7v1QEyy617HXu9PJOjaH7xrqlN7JXFtkEoEoUu6Spa81r EwI3jnfuPAaRiknkl8Hj2HLJWqEZxAUCWPZygvpEnySqjT.dMAXyYPmDPRrN 6oSqBhXTbUhyHrTT.awwqTAzGHiBoSRDDwW6NinNh4DDKypxtGcP43bq94J3 XAs5an.TLuZrQGYw8OMVlSX0V23bSOrmfxG4CZkg.BLZZgwkZ X-Yahoo-SMTP: OKD1keCswBBTAmAF1s00hLyKW3wE3YfSK0Eazl6b4VZG4LTqJxg- Message-ID: <5507A820.5000707@att.net> Date: Tue, 17 Mar 2015 00:05:52 -0400 From: Anthony Jenkins User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jung-uk Kim , Ian Smith Subject: Re: [PATCH] ACPI CMOS region support rev. 5 References: <20150222180817.GD27984@strugglingcoder.info> <54EB8C21.2080600@att.net> <2401337.2oUs7iAbtB@ralph.baldwin.cx> <54EF3D5D.4010106@att.net> <20150227222203.P38620@sola.nimnet.asn.au> <20150228125857.D1277@besplex.bde.org> <54F14368.4020807@att.net> <20150302002647.W42658@sola.nimnet.asn.au> <54F5E53D.1090601@att.net> <20150306025800.U46361@sola.nimnet.asn.au> <54F9D7E6.4050807@att.net> <5504FF32.3020202@att.net> <20150317001401.X22641@sola.nimnet.asn.au> <5506F00A.3030708@att.net> <5506FBE3.1000009@att.net> <20150317041624.K22641@sola.nimnet.asn.au> <55073442.5060005@att.net> <550768E6.6000801@FreeBSD.org> In-Reply-To: <550768E6.6000801@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: freebsd-acpi@freebsd.org X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2015 04:11:17 -0000 On 03/16/15 19:36, Jung-uk Kim wrote: > On 03/16/2015 15:51, Anthony Jenkins wrote: > > On 03/16/2015 01:49 PM, Ian Smith wrote: > >> On Mon, 16 Mar 2015 11:50:59 -0400, Anthony Jenkins wrote: > >>> On 03/16/2015 11:00 AM, Anthony Jenkins wrote: > >>>> On 03/16/2015 09:59 AM, Ian Smith wrote: > >>>>> On Sat, 14 Mar 2015 23:40:34 -0400, Anthony Jenkins wrote: > >>>>>> + if (!acpi_check_rtc_byteaccess(function =3D=3D > >>>>>> ACPI_READ, address)) + return > >>>>>> AE_BAD_PARAMETER; > >>>>> acpi_check_rtc_byteaccess() needs to be called per byte of > >>>>> 1, 2 or 4 bytes - or pass it 'bytes' also, and loop over > >>>>> each of them within? =3D=3D=3D=3D=3D=3D=3D > >>>>> > >>>>> Otherwise (for example) a 2 byte read from 0x0b or 4 byte > >>>>> read from 0x09-0x0b will read 0x0c (clearing interrupts), > >>>>> or a 2 or 4 byte write to (say) 0x01 will also write to > >>>>> 0x02 and 0x04 (clobbering the time). > >>>> Right, this is an (incorrect) hybrid of a few attempts, > >>>> probably from around the time I lost my SSD and only had a > >>>> single backup copy of my work to go from. In one revision I > >>>> had disallowed all multibyte accesses (width > 8) since IMHO > >>>> it was more consistent/correct with the suggested locking. I > >>>> wasn't ignoring your suggestion, just making one or a few > >>>> changes at a time (generally the simpler ones). > >>> > >>> Okay now I remember why I was reluctant to do this - suppose > >>> ACPIBIOS does a multibyte op on a set of bytes whose last byte > >>> fails acpi_check_rtc_byteaccess(). I will have already > >>> performed n-1 accesses. At one point I had a revision > >>> (acpi_check_rtc_access()?) that permitted/denied the entire > >>> request (it took the starting address and byte length), but I > >>> guess that got lost too. I'll just recreate it... > >> > >> Yep, validating all access before doing any sounds like the way > >> to go. > >> > >> Also, bytes =3D width >> 3 is ok, since you then affirm !(width & > >> 0x07), so non-multiples of 8 bits are invalidated anyway. You > >> should still check that width (or bytes) > 0, even if 0 should > >> never be passed. > > > Oh yeah, forgot about that! > > >> I guess the Big Kids will start playing once this hits bugzilla? > >> :) > > > I'm just glad I get to learn how to commit stuff to FreeBSD. > > > Here's another iteration...comments welcome. Think I got (most) > > everything in there. I need to unit test acpi_check_rtc_access() > > to make sure it DTRT. > > I see that there are several minor style(9) bugs Ahh... style(9) is what I was looking for, thanks. Yeah I was hoping someone would point me to FreeBSD's official coding style guide. > but the most serious > problem is this patch makes atrtc.c dependent on ACPI and it > practically kills off APM support. Not quite sure what you mean here... do you mean a non-ACPI build of the kernel would fail to compile atrtc(4)? Yeah I can fix that. > Please make it optional (hint: > sys/conf/files* and sys/conf/options*) although I don't mind killing > off APM support. ;-) Well I'd just make the ACPI CMOS handler code conditional on ACPI being enabled in config(5)... is that what you're looking for (or would that work)? Thanks, Anthony > Jung-uk Kim > _______________________________________________ > 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"=