From 7dcb3b12959a17fbb62e5fa18fb3cf2be4b403b3 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 23 Dec 2017 22:57:14 +0000 Subject: Warn when nonPNP ISA devices are attached in GENERIC that they are being removed from GENERIC in 12. Always print PNP info for ISA when it exists: it doesn't depend on ISAPNP. Add PNP ID to orm and vga to prevent us from warning about them since those devices aren't being removed from GENERIC. PNP devices will be removed from GENERIC too, but they will be automatically loaded, so need no warning. We don't warn for non-GENERIC kernels because people running them are presumed to know what they are doing. MFC After: 2 weeks --- sys/isa/isa_common.c | 34 ++++++++++++++++++++++++++++------ sys/isa/pnp.c | 20 -------------------- sys/isa/vga_isa.c | 1 + sys/x86/isa/orm.c | 1 + 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index f2bd9c36f4bf4..c95fe46655cc7 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -68,10 +68,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include #include @@ -499,7 +501,7 @@ isa_probe_children(device_t dev) struct isa_device *idev; device_t *children, child; struct isa_config *cfg; - int nchildren, i; + int nchildren, i, err; /* * Create all the non-hinted children by calling drivers' @@ -569,7 +571,11 @@ isa_probe_children(device_t dev) !TAILQ_EMPTY(&idev->id_configs)) continue; - device_probe_and_attach(child); + err = device_probe_and_attach(child); + if (err == 0 && idev->id_vendorid == 0 && + strcmp(kern_ident, "GENERIC") == 0) + device_printf(child, + "non-PNP ISA device will be removed from GENERIC in FreeBSD 12."); } /* @@ -637,10 +643,8 @@ isa_print_all_resources(device_t dev) retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%jd"); if (device_get_flags(dev)) retval += printf(" flags %#x", device_get_flags(dev)); -#ifdef ISAPNP if (idev->id_vendorid) retval += printf(" pnpid %s", pnp_eisaformat(idev->id_vendorid)); -#endif return (retval); } @@ -1030,13 +1034,11 @@ static int isa_child_pnpinfo_str(device_t bus, device_t child, char *buf, size_t buflen) { -#ifdef ISAPNP struct isa_device *idev = DEVTOISA(child); if (idev->id_vendorid) snprintf(buf, buflen, "pnpid=%s", pnp_eisaformat(idev->id_vendorid)); -#endif return (0); } @@ -1125,3 +1127,23 @@ isab_attach(device_t dev) return (bus_generic_attach(dev)); return (ENXIO); } + +char * +pnp_eisaformat(uint32_t id) +{ + uint8_t *data; + static char idbuf[8]; + const char hextoascii[] = "0123456789abcdef"; + + id = htole32(id); + data = (uint8_t *)&id; + idbuf[0] = '@' + ((data[0] & 0x7c) >> 2); + idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5)); + idbuf[2] = '@' + (data[1] & 0x1f); + idbuf[3] = hextoascii[(data[2] >> 4)]; + idbuf[4] = hextoascii[(data[2] & 0xf)]; + idbuf[5] = hextoascii[(data[3] >> 4)]; + idbuf[6] = hextoascii[(data[3] & 0xf)]; + idbuf[7] = 0; + return(idbuf); +} diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c index 99b2edc061213..c2c66e08c2084 100644 --- a/sys/isa/pnp.c +++ b/sys/isa/pnp.c @@ -103,26 +103,6 @@ static void pnp_send_initiation_key(void); static int pnp_get_serial(pnp_id *p); static int pnp_isolation_protocol(device_t parent); -char * -pnp_eisaformat(uint32_t id) -{ - uint8_t *data; - static char idbuf[8]; - const char hextoascii[] = "0123456789abcdef"; - - id = htole32(id); - data = (uint8_t *)&id; - idbuf[0] = '@' + ((data[0] & 0x7c) >> 2); - idbuf[1] = '@' + (((data[0] & 0x3) << 3) + ((data[1] & 0xe0) >> 5)); - idbuf[2] = '@' + (data[1] & 0x1f); - idbuf[3] = hextoascii[(data[2] >> 4)]; - idbuf[4] = hextoascii[(data[2] & 0xf)]; - idbuf[5] = hextoascii[(data[3] >> 4)]; - idbuf[6] = hextoascii[(data[3] & 0xf)]; - idbuf[7] = 0; - return(idbuf); -} - static void pnp_write(int d, u_char r) { diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index 524f927ba7617..b2e32a6c6c906 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -175,6 +175,7 @@ isavga_probe(device_t dev) adp.va_io_base, adp.va_io_size); bus_set_resource(dev, SYS_RES_MEMORY, 0, adp.va_mem_base, adp.va_mem_size); + isa_set_vendorid(dev, PNP_EISAID("PNP0900")); #if 0 isa_set_port(dev, adp.va_io_base); isa_set_portsize(dev, adp.va_io_size); diff --git a/sys/x86/isa/orm.c b/sys/x86/isa/orm.c index 6caee8838855b..14bfdc42f263d 100644 --- a/sys/x86/isa/orm.c +++ b/sys/x86/isa/orm.c @@ -156,6 +156,7 @@ orm_identify(driver_t* driver, device_t parent) device_set_desc(child, "ISA Option ROM"); else device_set_desc(child, "ISA Option ROMs"); + isa_set_vendorid(child, PNP_EISAID("PNP0C80")); } static int -- cgit v1.2.3