aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/isapnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/isapnp')
-rw-r--r--drivers/pnp/isapnp/core.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 2c925b7cd93e..257f5d827d83 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -88,6 +88,15 @@ MODULE_LICENSE("GPL");
88#define _LTAG_MEM32RANGE 0x85 88#define _LTAG_MEM32RANGE 0x85
89#define _LTAG_FIXEDMEM32RANGE 0x86 89#define _LTAG_FIXEDMEM32RANGE 0x86
90 90
91/*
92 * Sizes of ISAPNP logical device configuration register sets.
93 * See PNP-ISA-v1.0a.pdf, Appendix A.
94 */
95#define ISAPNP_MAX_MEM 4
96#define ISAPNP_MAX_PORT 8
97#define ISAPNP_MAX_IRQ 2
98#define ISAPNP_MAX_DMA 2
99
91static unsigned char isapnp_checksum_value; 100static unsigned char isapnp_checksum_value;
92static DEFINE_MUTEX(isapnp_cfg_mutex); 101static DEFINE_MUTEX(isapnp_cfg_mutex);
93static int isapnp_csn_count; 102static int isapnp_csn_count;
@@ -945,14 +954,14 @@ static int isapnp_read_resources(struct pnp_dev *dev,
945 954
946 dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); 955 dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
947 if (dev->active) { 956 if (dev->active) {
948 for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) { 957 for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) {
949 ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); 958 ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1));
950 if (!ret) 959 if (!ret)
951 continue; 960 continue;
952 res->port_resource[tmp].start = ret; 961 res->port_resource[tmp].start = ret;
953 res->port_resource[tmp].flags = IORESOURCE_IO; 962 res->port_resource[tmp].flags = IORESOURCE_IO;
954 } 963 }
955 for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { 964 for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) {
956 ret = 965 ret =
957 isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; 966 isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8;
958 if (!ret) 967 if (!ret)
@@ -960,7 +969,7 @@ static int isapnp_read_resources(struct pnp_dev *dev,
960 res->mem_resource[tmp].start = ret; 969 res->mem_resource[tmp].start = ret;
961 res->mem_resource[tmp].flags = IORESOURCE_MEM; 970 res->mem_resource[tmp].flags = IORESOURCE_MEM;
962 } 971 }
963 for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { 972 for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) {
964 ret = 973 ret =
965 (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 974 (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >>
966 8); 975 8);
@@ -970,7 +979,7 @@ static int isapnp_read_resources(struct pnp_dev *dev,
970 res->irq_resource[tmp].end = ret; 979 res->irq_resource[tmp].end = ret;
971 res->irq_resource[tmp].flags = IORESOURCE_IRQ; 980 res->irq_resource[tmp].flags = IORESOURCE_IRQ;
972 } 981 }
973 for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { 982 for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) {
974 ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); 983 ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp);
975 if (ret == 4) 984 if (ret == 4)
976 continue; 985 continue;
@@ -1002,14 +1011,14 @@ static int isapnp_set_resources(struct pnp_dev *dev,
1002 isapnp_cfg_begin(dev->card->number, dev->number); 1011 isapnp_cfg_begin(dev->card->number, dev->number);
1003 dev->active = 1; 1012 dev->active = 1;
1004 for (tmp = 0; 1013 for (tmp = 0;
1005 tmp < PNP_MAX_PORT 1014 tmp < ISAPNP_MAX_PORT
1006 && (res->port_resource[tmp]. 1015 && (res->port_resource[tmp].
1007 flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; 1016 flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO;
1008 tmp++) 1017 tmp++)
1009 isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), 1018 isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1),
1010 res->port_resource[tmp].start); 1019 res->port_resource[tmp].start);
1011 for (tmp = 0; 1020 for (tmp = 0;
1012 tmp < PNP_MAX_IRQ 1021 tmp < ISAPNP_MAX_IRQ
1013 && (res->irq_resource[tmp]. 1022 && (res->irq_resource[tmp].
1014 flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; 1023 flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ;
1015 tmp++) { 1024 tmp++) {
@@ -1019,14 +1028,14 @@ static int isapnp_set_resources(struct pnp_dev *dev,
1019 isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); 1028 isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq);
1020 } 1029 }
1021 for (tmp = 0; 1030 for (tmp = 0;
1022 tmp < PNP_MAX_DMA 1031 tmp < ISAPNP_MAX_DMA
1023 && (res->dma_resource[tmp]. 1032 && (res->dma_resource[tmp].
1024 flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; 1033 flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA;
1025 tmp++) 1034 tmp++)
1026 isapnp_write_byte(ISAPNP_CFG_DMA + tmp, 1035 isapnp_write_byte(ISAPNP_CFG_DMA + tmp,
1027 res->dma_resource[tmp].start); 1036 res->dma_resource[tmp].start);
1028 for (tmp = 0; 1037 for (tmp = 0;
1029 tmp < PNP_MAX_MEM 1038 tmp < ISAPNP_MAX_MEM
1030 && (res->mem_resource[tmp]. 1039 && (res->mem_resource[tmp].
1031 flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; 1040 flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM;
1032 tmp++) 1041 tmp++)