All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tan Jui Nee <jui.nee.tan@intel.com>,
	mika.westerberg@linux.intel.com, heikki.krogerus@linux.intel.com,
	tglx@linutronix.de, dvhart@infradead.org, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, ptyser@xes-inc.com,
	lee.jones@linaro.org, linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, jonathan.yong@intel.com,
	ong.hock.yu@intel.com, tony.luck@intel.com,
	wan.ahmad.zainie.wan.mohamad@intel.com, yunying.sun@intel.com
Subject: Re: [PATCH v10 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's
Date: Thu, 10 Nov 2016 18:07:16 +0200	[thread overview]
Message-ID: <1478794036.5295.130.camel@linux.intel.com> (raw)
In-Reply-To: <1478768430-13422-2-git-send-email-jui.nee.tan@intel.com>

On Thu, 2016-11-10 at 17:00 +0800, Tan Jui Nee wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> There is already one and at least one more user coming which
> require an access to Primary to Sideband bridge (P2SB) in order
> to get IO or MMIO bar hidden by BIOS.
> Create a driver to access P2SB for x86 devices.
> 
> Signed-off-by: Yong, Jonathan <jonathan.yong@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


> +int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
> +	struct resource *res)
> +{
> +	u32 base_addr;
> +	u64 base64_addr;
> +	unsigned long flags;
> +
> 

> +	if (!res)
> +		return -EINVAL;

I don't remember the details, one version was quite changed, so, I think
these lines are not needed anymore.

> +	/* Get IO or MMIO BAR */
> +	pci_bus_read_config_dword(pdev->bus, devfn, SBREG_BAR,
> &base_addr);
> +	if ((base_addr & PCI_BASE_ADDRESS_SPACE) ==
> PCI_BASE_ADDRESS_SPACE_IO) {
> +		flags = IORESOURCE_IO;
> +		base64_addr = base_addr & PCI_BASE_ADDRESS_IO_MASK;
> +	} else {
> +		flags = IORESOURCE_MEM;
> +		base64_addr = base_addr & PCI_BASE_ADDRESS_MEM_MASK;
> +		if (base_addr & PCI_BASE_ADDRESS_MEM_TYPE_64) {
> +			flags |= IORESOURCE_MEM_64;
> 

> +			pci_bus_read_config_dword(pdev->bus, devfn,
> +				SBREG_BAR + 4, &base_addr);

Fix indentation.

> +			base64_addr |= (u64)base_addr << 32;
> +		}
> +	}
> +
> +	/* Hide the P2SB device */
> +	pci_bus_write_config_byte(pdev->bus, devfn, SBREG_HIDE,
> 0x01);
> +
> +	spin_unlock(&p2sb_spinlock);
> +

> +	/* User provides prefilled resources */

Not anymore as far I as I can see. You just return here the result.

> +	res->start = (resource_size_t)base64_addr;
> +	res->flags = flags;

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2016-11-10 16:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10  9:00 [PATCH v10 0/6] pinctrl/broxton: enable platform device in the absent of ACPI enumeration Tan Jui Nee
2016-11-10  9:00 ` [PATCH v10 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's Tan Jui Nee
2016-11-10 16:07   ` Andy Shevchenko [this message]
2016-12-09  7:50     ` Tan, Jui Nee
2016-12-09  7:50       ` Tan, Jui Nee
2016-11-10  9:00 ` [PATCH v10 2/6] mfd: lpc_ich: Rename lpc-ich driver Tan Jui Nee
2016-11-10 16:01   ` Andy Shevchenko
2016-11-10  9:00 ` [PATCH v10 3/6] x86/intel-ivi: Add Intel In-Vehicle Infotainment (IVI) systems used in cars support Tan Jui Nee
2016-11-10  9:00 ` [PATCH v10 4/6] mfd: move enum lpc_chipsets into lpc_ich.h Tan Jui Nee
2016-11-10  9:00 ` [PATCH v10 5/6] mfd: lpc_ich: Add Device IDs for Intel Apollo Lake PCH Tan Jui Nee
2016-11-10  9:00 ` [PATCH v10 6/6] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system Tan Jui Nee
2016-11-10 10:40   ` kbuild test robot
2016-11-10 10:40     ` kbuild test robot
2016-11-10 11:39     ` Andy Shevchenko
2016-11-10 16:19   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478794036.5295.130.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dvhart@infradead.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jonathan.yong@intel.com \
    --cc=jui.nee.tan@intel.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=ong.hock.yu@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ptyser@xes-inc.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=wan.ahmad.zainie.wan.mohamad@intel.com \
    --cc=x86@kernel.org \
    --cc=yunying.sun@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.