summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-10-09 00:40:17 +0000
committermsmith <msmith@FreeBSD.org>2000-10-09 00:40:17 +0000
commit62cf720766d52fe137a61d39461e57eef44bfc66 (patch)
tree311eed2fb8d49253facf779e14b30747b81fd611 /sys
parenta4f549597e4f1de22e1614caaad56127b519e00e (diff)
downloadFreeBSD-src-62cf720766d52fe137a61d39461e57eef44bfc66.zip
FreeBSD-src-62cf720766d52fe137a61d39461e57eef44bfc66.tar.gz
Resolve the inconsistency between "the number of resources of a particular
kind we can manage in a set of configurations" and "the number of resources of a particular kind that can be programmed into an ISA PnP adapter". Submitted by: Motomichi Matsuzaki <mzaki@e-mail.ne.jp> Submitted by: Hirokazu WATANABE <gwna@geocities.co.jp>
Diffstat (limited to 'sys')
-rw-r--r--sys/isa/isavar.h17
-rw-r--r--sys/isa/pnp.c28
2 files changed, 38 insertions, 7 deletions
diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h
index d8d6f1d..393f8a5 100644
--- a/sys/isa/isavar.h
+++ b/sys/isa/isavar.h
@@ -49,10 +49,21 @@ typedef void isa_config_cb(void *arg, struct isa_config *config, int enable);
#define ISA_ORDER_SPECULATIVE 1 /* legacy non-sensitive hardware */
#define ISA_ORDER_PNP 2 /* plug-and-play hardware */
+/*
+ * Limits on resources that we can manage
+ */
#define ISA_NPORT 50
-#define ISA_NMEM 8
-#define ISA_NIRQ 2
-#define ISA_NDRQ 2
+#define ISA_NMEM 50
+#define ISA_NIRQ 50
+#define ISA_NDRQ 50
+
+/*
+ * Limits on resources the hardware can actually handle
+ */
+#define ISA_PNP_NPORT 8
+#define ISA_PNP_NMEM 4
+#define ISA_PNP_NIRQ 2
+#define ISA_PNP_NDRQ 2
#define ISADMA_READ 0x00100000
#define ISADMA_WRITE 0
diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c
index 4c1993c..473e4d7 100644
--- a/sys/isa/pnp.c
+++ b/sys/isa/pnp.c
@@ -318,6 +318,26 @@ pnp_set_config(void *arg, struct isa_config *config, int enable)
pnp_write(PNP_SET_LDN, ldn);
/*
+ * Constrain the number of resources we will try to program
+ */
+ if (config->ic_nmem > ISA_PNP_NMEM) {
+ printf("too many ISA memory ranges (%d > %d)\n", config->ic_nmem, ISA_PNP_NMEM);
+ config->ic_nmem = ISA_PNP_NMEM;
+ }
+ if (config->ic_nport > ISA_PNP_NPORT) {
+ printf("too many ISA I/O ranges (%d > %d)\n", config->ic_nport, ISA_PNP_NPORT);
+ config->ic_nport = ISA_PNP_NPORT;
+ }
+ if (config->ic_nirq > ISA_PNP_NIRQ) {
+ printf("too many ISA IRQs (%d > %d)\n", config->ic_nirq, ISA_PNP_NIRQ);
+ config->ic_nirq = ISA_PNP_NIRQ;
+ }
+ if (config->ic_ndrq > ISA_PNP_NDRQ) {
+ printf("too many ISA DRQs (%d > %d)\n", config->ic_ndrq, ISA_PNP_NDRQ);
+ config->ic_ndrq = ISA_PNP_NDRQ;
+ }
+
+ /*
* Now program the resources.
*/
for (i = 0; i < config->ic_nmem; i++) {
@@ -330,7 +350,7 @@ pnp_set_config(void *arg, struct isa_config *config, int enable)
pnp_write(PNP_MEM_RANGE_HIGH(i), (size >> 16) & 0xff);
pnp_write(PNP_MEM_RANGE_LOW(i), (size >> 8) & 0xff);
}
- for (; i < ISA_NMEM; i++) {
+ for (; i < ISA_PNP_NMEM; i++) {
pnp_write(PNP_MEM_BASE_HIGH(i), 0);
pnp_write(PNP_MEM_BASE_LOW(i), 0);
pnp_write(PNP_MEM_RANGE_HIGH(i), 0);
@@ -342,7 +362,7 @@ pnp_set_config(void *arg, struct isa_config *config, int enable)
pnp_write(PNP_IO_BASE_HIGH(i), (start >> 8) & 0xff);
pnp_write(PNP_IO_BASE_LOW(i), (start >> 0) & 0xff);
}
- for (; i < ISA_NPORT; i++) {
+ for (; i < ISA_PNP_NPORT; i++) {
pnp_write(PNP_IO_BASE_HIGH(i), 0);
pnp_write(PNP_IO_BASE_LOW(i), 0);
}
@@ -352,7 +372,7 @@ pnp_set_config(void *arg, struct isa_config *config, int enable)
pnp_write(PNP_IRQ_LEVEL(i), irq);
pnp_write(PNP_IRQ_TYPE(i), 2); /* XXX */
}
- for (; i < ISA_NIRQ; i++) {
+ for (; i < ISA_PNP_NIRQ; i++) {
/*
* IRQ 0 is not a valid interrupt selection and
* represents no interrupt selection.
@@ -364,7 +384,7 @@ pnp_set_config(void *arg, struct isa_config *config, int enable)
int drq = ffs(config->ic_drqmask[i]) - 1;
pnp_write(PNP_DMA_CHANNEL(i), drq);
}
- for (; i < ISA_NDRQ; i++) {
+ for (; i < ISA_PNP_NDRQ; i++) {
/*
* DMA channel 4, the cascade channel is used to
* indicate no DMA channel is active.
OpenPOWER on IntegriCloud