Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261165
b: refs/heads/master
c: 8d6a6a4
h: refs/heads/master
i:
  261163: d0af917
v: v3
  • Loading branch information
Bjorn Helgaas authored and Jesse Barnes committed Jul 22, 2011
1 parent b06abd4 commit b2f11da
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 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: c9b378c7cbf623649e4ca64f955f2afd12ef01b2
refs/heads/master: 8d6a6a47636648754dc371b01228520a2adaf430
22 changes: 19 additions & 3 deletions trunk/drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,33 @@ static u64 pci_size(u64 base, u64 maxbase, u64 mask)
return size;
}

static inline enum pci_bar_type decode_bar(struct resource *res, u32 bar)
static inline enum pci_bar_type decode_bar(struct pci_dev *dev,
struct resource *res, u32 bar)
{
u32 mem_type;

if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
res->flags = bar & ~PCI_BASE_ADDRESS_IO_MASK;
return pci_bar_io;
}

res->flags = bar & ~PCI_BASE_ADDRESS_MEM_MASK;

if (res->flags & PCI_BASE_ADDRESS_MEM_TYPE_64)
mem_type = bar & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
switch (mem_type) {
case PCI_BASE_ADDRESS_MEM_TYPE_32:
break;
case PCI_BASE_ADDRESS_MEM_TYPE_1M:
dev_info(&dev->dev, "1M mem BAR treated as 32-bit BAR\n");
break;
case PCI_BASE_ADDRESS_MEM_TYPE_64:
return pci_bar_mem64;
default:
dev_warn(&dev->dev,
"mem unknown type %x treated as 32-bit BAR\n",
mem_type);
break;
}
return pci_bar_mem32;
}

Expand Down Expand Up @@ -164,7 +180,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
l = 0;

if (type == pci_bar_unknown) {
type = decode_bar(res, l);
type = decode_bar(dev, res, l);
res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN;
if (type == pci_bar_io) {
l &= PCI_BASE_ADDRESS_IO_MASK;
Expand Down

0 comments on commit b2f11da

Please sign in to comment.