lkml.org 
[lkml]   [2012]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] x86/pci: Allow x86 platforms to use translation offsets
From
On Wed, Aug 8, 2012 at 4:42 PM,  <charlie.mear@hp.com> wrote:
> From: Charlie Mear <charlie.mear@hp.com>
>
> The memory range descriptors in the _CRS control method contain an
> address translation offset for host bridges. This value is used to
> translate addresses across the bridge. The support to use _TRA values
> is present for other architectures but not for X86 platforms.
>
> For existing X86 platforms the _TRA value is zero. Non zero _TRA values
> are expected on future X86 platforms and this change will register that
> value with the resource.
>
> Signed-off-by: Charlie Mear <charlie.mear@hp.com>
> ---
> arch/x86/pci/acpi.c | 18 ++++++++++++++++--
> 1 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index 505acdd..37acbae 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -12,6 +12,7 @@ struct pci_root_info {
> char name[16];
> unsigned int res_num;
> struct resource *res;
> + u64 *res_offset;

resource_size_t * ?

> struct pci_sysdata sd;
> #ifdef CONFIG_PCI_MMCONFIG
> bool mcfg_added;
> @@ -306,6 +307,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
> res->start = start;
> res->end = end;
> res->child = NULL;
> + info->res_offset[info->res_num] = addr.translation_offset;
>
> if (!pci_use_crs) {
> dev_printk(KERN_DEBUG, &info->bridge->dev,
> @@ -375,7 +377,8 @@ static void add_resources(struct pci_root_info *info,
> "ignoring host bridge window %pR (conflicts with %s %pR)\n",
> res, conflict->name, conflict);
> else
> - pci_add_resource(resources, res);
> + pci_add_resource_offset(resources, res,
> + info->res_offset[i]);
> }
> }
>
> @@ -383,6 +386,8 @@ static void free_pci_root_info_res(struct pci_root_info *info)
> {
> kfree(info->res);
> info->res = NULL;
> + kfree(info->res_offset);
> + info->res_offset = NULL;
> info->res_num = 0;
> }
>
> @@ -433,11 +438,20 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
> return;
>
> size = sizeof(*info->res) * info->res_num;
> - info->res_num = 0;
> info->res = kmalloc(size, GFP_KERNEL);
> if (!info->res)
you need to info->res_num = 0 here
> return;
>
> + size = sizeof(*info->res_offset) * info->res_num;
> + info->res_offset = kmalloc(size, GFP_KERNEL);
> + if (!info->res_offset) {
> + kfree(info->res);
> + info->res = NULL;
> + return;
> + }
> + info->res_num = 0;

need to move it before: if (!info->res_offset) {

Thanks

Yinghai


\
 
 \ /
  Last update: 2012-08-09 02:41    [W:0.024 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site