OSDN Git Service

PCI: Fail safely if we can't handle BARs larger than 4GB
authorBjorn Helgaas <bhelgaas@google.com>
Mon, 14 Apr 2014 21:25:54 +0000 (15:25 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 23 May 2014 16:47:19 +0000 (10:47 -0600)
commit23b13bc76f359e99140baf083dc44314f4eb1b87
tree4ad84a406118d70534b6b199e78646b052e57df9
parentc96ec95315b9242ec423b8348984c394d27a8135
PCI: Fail safely if we can't handle BARs larger than 4GB

We can only handle BARs larger than 4GB if both dma_addr_t and
resource_size_t are 64 bits wide.  If dma_addr_t is 32 bits, we can't
represent all the bus addresses, and if resource_size_t is 32 bits, we
can't represent all the CPU addresses.

Previously we cleared res->flags (at "fail:") for resources that were too
large.  That means we think the BAR doesn't exist at all, which in turn
means that we could enable the device even though we can't keep track of
where the BAR is and we can't make sure it doesn't overlap something else.

This preserves the type flags (MEM/IO) so we can keep from enabling the
device.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c