Garbage collect the code for auto-loading modules based on ISAPNP IDs,

which is #if'ed out since nearly eight years, along with its outdated
database.

Agreed by:	ru (some months ago)
This commit is contained in:
marius 2007-01-07 22:25:45 +00:00
parent 198bd4c0fc
commit 1d842041db
2 changed files with 0 additions and 381 deletions

View File

@ -82,52 +82,6 @@ pnp_scan(int argc, char *argv[])
return(CMD_OK);
}
#if 0
/*
* Try to load outstanding modules (eg. after disk change)
*/
COMMAND_SET(pnpload, "pnpload", "load modules for PnP devices", pnp_load);
static int
pnp_load(int argc, char *argv[])
{
struct pnpinfo *pi;
char *modfname;
/* find anything? */
if (STAILQ_FIRST(&pnp_devices) != NULL) {
/* check for kernel, assign modules handled by static drivers there */
if (pnp_scankernel()) {
command_errmsg = "cannot load drivers until kernel loaded";
return(CMD_ERROR);
}
if (fname == NULL) {
/* default paths */
pnp_readconf("/boot/pnpdata.local");
pnp_readconf("/boot/pnpdata");
} else {
if (pnp_readconf(fname)) {
sprintf(command_errbuf, "can't read PnP information from '%s'", fname);
return(CMD_ERROR);
}
}
/* try to load any modules that have been nominated */
STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
/* Already loaded? */
if ((pi->pi_module != NULL) && (file_findfile(pi->pi_module, NULL) == NULL)) {
modfname = malloc(strlen(pi->pi_module) + 4);
sprintf(modfname, "%s.ko", pi->pi_module); /* XXX implicit knowledge of KLD module filenames */
if (mod_load(pi->pi_module, pi->pi_argc, pi->pi_argv))
printf("Could not load module '%s' for device '%s'\n", modfname, STAILQ_FIRST(&pi->pi_ident)->id_ident);
free(modfname);
}
}
}
return(CMD_OK);
}
#endif
/*
* Throw away anything we think we know about PnP devices.
*/
@ -142,159 +96,7 @@ pnp_discard(void)
pnp_freeinfo(pi);
}
}
#if 0
/*
* The PnP configuration database consists of a flat text file with
* entries one per line. Valid lines are:
*
* # <text>
*
* This line is a comment, and ignored.
*
* [<name>]
*
* Entries following this line are for devices connected to the
* bus <name>, At least one such entry must be encountered
* before identifiers are recognised.
*
* ident=<identifier> rev=<revision> module=<module> args=<arguments>
*
* This line describes an identifier:module mapping. The 'ident'
* and 'module' fields are required; the 'rev' field is currently
* ignored (but should be used), and the 'args' field must come
* last.
*
* Comments may be appended to lines; any character including or following
* '#' on a line is ignored.
*/
static int
pnp_readconf(char *path)
{
struct pnpinfo *pi;
struct pnpident *id;
int fd, line;
char lbuf[128], *currbus, *ident, *revision, *module, *args;
char *cp, *ep, *tp, c;
/* try to open the file */
if ((fd = open(path, O_RDONLY)) >= 0) {
line = 0;
currbus = NULL;
while (fgetstr(lbuf, sizeof(lbuf), fd) > 0) {
line++;
/* Find the first non-space character on the line */
for (cp = lbuf; (*cp != 0) && !isspace(*cp); cp++)
;
/* keep/discard? */
if ((*cp == 0) || (*cp == '#'))
continue;
/* cut trailing comment? */
if ((ep = strchr(cp, '#')) != NULL)
*ep = 0;
/* bus declaration? */
if (*cp == '[') {
if (((ep = strchr(cp, ']')) == NULL) || ((ep - cp) < 2)) {
printf("%s line %d: bad bus specification\n", path, line);
} else {
if (currbus != NULL)
free(currbus);
*ep = 0;
currbus = strdup(cp + 1);
}
continue;
}
/* XXX should we complain? */
if (currbus == NULL)
continue;
/* mapping */
for (ident = module = args = revision = NULL; *cp != 0;) {
/* discard leading whitespace */
if (isspace(*cp)) {
cp++;
continue;
}
/* scan for terminator, separator */
for (ep = cp; (*ep != 0) && (*ep != '=') && !isspace(*ep); ep++)
;
if (*ep == '=') {
*ep = 0;
for (tp = ep + 1; (*tp != 0) && !isspace(*tp); tp++)
;
c = *tp;
*tp = 0;
if ((ident == NULL) && !strcmp(cp, "ident")) {
ident = ep + 1;
} else if ((revision == NULL) && !strcmp(cp, "revision")) {
revision = ep + 1;
} else if ((args == NULL) && !strcmp(cp, "args")) {
*tp = c;
while (*tp != 0) /* skip to end of string */
tp++;
args = ep + 1;
} else {
/* XXX complain? */
}
cp = tp;
continue;
}
/* it's garbage or a keyword - ignore it for now */
cp = ep;
}
/* we must have at least ident and module set to be interesting */
if ((ident == NULL) || (module == NULL))
continue;
/*
* Loop looking for module/bus that might match this, but aren't already
* assigned.
* XXX no revision parse/test here yet.
*/
STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
/* no driver assigned, bus matches OK */
if ((pi->pi_module == NULL) &&
!strcmp(pi->pi_handler->pp_name, currbus)) {
/* scan idents, take first match */
STAILQ_FOREACH(id, &pi->pi_ident, id_link)
if (!strcmp(id->id_ident, ident))
break;
/* find a match? */
if (id != NULL) {
if (args != NULL)
if (parse(&pi->pi_argc, &pi->pi_argv, args)) {
printf("%s line %d: bad arguments\n", path, line);
continue;
}
pi->pi_module = strdup(module);
printf("use module '%s' for %s:%s\n", module, pi->pi_handler->pp_name, id->id_ident);
}
}
}
}
close(fd);
}
return(CMD_OK);
}
static int
pnp_scankernel(void)
{
return(CMD_OK);
}
#endif
/*
* Add a unique identifier to (pi)
*/

View File

@ -1,183 +0,0 @@
#
# $FreeBSD$
#
# This file contains the system default Plug-and-Play data. It is
# derived from a number of sources, including:
#
# - The Microsoft "Windows Generic Device IDs" document
#
[pci]
######################################################################
# PCI devices.
#
# Required attributes:
#
# ident= PCI identifier in the form 0xDDDDVVVV where
# 'VVVV' is the 4-digit hex form of the vendor ID and
# 'DDDD' is the 4-digit hex form of the device ID.
# or
#
# vendor= 0xVVVV where 'VVVV' is above
# name= Vendor name
vendor=0x8086 name=Intel
[isa]
######################################################################
# ISA PnP devices
#
# Required attributes:
#
# ident= ISA PnP identifier in the form AAAIIRR where
# 'AAA' is the EISA vendor ID, 'II' is the device ID
# and 'RR' is the revision ID.
# or
#
# vendor= AAA to register just a vendor name.
# name= Vendor name
#
# Optional attributes:
#
# module= Support module identifier.
#
# args= Arguments to pass to the support module.
#
vendor=CSC name=Crystal Semiconductor
vendor=CTL name=Creative Labs
vendor=PNP name=Generic
# From "Windows Generic Device IDs"
#
# --Parallel Devices--
ident=PNP0400 module=lpt # Standard LPT printer port
ident=PNP0401 module=lpt # ECP printer port
# --Serial Devices--
ident=PNP0500 module=sio # Standard PC COM port
ident=PNP0501 module=sio # 16550A-compatible COM port
ident=PNP0502 module=sio # Multiport serial device (non-intelligent 16550)
# --Disk Controllers--
ident=PNP0600 module=wd # Generic ESDI/IDE/ATA compatible hard disk controller
ident=PNP0603 module=wd # Generic IDE supporting Microsoft Device Bay Specification
ident=PNP0700 module=fd # PC standard floppy disk controller
ident=PNP0701 module=fd # Standard floppy controller supporting MS Device Bay Spec
# --Peripheral Buses--
ident=PNP0A00 module=isa # ISA Bus
ident=PNP0A01 module=eisa # EISA Bus
ident=PNP0A03 module=pci # PCI Bus
ident=PNP0A04 module=isa # VESA/VL Bus
# -- Real Time Clock, BIOS, System board devices--
ident=PNP0C04 module=npx # Math Coprocessor
ident=PNP0C05 module=apm # APM BIOS (Version independent)
# --PCMCIA Controller Chipsets--
ident=PNP0E00 module=pcic # Intel 82365-Compatible PCMCIA Controller
ident=PNP0E01 module=pcic # Cirrus Logic CL-PD6720 PCMCIA Controller
ident=PNP0E02 module=pcic # VLSI VL82C146 PCMCIA Controller
ident=PNP0E03 module=pcic # Intel 82365-compatible CardBus controller
# --Network Adapters--
ident=PNP8001 module=ed # Novell/Anthem NE3200
ident=PNP8004 # Compaq NE3200
ident=PNP80d3 module=ed # Novell/Anthem NE1000
ident=PNP80d4 module=ed # Novell/Anthem NE2000
ident=PNP80d5 module=ed # NE1000 Compatible
ident=PNP80d6 module=ed # NE2000 Compatible
ident=PNP80d8 module=lnc # Novell/Anthem NE2100
ident=PNP80e9 module=le # DEC (DE200) EtherWorks Turbo
ident=PNP80eb module=le # DEC (DE201) EtherWorks Turbo/TP
ident=PNP80ec module=le # DEC (DE202) EtherWorks Turbo/TP_BNC
ident=PNP80f1 module=eg # 3Com EtherLink Plus
ident=PNP80f3 module=ed # 3Com EtherLink II or IITP (8 or 16-bit)
ident=PNP80f6 module=ed # 3Com EtherLink 16
ident=PNP80f7 module=ep # 3Com EtherLink III
ident=PNP80f8 module=ep # 3Com Generic Etherlink Plug and Play Device
ident=PNP8123 module=ed # SMC StarCard PLUS (WD/8003S)
ident=PNP8124 module=ed # SMC StarCard PLUS With On Board Hub (WD/8003SH)
ident=PNP8125 module=ed # SMC EtherCard PLUS (WD/8003E)
ident=PNP8126 module=ed # SMC EtherCard PLUS With Boot ROM Socket (WD/8003EBT)
ident=PNP8127 module=ed # SMC EtherCard PLUS With Boot ROM Socket (WD/8003EB)
ident=PNP8128 module=ed # SMC EtherCard PLUS TP (WD/8003WT)
ident=PNP812a module=ed # SMC EtherCard PLUS 16 With Boot ROM Socket (WD/8013EBT)
ident=PNP812d module=ie # Intel EtherExpress 16 or 16TP
ident=PNP8137 module=ed # Artisoft AE-1
ident=PNP8138 module=ed # Artisoft AE-2 or AE-3
ident=PNP8158 module=ed # HP PC LAN Adapter/16 TP Plus (HP27247B)
ident=PNP8159 module=ed # HP PC LAN Adapter/16 TL Plus (HP27252)
ident=PNP81c3 module=ed # SMC EtherCard PLUS Elite (WD/8003EP)
ident=PNP81c4 module=ed # SMC EtherCard PLUS 10T (WD/8003W)
ident=PNP81c5 module=ed # SMC EtherCard PLUS Elite 16 (WD/8013EP)
ident=PNP81c6 module=ed # SMC EtherCard PLUS Elite 16T (WD/8013W)
ident=PNP81c7 module=ed # SMC EtherCard PLUS Elite 16 Combo (WD/8013EW or 8013EWC)
ident=PNP81c8 module=ed # SMC EtherElite Ultra 16
ident=PNP820a module=ed # Zenith Data Systems NE2000-Compatible
ident=PNP8231 module=lnc # Advanced Micro Devices AM2100/AM1500T
ident=PNP828C module=lnc # AMD PCNet Family cards
ident=PNP828D module=lnc # AMD PCNet32 (VL version)
ident=PNP8323 module=ed # SMC EtherCard (All Types except 8013/A)
ident=PNP8390 module=ed # Generic network adapter
# --SCSI, Proprietary CD Adapters--
ident=PNPA003 module=matcd # Panasonic proprietary CD-ROM adapter (SBPro/SB16)
ident=PNPA02B module=scd # Sony proprietary CD-ROM controller
ident=PNPA030 module=mcd # Mitsumi LU-005 Single Speed CD-ROM controller + drive
ident=PNPA031 module=mcd # Mitsumi FX-001 Single Speed CD-ROM controller + drive
ident=PNPA032 module=mcd # Mitsumi FX-001 Double Speed CD-ROM controller + drive
# --Sound/Video-capture, multimedia--
ident=PNPB000 module=pcm # Sound Blaster 1.5 sound device
ident=PNPB001 module=pcm # Sound Blaster 2.0 sound device
ident=PNPB002 module=pcm # Sound Blaster Pro sound device
ident=PNPB003 module=pcm # Sound Blaster 16 sound device
ident=PNPB007 module=pcm # Microsoft Windows Sound System-compatible sound device
ident=PNPB009 module=pcm # Plug and Play Microsoft Windows Sound System Device
ident=PNPB020 module=pcm # Yamaha OPL3-compatible FM synthesizer device
ident=PNPB02F module=joy # Joystick/Game port
# --Compatibility with early device ID list--
ident=PNP0802 module=pcm # Microsoft Sound System compatible device (obsolete, use PNPB0xx instead)
# --Modems--
ident=PNPC000 module=sio # Compaq 14400 Modem (TBD)
ident=PNPC001 module=sio # Compaq 2400/9600 Modem (TBD)
# Vendor supplied IDs.
# --Parallel Devices--
# --Serial Devices--
# --Disk Controllers--
# --Peripheral Buses--
# --Real Time Clock, BIOS, System board devices--
# --PCMCIA Controller Chipsets--
# --Network Adapters--
ident=CSC6040 module=cs # Crystal Semiconductor CS8920
# --SCSI, Proprietary CD Adapters--
# --Sound/Video-capture, multimedia--
# --Modems--
[com]
######################################################################
# COM PnP devices
#
[lpt]
######################################################################
# LPT PnP devices
#