1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-16 15:11:52 +00:00

Handle hints for the atspeaker device.

Document same.
This commit is contained in:
Matthew N. Dodd 2002-10-28 02:00:09 +00:00
parent d506d5dc0e
commit c7f718ec6a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106070
3 changed files with 52 additions and 2 deletions

View File

@ -602,12 +602,36 @@ static dev_t atspeaker_dev;
static int
atspeaker_probe(device_t dev)
{
return(ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids));
int error;
error = ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids);
/* PnP match */
if (error == 0)
return (0);
/* No match */
if (error == ENXIO)
return (ENXIO);
/* Not configured by hints. */
if (strncmp(device_get_name(dev), "atspeaker", 9))
return (ENXIO);
device_set_desc(dev, "AT speaker");
return (0);
}
static int
atspeaker_attach(device_t dev)
{
if (atspeaker_dev) {
device_printf(dev, "Already attached!\n");
return (ENXIO);
}
atspeaker_dev = make_dev(&spkr_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"speaker");
return (0);

View File

@ -245,6 +245,8 @@ options CLK_USE_TSC_CALIBRATION
# MISCELLANEOUS DEVICES AND OPTIONS
device speaker #Play IBM BASIC-style noises out your speaker
hint.atspeaker.0.at="isa"
hint.atspeaker.0.port="0x61"
device gzip #Exec gzipped a.out's. REQUIRES COMPAT_AOUT!
device apm_saver # Requires APM

View File

@ -602,12 +602,36 @@ static dev_t atspeaker_dev;
static int
atspeaker_probe(device_t dev)
{
return(ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids));
int error;
error = ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids);
/* PnP match */
if (error == 0)
return (0);
/* No match */
if (error == ENXIO)
return (ENXIO);
/* Not configured by hints. */
if (strncmp(device_get_name(dev), "atspeaker", 9))
return (ENXIO);
device_set_desc(dev, "AT speaker");
return (0);
}
static int
atspeaker_attach(device_t dev)
{
if (atspeaker_dev) {
device_printf(dev, "Already attached!\n");
return (ENXIO);
}
atspeaker_dev = make_dev(&spkr_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"speaker");
return (0);