nvme_manage: accept more PCI address formats
Change-Id: Ie8177b320271c9e7cb9b2216dbdd9c3c11f39579 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
73b0afa867
commit
e3cabfafd7
@ -244,7 +244,19 @@ get_controller(void)
|
||||
p++;
|
||||
}
|
||||
|
||||
sscanf(p, "%x:%x:%x.%x", &domain, &bus, &devid, &function);
|
||||
if (sscanf(p, "%x:%x:%x.%x", &domain, &bus, &devid, &function) == 4) {
|
||||
/* Matched a full address - all variables are initialized */
|
||||
} else if (sscanf(p, "%x:%x:%x", &domain, &bus, &devid) == 3) {
|
||||
function = 0;
|
||||
} else if (sscanf(p, "%x:%x.%x", &bus, &devid, &function) == 3) {
|
||||
domain = 0;
|
||||
} else if (sscanf(p, "%x:%x", &bus, &devid) == 2) {
|
||||
domain = 0;
|
||||
function = 0;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pci_addr = (uint64_t)domain << 24;
|
||||
pci_addr |= (uint64_t)bus << 16;
|
||||
pci_addr |= (uint64_t)devid << 8;
|
||||
|
Loading…
x
Reference in New Issue
Block a user