Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Sinan Kaya
On 5/17/2018 6:17 AM, Robin Murphy wrote: >> +    } >> + > > Is this not pretty much just pcibios_bus_to_resource()? > Agreed, let me convert the code to use pcibios_bus_to_resource() API. I wasn't aware of its existence. > Robin. -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Sinan Kaya
On 5/17/2018 6:17 AM, Robin Murphy wrote: >> +    } >> + > > Is this not pretty much just pcibios_bus_to_resource()? > Agreed, let me convert the code to use pcibios_bus_to_resource() API. I wasn't aware of its existence. > Robin. -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Robin Murphy
On 16/05/18 19:23, Sinan Kaya wrote: A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-17 Thread Robin Murphy
On 16/05/18 19:23, Sinan Kaya wrote: A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
On 5/16/2018 2:31 PM, Timur Tabi wrote: > On 05/16/2018 01:23 PM, Sinan Kaya wrote: >> +    win_start = window->res->start - window->offset; > > Can you guarantee that window->res->start is always >= window->offset? > Resource offset is generally 0 when not translating or a positive number

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
On 5/16/2018 2:31 PM, Timur Tabi wrote: > On 05/16/2018 01:23 PM, Sinan Kaya wrote: >> +    win_start = window->res->start - window->offset; > > Can you guarantee that window->res->start is always >= window->offset? > Resource offset is generally 0 when not translating or a positive number

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Timur Tabi
On 05/16/2018 01:23 PM, Sinan Kaya wrote: + win_start = window->res->start - window->offset; Can you guarantee that window->res->start is always >= window->offset? + win_size = window->res->end - window->res->start + 1; Use resource_size() instead. -- Qualcomm

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Timur Tabi
On 05/16/2018 01:23 PM, Sinan Kaya wrote: + win_start = window->res->start - window->offset; Can you guarantee that window->res->start is always >= window->offset? + win_size = window->res->end - window->res->start + 1; Use resource_size() instead. -- Qualcomm

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
On 5/16/2018 2:23 PM, Sinan Kaya wrote: > + if (win_start <= base && win_end >= base + win_size - 1) { > + base += window->offset; > + break; > + } I should probably add window->offset!=0 to the if statement in order not to break

Re: [RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
On 5/16/2018 2:23 PM, Sinan Kaya wrote: > + if (win_start <= base && win_end >= base + win_size - 1) { > + base += window->offset; > + break; > + } I should probably add window->offset!=0 to the if statement in order not to break

[RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011eff] When a VGA device is behind such

[RFC PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge

2018-05-16 Thread Sinan Kaya
A host bridge is allowed to remap BAR addresses using _TRA attribute in _CRS windows. pci_bus :00: root bus resource [mem 0x8010010-0x8011fff window] (bus address [0x0010-0x1fff]) pci :02:00.0: reg 0x10: [mem 0x8011e00-0x8011eff] When a VGA device is behind such