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
This commit is contained in:
Warner Losh 2017-12-23 22:57:14 +00:00
parent 6332b14887
commit 7dcb3b1295
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327120
4 changed files with 30 additions and 26 deletions

View File

@ -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);
}
@ -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);
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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