From owner-svn-src-head@freebsd.org Sat Dec 23 22:57:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB6C0EA8459; Sat, 23 Dec 2017 22:57:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 853087A16B; Sat, 23 Dec 2017 22:57:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBNMvEFM023098; Sat, 23 Dec 2017 22:57:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBNMvEHk023093; Sat, 23 Dec 2017 22:57:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201712232257.vBNMvEHk023093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Dec 2017 22:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327120 - in head/sys: isa x86/isa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: isa x86/isa X-SVN-Commit-Revision: 327120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Dec 2017 22:57:15 -0000 Author: imp Date: Sat Dec 23 22:57:14 2017 New Revision: 327120 URL: https://svnweb.freebsd.org/changeset/base/327120 Log: 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 Modified: head/sys/isa/isa_common.c head/sys/isa/pnp.c head/sys/isa/vga_isa.c head/sys/x86/isa/orm.c Modified: head/sys/isa/isa_common.c ============================================================================== --- head/sys/isa/isa_common.c Sat Dec 23 21:41:32 2017 (r327119) +++ head/sys/isa/isa_common.c Sat Dec 23 22:57:14 2017 (r327120) @@ -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); } @@ -1124,4 +1126,24 @@ isab_attach(device_t dev) if (child != NULL) 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); } Modified: head/sys/isa/pnp.c ============================================================================== --- head/sys/isa/pnp.c Sat Dec 23 21:41:32 2017 (r327119) +++ head/sys/isa/pnp.c Sat Dec 23 22:57:14 2017 (r327120) @@ -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) { Modified: head/sys/isa/vga_isa.c ============================================================================== --- head/sys/isa/vga_isa.c Sat Dec 23 21:41:32 2017 (r327119) +++ head/sys/isa/vga_isa.c Sat Dec 23 22:57:14 2017 (r327120) @@ -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); Modified: head/sys/x86/isa/orm.c ============================================================================== --- head/sys/x86/isa/orm.c Sat Dec 23 21:41:32 2017 (r327119) +++ head/sys/x86/isa/orm.c Sat Dec 23 22:57:14 2017 (r327120) @@ -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