Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343278
b: refs/heads/master
c: 84c1b80
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Garrett authored and Bjorn Helgaas committed Dec 5, 2012
1 parent ef0d4be commit a8a0012
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eca0d4676d8e29c209ddce0c0c1755472ffc70a6
refs/heads/master: 84c1b80e32638f881c17390dfe88143e5cd3f583
11 changes: 9 additions & 2 deletions trunk/drivers/pci/rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
loff_t start;
void __iomem *rom;

/*
* Some devices may provide ROMs via a source other than the BAR
*/
if (pdev->rom && pdev->romlen) {
*size = pdev->romlen;
return phys_to_virt((phys_addr_t)pdev->rom);
/*
* IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
* memory map if the VGA enable bit of the Bridge Control register is
* set for embedded VGA.
*/
if (res->flags & IORESOURCE_ROM_SHADOW) {
} else if (res->flags & IORESOURCE_ROM_SHADOW) {
/* primary video rom always starts here */
start = (loff_t)0xC0000;
*size = 0x20000; /* cover C000:0 through E000:0 */
Expand Down Expand Up @@ -181,7 +187,8 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY))
return;

iounmap(rom);
if (!pdev->rom || !pdev->romlen)
iounmap(rom);

/* Disable again before continuing, leave enabled if pci=rom */
if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ struct pci_dev {
};
struct pci_ats *ats; /* Address Translation Service */
#endif
void *rom; /* Physical pointer to ROM if it's not from the BAR */
size_t romlen; /* Length of ROM if it's not from the BAR */
};

static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
Expand Down

0 comments on commit a8a0012

Please sign in to comment.