checks: Add bus checks for PCI buses

Add PCI bridge and device node checks. We identify PCI bridges with
'device_type = "pci"' as only PCI bridges should set that property. For
bridges, check that node name is pci or pcie, ranges and bus-range are
present, and #address-cells and #size-cells are correct.

For devices, check the reg property fields are correct for the first
element (the config address). Check that the unit address is formatted
corectly based on the reg property. Device unit addresses are in the
form DD or DD,F where DD is the device 0-0x1f and F is the function 0-7.
Also, check that the bus number is within the expected range defined by
bridge's bus-ranges.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rob Herring <robh@kernel.org>
[dwg: Added a missing check dependency]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Rob Herring 2017-03-20 09:44:16 -05:00 committed by David Gibson
parent 558cd81bdd
commit 33c3985226
2 changed files with 141 additions and 0 deletions

5
dtc.h
View file

@ -135,6 +135,10 @@ struct label {
struct label *next;
};
struct bus_type {
const char *name;
};
struct property {
bool deleted;
char *name;
@ -161,6 +165,7 @@ struct node {
int addr_cells, size_cells;
struct label *labels;
const struct bus_type *bus;
};
#define for_each_label_withdel(l0, l) \