All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Oberfichtner <pro@denx.de>
To: Moritz Fischer <moritzf@google.com>
Cc: sjg@chromium.org, u-boot@lists.denx.de, bmeng.cn@gmail.com,
	marex@denx.de, xypron.glpk@gmx.de, stcarlso@linux.microsoft.com
Subject: Re: [PATCH] pci: Enable dm_pci_map_bar() for 64-bit BARs
Date: Fri, 24 Nov 2023 13:09:22 +0100	[thread overview]
Message-ID: <ZWCScp6HHX9gj9Ow@eryximachos> (raw)
In-Reply-To: <20231124101520.1077082-1-moritzf@google.com>

Hi,

On Fri, Nov 24, 2023 at 10:15:20AM +0000, Moritz Fischer wrote:
> Allow dm_pci_map_bar() usage on systems with CONFIG_PCI_SYS_64BIT.
<snip>
>  
> +	/*
> +	 * This assumes that dm_pciauto_setup_device() will allocate
> +	 * a 64-bit address if CONFIG_SYS_PCI_64BIT is enabled and
> +	 * the device advertises that it supports it.
> +	 */

This patch is also useful if the previous bootstage, e.g. coreboot,
allocated a 64-bit address. In fact I recently did something very
similar (downstream), so

Reviewed-by: Philip Oberfichtner <pro@denx.de>


-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-22  Fax: +49-8142-66989-80   Email: pro@denx.de
=====================================================================

> +	if (IS_ENABLED(CONFIG_SYS_PCI_64BIT) &&
> +	    (bar_response & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
> +		dm_pci_read_config32(udev, bar + 4, &bar_response);
> +		pci_bus_addr |= (pci_addr_t)bar_response << 32;
> +	}
> +
>  	if (~((pci_addr_t)0) - pci_bus_addr < offset)
>  		return NULL;
>  
> diff --git a/include/pci.h b/include/pci.h
> index 2f5eb30b83..0d1ac7b015 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -1350,8 +1350,8 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t addr, size_t len,
>   *
>   * Looks up a base address register and finds the physical memory address
>   * that corresponds to it.
> - * Can be used for 32b BARs 0-5 on type 0 functions and for 32b BARs 0-1 on
> - * type 1 functions.
> + * Can be used for 32b/64b BARs 0-5 on type 0 functions and for 32b BARs 0-1
> + * on type 1 functions.
>   * Can also be used on type 0 functions that support Enhanced Allocation for
>   * 32b/64b BARs.  Note that duplicate BEI entries are not supported.
>   *
> -- 
> 2.43.0.rc1.413.gea7ed67945-goog
> 

      reply	other threads:[~2023-11-24 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 10:15 [PATCH] pci: Enable dm_pci_map_bar() for 64-bit BARs Moritz Fischer
2023-11-24 12:09 ` Philip Oberfichtner [this message]

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=ZWCScp6HHX9gj9Ow@eryximachos \
    --to=pro@denx.de \
    --cc=bmeng.cn@gmail.com \
    --cc=marex@denx.de \
    --cc=moritzf@google.com \
    --cc=sjg@chromium.org \
    --cc=stcarlso@linux.microsoft.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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.