fbdev: list all memory bars as conflicting apertures
Subsystems (2)
RFC PATCH 1/1 fbdev: list all memory bars as conflicting apertures
Simply add all pci memory bars to struct apertures_struct in remove_conflicting_pci_framebuffers(). That allows to drop the res_id parameter.
TODO: actually remove the res_id parameter.
--- drivers/video/fbdev/core/fbmem.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/video/fbdev/core/fbmem.c +18 -4
@@ -1879,14 +1879,28 @@ int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const {struct apertures_struct *ap;bool primary = false; -int err; +int err, idx, cnt, bar; - ap =alloc_apertures (1 ); +for (cnt =0 , bar =0 ; bar <PCI_ROM_RESOURCE ; bar++) { +if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) +continue ; + cnt++; + } + + ap =alloc_apertures (cnt);if (!ap)return -ENOMEM ; - ap->ranges[0 ].base =pci_resource_start (pdev, res_id); - ap->ranges[0 ].size =pci_resource_len (pdev, res_id); +for (idx =0 , bar =0 ; bar <PCI_ROM_RESOURCE ; bar++) { +if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) +continue ; + ap->ranges[idx].base =pci_resource_start (pdev, bar); + ap->ranges[idx].size =pci_resource_len (pdev, bar); +pci_info (pdev,"%s: bar %d: 0x%lx -> 0x%lx\n" , __func__, bar, + (unsigned long )pci_resource_start (pdev, bar), + (unsigned long )pci_resource_end (pdev, bar)); + idx++; + }#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;
Signature · 1 line
2.18.1
Quoted 5 lines · Gerd Hoffmann
Simply add all pci memory bars to struct
apertures_structinremove_conflicting_pci_framebuffers(). That allows to drop theres_idparameter.TODO: actually remove the
res_idparameter.
I think best to do that in a cleanup patch afterwards.
Quoted 30 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/video/fbdev/core/fbmem.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)drivers/video/fbdev/core/fbmem.c +8
-4@@ -1879,14 +1879,28 @@ int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const {struct apertures_struct *ap;bool primary = false; -int err; +int err, idx, cnt, bar; - ap =alloc_apertures (1 ); +for (cnt =0 , bar =0 ; bar <PCI_ROM_RESOURCE ; bar++) { +if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) +continue ; + cnt++; + } + + ap =alloc_apertures (cnt);if (!ap)return -ENOMEM ; - ap->ranges[0 ].base =pci_resource_start (pdev, res_id); - ap->ranges[0 ].size =pci_resource_len (pdev, res_id);
drivers/video/fbdev/core/fbmem.c int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const · line 1903
Quoted 10 lines
drivers/video/fbdev/core/fbmem.c +10
-0+for (idx =0 , bar =0 ; bar <PCI_ROM_RESOURCE ; bar++) { +if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) +continue ; + ap->ranges[idx].base =pci_resource_start (pdev, bar); + ap->ranges[idx].size =pci_resource_len (pdev, bar); +pci_info (pdev,"%s: bar %d: 0x%lx -> 0x%lx\n" , __func__, bar, + (unsigned long )pci_resource_start (pdev, bar), + (unsigned long )pci_resource_end (pdev, bar)); + idx++; + }
lgtm. I think this is ok to merge as-is already ...
Maybe if you want to be paranoid in the conversion add a check that we're not skipping the pci bar requested in res_id. Then we could test this for a kernel and remove the parameter later on.
-Daniel
Quoted 6 lines
drivers/video/fbdev/core/fbmem.c +0
-0#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;Signature · 1 line
2.18.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Quoted 8 lines · Daniel Vetter
Quoted 5 lines · Gerd Hoffmann
Simply add all pci memory bars to struct
apertures_structinremove_conflicting_pci_framebuffers(). That allows to drop theres_idparameter.TODO: actually remove the
res_idparameter.I think best to do that in a cleanup patch afterwards.
I was just lazy and didn't want update all callers for the first patch draft. But doing a test run ...
Quoted 3 lines
Maybe if you want to be paranoid in the conversion add a check that we're not skipping the pci bar requested in
res_id. Then we could test this for a kernel and remove the parameter later on.
... that way before actually dropping the parameter surely makes sense.
New version on the way,
Gerd