Handle misconfigured/nonexistent pcidev for comconsole instead of BTX panic.

PR:		203319
Reviewed by:	imp jhb
MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D13776
This commit is contained in:
sbruno 2018-01-05 23:50:50 +00:00
parent 21828eb45a
commit f3b156e370

View File

@ -267,6 +267,16 @@ comc_pcidev_handle(uint32_t locator)
printf("Cannot read bar at 0x%x\n", locator);
return (CMD_ERROR);
}
/*
* biospci_read_config() sets port == 0xffffffff if the pcidev
* isn't found on the bus. Check for 0xffffffff and return to not
* panic in BTX.
*/
if (port == 0xffffffff) {
printf("Cannot find specified pcidev\n");
return (CMD_ERROR);
}
if (!PCI_BAR_IO(port)) {
printf("Memory bar at 0x%x\n", locator);
return (CMD_ERROR);