From owner-svn-src-head@freebsd.org Sat Feb 25 16:06:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59C19CEDB1D for ; Sat, 25 Feb 2017 16:06:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B81D149 for ; Sat, 25 Feb 2017 16:06:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id 203so44088266ith.0 for ; Sat, 25 Feb 2017 08:06:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1EwLde0xJ0Za/98Uh0Gx/ImhnzMHpM3r4rEgXGS3huM=; b=uKnhaMx+tMNTve6NnIUYob7uhuLojBKYgLuxJhhIXCc2SVpygVp2NCOA74bu/XqAjM sy/HpGxO53EFlXTRCU52h5rzJN3NSrWR7wDMVIwx+h5ISj9lfWcKPi2zEsSE+AakMyya 3YIqXn42o98TM8/dRWRALcJHpbrBDYlnU1EqHX06wgH6F1d5Jx3Wxl5hXMLCRXkoTWRs IuhYIzo/pV98FFqi1Nt50PzTC43s8FyTwhlxmeoklnfBOjxhdrbDTWHa6lHyCH4jlKzz xz1vS9Ronz7YtPYCWWgIQX8Zg2mrB4JW0bypzZclBC9Zc5N7IG9+vBwsV33BPEZtjfEB jExQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1EwLde0xJ0Za/98Uh0Gx/ImhnzMHpM3r4rEgXGS3huM=; b=h6T0Imj8Rt+m/F/P6VIqTr9nmZn54vHksTw4WgPkknCdJjAnzcdw4F9hemzuAn+OAJ v5rSdZhBWWRPODaql9zmUdptEkl7XlJx5u2U6OICcXlfU+CFzofjUZP2YbI1bWaexPgj OmMJvQGB4yXqXkO2aLgyVC1lIk625kKNLDhnIE0oFVPcWD7yaiYjaEiejQ7swHwziCdo jKoQut6NXhLXfl9qu/AEnjLZyxhhB+E6UuX/MHwll7n3fjRUf9cN1m+AL/3tMHU2bpC8 oQ8VxThTmbmmNSzOhlRJy4mo2akSZFpjOuna1rCmA+0vjxBlsJASbOyhKKD7mWrPtCoP V62A== X-Gm-Message-State: AMke39nV1pVn1EBTQER/CO/hERfF4eC/7lSrPhMxkLyQNt4jan5jD9j8I3COJwSrBIOMc0ZivY7Fe/w46zl1bw== X-Received: by 10.36.79.13 with SMTP id c13mr6998314itb.103.1488038815084; Sat, 25 Feb 2017 08:06:55 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.145.132 with HTTP; Sat, 25 Feb 2017 08:06:54 -0800 (PST) X-Originating-IP: [69.53.245.200] In-Reply-To: <201702250611.v1P6Bamt080852@repo.freebsd.org> References: <201702250611.v1P6Bamt080852@repo.freebsd.org> From: Warner Losh Date: Sat, 25 Feb 2017 09:06:54 -0700 X-Google-Sender-Auth: O-8XZK7_QTC4qcQLSOGpxg3lihQ Message-ID: Subject: Re: svn commit: r314248 - head/sys/dev/pci To: Warner Losh Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2017 16:06:56 -0000 On Fri, Feb 24, 2017 at 11:11 PM, Warner Losh wrote: > Author: imp > Date: Sat Feb 25 06:11:36 2017 > New Revision: 314248 > URL: https://svnweb.freebsd.org/changeset/base/314248 > > Log: > Create pcib_request_feature. > > pcib_request_feature allows drivers to request the firmware (ACPI) > release certain features it may be using. ACPI normally manages things > like hot plug, advanced error reporting and other features until the > OS requests ACPI to relenquish control since it is taking over. > > Sponsored by: Netflix Forgot to add 'Differential Review: https://reviews.freebsd.org/D9715 > Modified: > head/sys/dev/pci/pci_if.m > head/sys/dev/pci/pci_pci.c > head/sys/dev/pci/pcib_if.m > > Modified: head/sys/dev/pci/pci_if.m > ============================================================================== > --- head/sys/dev/pci/pci_if.m Sat Feb 25 04:24:51 2017 (r314247) > +++ head/sys/dev/pci/pci_if.m Sat Feb 25 06:11:36 2017 (r314248) > @@ -60,6 +60,11 @@ HEADER { > PCI_ID_RID, > PCI_ID_MSI, > }; > + > + enum pci_feature { > + PCI_FEATURE_HP, /* Hot Plug feature */ > + PCI_FEATURE_AER, /* Advanced Error Reporting */ > + }; > } > > > > Modified: head/sys/dev/pci/pci_pci.c > ============================================================================== > --- head/sys/dev/pci/pci_pci.c Sat Feb 25 04:24:51 2017 (r314247) > +++ head/sys/dev/pci/pci_pci.c Sat Feb 25 06:11:36 2017 (r314248) > @@ -76,6 +76,8 @@ static void pcib_pcie_ab_timeout(void * > static void pcib_pcie_cc_timeout(void *arg); > static void pcib_pcie_dll_timeout(void *arg); > #endif > +static int pcib_request_feature(device_t pcib, device_t dev, > + enum pci_feature feature); > > static device_method_t pcib_methods[] = { > /* Device interface */ > @@ -119,6 +121,7 @@ static device_method_t pcib_methods[] = > DEVMETHOD(pcib_try_enable_ari, pcib_try_enable_ari), > DEVMETHOD(pcib_ari_enabled, pcib_ari_enabled), > DEVMETHOD(pcib_decode_rid, pcib_ari_decode_rid), > + DEVMETHOD(pcib_request_feature, pcib_request_feature), > > DEVMETHOD_END > }; > @@ -2829,3 +2832,24 @@ pcib_try_enable_ari(device_t pcib, devic > > return (0); > } > + > +/* > + * Pass the request to use this PCI feature up the tree. Either there's a > + * firmware like ACPI that's using this feature that will approve (or deny) the > + * request to take it over, or the platform has no such firmware, in which case > + * the request will be approved. If the request is approved, the OS is expected > + * to make use of the feature or render it harmless. > + */ > +static int > +pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature) > +{ > + device_t bus; > + > + /* > + * Our parent is necessarily a pci bus. Its parent will either be > + * another pci bridge (which passes it up) or a host bridge that can > + * approve or reject the request. > + */ > + bus = device_get_parent(pcib); > + return (PCIB_REQUEST_FEATURE(device_get_parent(bus), dev, feature)); > +} > > Modified: head/sys/dev/pci/pcib_if.m > ============================================================================== > --- head/sys/dev/pci/pcib_if.m Sat Feb 25 04:24:51 2017 (r314247) > +++ head/sys/dev/pci/pcib_if.m Sat Feb 25 06:11:36 2017 (r314248) > @@ -212,3 +212,12 @@ METHOD void decode_rid { > int *slot; > int *func; > } DEFAULT pcib_decode_rid; > + > +# > +# Request control of PCI features from host firmware, if any. > +# > +METHOD int request_feature { > + device_t pcib; > + device_t dev; > + enum pci_feature feature; > +}; >