Page MenuHomeFreeBSD

D54954.id181322.diff
No OneTemporary

D54954.id181322.diff

diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c
--- a/sys/x86/isa/atrtc.c
+++ b/sys/x86/isa/atrtc.c
@@ -59,6 +59,9 @@
#include <machine/md_var.h>
#endif
+/* PC/AT legacy RTC IRQ. */
+#define ATRTC_IRQ 8
+
/* tunable to detect a power loss of the rtc */
static bool atrtc_power_lost = false;
SYSCTL_BOOL(_machdep, OID_AUTO, atrtc_power_lost, CTLFLAG_RD, &atrtc_power_lost,
@@ -460,6 +463,13 @@
(atrtc_enabled == 0))
return (ENXIO);
+ /*
+ * There is only one RTC. If both ACPI and legacy ISA probing
+ * enumerate it, only unit 0 is allowed to attach.
+ */
+ if (device_get_unit(dev) != 0)
+ return (ENXIO);
+
result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids);
/* ENOENT means no PnP-ID, device is hinted. */
if (result == ENOENT) {
@@ -480,8 +490,9 @@
sc = device_get_softc(dev);
sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid,
IO_RTC, IO_RTC + 1, 2, RF_ACTIVE);
- if (sc->port_res == NULL)
- device_printf(dev, "Warning: Couldn't map I/O.\n");
+ if (sc->port_res == NULL && bootverbose)
+ device_printf(dev, "Could not map I/O ports 0x%x-0x%x "
+ "(using direct access)\n", IO_RTC, IO_RTC + 1);
atrtc_start();
clock_register(dev, 1000000);
bzero(&sc->et, sizeof(struct eventtimer));
@@ -490,12 +501,15 @@
"clock", &i) != 0 || i != 0)) {
sc->intr_rid = 0;
while (bus_get_resource(dev, SYS_RES_IRQ, sc->intr_rid,
- &s, NULL) == 0 && s != 8)
+ &s, NULL) == 0 && s != ATRTC_IRQ)
sc->intr_rid++;
sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
- &sc->intr_rid, 8, 8, 1, RF_ACTIVE);
+ &sc->intr_rid, ATRTC_IRQ, ATRTC_IRQ, 1, RF_ACTIVE);
if (sc->intr_res == NULL) {
- device_printf(dev, "Can't map interrupt.\n");
+ if (bootverbose)
+ device_printf(dev, "Could not allocate IRQ %d "
+ "(event timer unavailable)\n", ATRTC_IRQ);
+ /* RTC still works for timekeeping without event timer */
return (0);
} else if ((bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK,
rtc_intr, NULL, sc, &sc->intr_handler))) {

File Metadata

Mime Type
text/plain
Expires
Tue, Jul 14, 11:21 PM (11 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34768604
Default Alt Text
D54954.id181322.diff (2 KB)

Event Timeline