Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Dec 2017 22:57:14 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
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
Message-ID:  <201712232257.vBNMvEHk023093@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
+#include <sys/endian.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
+#include <sys/sysctl.h>
 
 #include <machine/resource.h>
 
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712232257.vBNMvEHk023093>