summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2002-10-28 02:00:09 +0000
committermdodd <mdodd@FreeBSD.org>2002-10-28 02:00:09 +0000
commit9c8acae4f7ca027b2b3315410db2952d7662dafd (patch)
tree9cef31e1794e2ba07a05237e71d6ee724c9e5bcd /sys
parenta7c01a175148fb913c153c7be981d7ce319fe855 (diff)
downloadFreeBSD-src-9c8acae4f7ca027b2b3315410db2952d7662dafd.zip
FreeBSD-src-9c8acae4f7ca027b2b3315410db2952d7662dafd.tar.gz
Handle hints for the atspeaker device.
Document same.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/speaker/spkr.c26
-rw-r--r--sys/i386/conf/NOTES2
-rw-r--r--sys/i386/isa/spkr.c26
3 files changed, 52 insertions, 2 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 522e6c6..e560fe6 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -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);
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index a65e29d..d863da6 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -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
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 522e6c6..e560fe6 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -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);
OpenPOWER on IntegriCloud