From owner-freebsd-acpi@FreeBSD.ORG Fri Mar 6 16:40:41 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 4279E33C for ; Fri, 6 Mar 2015 16:40:41 +0000 (UTC) Received: from nm19-vm4.bullet.mail.gq1.yahoo.com (nm19-vm4.bullet.mail.gq1.yahoo.com [98.136.217.27]) (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 0E23BFFF for ; Fri, 6 Mar 2015 16:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1425659879; bh=De223/rrxuZ5CKXoqkGsWu4zGLJZkqv4GunBM0nMAxU=; h=Date:From:To:CC:Subject:References:In-Reply-To:From:Subject; b=M8zBt9E5GKK2larX5sCVc+7bfKlB4pO09Rkq39Mfr/dwAx9dvxcSz0EwdJSF41eCqoJ//TR6I8az4T6H0QMl8hp3IJ9NXrrqcvbJgarH4UiFR0OP4QKbik2HYkmtxKJDse7/v7/yLoiYaoOFVZiKvmHG1UljrnIk+PtEXS5JgEA= Received: from [98.137.12.63] by nm19.bullet.mail.gq1.yahoo.com with NNFMP; 06 Mar 2015 16:37:59 -0000 Received: from [98.138.84.37] by tm8.bullet.mail.gq1.yahoo.com with NNFMP; 06 Mar 2015 16:37:59 -0000 Received: from [127.0.0.1] by smtp105.mail.ne1.yahoo.com with NNFMP; 06 Mar 2015 16:37:58 -0000 X-Yahoo-Newman-Id: 929932.61238.bm@smtp105.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EgsOs7AVM1n9B_Ejb1D6qBoPga6bVV9AgsbMXRIslWKtg4k RdZ0yw1eBjIDDXhPtPVfB4ueeDVYwihuqMJBHCFLEGo1YUItEZjfZpXOlnI7 nf_z5__YaENi1EkiTHzrddsYpNQ0rU.ivYMRVJE0CTLxcBlFq8zXI9l9eHIU 7IPwOcB33feXW2YZr9Uxn52qNBiCQz.DSV4GfMblR2fJIlncNI.Q6VUcALnE _iRY5zPCa3CLpkgN5i0UxUa5yZpZ7GVdInh_cytxBtK8VZKyXkzo8cCBHQJR 9FeP5fAb1FQJVbabsyy7oaHnSU6OLxV.A8.jkZQy94cYrhfv1eIU689a56Iv pWvPZLYGrNIbKlQ5hO5BDrhNQKBimx.73zj0nSCvlF5hyAQbyhk0C_h1wplB my8AYiztOzWK2iGwkwweEqVu.kKcelgzHH7fxWrCb1k59gb7hQExWR1UhW7m IgCinqavLLYNu3pcy7cbafvAybwCcUpDyHnt4xOpDq_V6I0sRW9ombKMn8vH FG5u8gsEdCiIWStCsiFgxuBNQX27Mktu5M9extn8c6gBk0Q-- X-Yahoo-SMTP: OKD1keCswBBTAmAF1s00hLyKW3wE3YfSK0Eazl6b4VZG4LTqJxg- Message-ID: <54F9D7E6.4050807@att.net> Date: Fri, 06 Mar 2015 11:37:58 -0500 From: Anthony Jenkins User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Ian Smith Subject: Re: [PATCH] ACPI CMOS region support rev. 3 [was Re: No acpi_dell(4)] 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> In-Reply-To: <20150306025800.U46361@sola.nimnet.asn.au> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fri, 06 Mar 2015 16:40:41 -0000 On 03/06/2015 06:49 AM, Ian Smith wrote: > On Tue, 3 Mar 2015 11:45:49 -0500, Anthony Jenkins wrote: > > On 03/01/2015 09:29 AM, Ian Smith wrote: > [..] > Regarding systems without ACPI loaded, or active: what happens when the > below AcpiInstallAddressSpaceHandler() call fails, but returns 0? Would > not that prevent rtc_start() from running atrtc_start() etc for non-ACPI > clock initialisation and registration? Good catch, there's technically no reason to bail on rtc_start() if I fail to register the ACPI CMOS handler; it'll just never get called (same as old behaviour). I'll change "Error" to "Warning" and remove the return 0. > I suppose there's a global kernel variable for acpi_is_active ono? > > > +static int > > rtc_start(struct eventtimer *et, sbintime_t first, sbintime_t period) > > { > > > > @@ -245,10 +323,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 +371,15 @@ > > return(0); > > } > > Might that not matter for detach, as you're not testing for return code? Yeah I'd prefer to remember the failure to install the handler and conditionally uninstall it in the detach method. I'll fix up the logging and add these suggestions this weekend. Thanks, Anthony > > +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); > > +} > > cheers, Ian > _______________________________________________ > 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"