diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:29 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:27 -0400 |
commit | 06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (patch) | |
tree | b2b2cc2ac421091be7949315b6ffde6426466700 /drivers | |
parent | 02d83b5da3efa3c278ce87db2637f3dd6837166d (diff) |
PNP: remove pnp_resource_table references from resource decoders
This removes a few more references to the pnp_resource_table.
No functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 95 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 88 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 82 |
3 files changed, 140 insertions, 125 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 4407e844b5ea..a62ecc6f13bd 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -931,7 +931,7 @@ EXPORT_SYMBOL(isapnp_write_byte); | |||
931 | 931 | ||
932 | static int isapnp_read_resources(struct pnp_dev *dev) | 932 | static int isapnp_read_resources(struct pnp_dev *dev) |
933 | { | 933 | { |
934 | struct pnp_resource_table *res = dev->res; | 934 | struct resource *res; |
935 | int tmp, ret; | 935 | int tmp, ret; |
936 | 936 | ||
937 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); | 937 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); |
@@ -940,16 +940,18 @@ static int isapnp_read_resources(struct pnp_dev *dev) | |||
940 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); | 940 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); |
941 | if (!ret) | 941 | if (!ret) |
942 | continue; | 942 | continue; |
943 | res->port_resource[tmp].start = ret; | 943 | res = pnp_get_resource(dev, IORESOURCE_IO, tmp); |
944 | res->port_resource[tmp].flags = IORESOURCE_IO; | 944 | res->start = ret; |
945 | res->flags = IORESOURCE_IO; | ||
945 | } | 946 | } |
946 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { | 947 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
947 | ret = | 948 | ret = |
948 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; | 949 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; |
949 | if (!ret) | 950 | if (!ret) |
950 | continue; | 951 | continue; |
951 | res->mem_resource[tmp].start = ret; | 952 | res = pnp_get_resource(dev, IORESOURCE_MEM, tmp); |
952 | res->mem_resource[tmp].flags = IORESOURCE_MEM; | 953 | res->start = ret; |
954 | res->flags = IORESOURCE_MEM; | ||
953 | } | 955 | } |
954 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { | 956 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
955 | ret = | 957 | ret = |
@@ -957,17 +959,17 @@ static int isapnp_read_resources(struct pnp_dev *dev) | |||
957 | 8); | 959 | 8); |
958 | if (!ret) | 960 | if (!ret) |
959 | continue; | 961 | continue; |
960 | res->irq_resource[tmp].start = | 962 | res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp); |
961 | res->irq_resource[tmp].end = ret; | 963 | res->start = res->end = ret; |
962 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; | 964 | res->flags = IORESOURCE_IRQ; |
963 | } | 965 | } |
964 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { | 966 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
965 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); | 967 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); |
966 | if (ret == 4) | 968 | if (ret == 4) |
967 | continue; | 969 | continue; |
968 | res->dma_resource[tmp].start = | 970 | res = pnp_get_resource(dev, IORESOURCE_DMA, tmp); |
969 | res->dma_resource[tmp].end = ret; | 971 | res->start = res->end = ret; |
970 | res->dma_resource[tmp].flags = IORESOURCE_DMA; | 972 | res->flags = IORESOURCE_DMA; |
971 | } | 973 | } |
972 | } | 974 | } |
973 | return 0; | 975 | return 0; |
@@ -987,52 +989,47 @@ static int isapnp_get_resources(struct pnp_dev *dev) | |||
987 | 989 | ||
988 | static int isapnp_set_resources(struct pnp_dev *dev) | 990 | static int isapnp_set_resources(struct pnp_dev *dev) |
989 | { | 991 | { |
990 | struct pnp_resource_table *res = dev->res; | 992 | struct resource *res; |
991 | int tmp; | 993 | int tmp; |
992 | 994 | ||
993 | dev_dbg(&dev->dev, "set resources\n"); | 995 | dev_dbg(&dev->dev, "set resources\n"); |
994 | isapnp_cfg_begin(dev->card->number, dev->number); | 996 | isapnp_cfg_begin(dev->card->number, dev->number); |
995 | dev->active = 1; | 997 | dev->active = 1; |
996 | for (tmp = 0; | 998 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { |
997 | tmp < ISAPNP_MAX_PORT | 999 | res = pnp_get_resource(dev, IORESOURCE_IO, tmp); |
998 | && (res->port_resource[tmp]. | 1000 | if (pnp_resource_valid(res)) { |
999 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; | 1001 | dev_dbg(&dev->dev, " set io %d to %#llx\n", |
1000 | tmp++) { | 1002 | tmp, (unsigned long long) res->start); |
1001 | dev_dbg(&dev->dev, " set io %d to %#llx\n", | 1003 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), |
1002 | tmp, (unsigned long long) res->port_resource[tmp].start); | 1004 | res->start); |
1003 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), | 1005 | } |
1004 | res->port_resource[tmp].start); | ||
1005 | } | 1006 | } |
1006 | for (tmp = 0; | 1007 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
1007 | tmp < ISAPNP_MAX_IRQ | 1008 | res = pnp_get_resource(dev, IORESOURCE_IRQ, tmp); |
1008 | && (res->irq_resource[tmp]. | 1009 | if (pnp_resource_valid(res)) { |
1009 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; | 1010 | int irq = res->start; |
1010 | tmp++) { | 1011 | if (irq == 2) |
1011 | int irq = res->irq_resource[tmp].start; | 1012 | irq = 9; |
1012 | if (irq == 2) | 1013 | dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); |
1013 | irq = 9; | 1014 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); |
1014 | dev_dbg(&dev->dev, " set irq %d to %d\n", tmp, irq); | 1015 | } |
1015 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); | ||
1016 | } | 1016 | } |
1017 | for (tmp = 0; | 1017 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
1018 | tmp < ISAPNP_MAX_DMA | 1018 | res = pnp_get_resource(dev, IORESOURCE_DMA, tmp); |
1019 | && (res->dma_resource[tmp]. | 1019 | if (pnp_resource_valid(res)) { |
1020 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; | 1020 | dev_dbg(&dev->dev, " set dma %d to %lld\n", |
1021 | tmp++) { | 1021 | tmp, (unsigned long long) res->start); |
1022 | dev_dbg(&dev->dev, " set dma %d to %lld\n", | 1022 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, res->start); |
1023 | tmp, (unsigned long long) res->dma_resource[tmp].start); | 1023 | } |
1024 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, | ||
1025 | res->dma_resource[tmp].start); | ||
1026 | } | 1024 | } |
1027 | for (tmp = 0; | 1025 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
1028 | tmp < ISAPNP_MAX_MEM | 1026 | res = pnp_get_resource(dev, IORESOURCE_MEM, tmp); |
1029 | && (res->mem_resource[tmp]. | 1027 | if (pnp_resource_valid(res)) { |
1030 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; | 1028 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", |
1031 | tmp++) { | 1029 | tmp, (unsigned long long) res->start); |
1032 | dev_dbg(&dev->dev, " set mem %d to %#llx\n", | 1030 | isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), |
1033 | tmp, (unsigned long long) res->mem_resource[tmp].start); | 1031 | (res->start >> 8) & 0xffff); |
1034 | isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3), | 1032 | } |
1035 | (res->mem_resource[tmp].start >> 8) & 0xffff); | ||
1036 | } | 1033 | } |
1037 | /* FIXME: We aren't handling 32bit mems properly here */ | 1034 | /* FIXME: We aren't handling 32bit mems properly here */ |
1038 | isapnp_activate(dev->number); | 1035 | isapnp_activate(dev->number); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2669518b4795..3634f2f3f745 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -82,8 +82,8 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, | |||
82 | u32 gsi, int triggering, | 82 | u32 gsi, int triggering, |
83 | int polarity, int shareable) | 83 | int polarity, int shareable) |
84 | { | 84 | { |
85 | struct pnp_resource_table *res = dev->res; | 85 | struct resource *res; |
86 | int i = 0; | 86 | int i; |
87 | int irq; | 87 | int irq; |
88 | int p, t; | 88 | int p, t; |
89 | static unsigned char warned; | 89 | static unsigned char warned; |
@@ -91,9 +91,11 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, | |||
91 | if (!valid_IRQ(gsi)) | 91 | if (!valid_IRQ(gsi)) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && | 94 | for (i = 0; i < PNP_MAX_IRQ; i++) { |
95 | i < PNP_MAX_IRQ) | 95 | res = pnp_get_resource(dev, IORESOURCE_IRQ, i); |
96 | i++; | 96 | if (!pnp_resource_valid(res)) |
97 | break; | ||
98 | } | ||
97 | if (i >= PNP_MAX_IRQ) { | 99 | if (i >= PNP_MAX_IRQ) { |
98 | if (!warned) { | 100 | if (!warned) { |
99 | printk(KERN_WARNING "pnpacpi: exceeded the max number" | 101 | printk(KERN_WARNING "pnpacpi: exceeded the max number" |
@@ -119,16 +121,16 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, | |||
119 | } | 121 | } |
120 | } | 122 | } |
121 | 123 | ||
122 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 124 | res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
123 | res->irq_resource[i].flags |= irq_flags(triggering, polarity, shareable); | 125 | res->flags |= irq_flags(triggering, polarity, shareable); |
124 | irq = acpi_register_gsi(gsi, triggering, polarity); | 126 | irq = acpi_register_gsi(gsi, triggering, polarity); |
125 | if (irq < 0) { | 127 | if (irq < 0) { |
126 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 128 | res->flags |= IORESOURCE_DISABLED; |
127 | return; | 129 | return; |
128 | } | 130 | } |
129 | 131 | ||
130 | res->irq_resource[i].start = irq; | 132 | res->start = irq; |
131 | res->irq_resource[i].end = irq; | 133 | res->end = irq; |
132 | pcibios_penalize_isa_irq(irq, 1); | 134 | pcibios_penalize_isa_irq(irq, 1); |
133 | } | 135 | } |
134 | 136 | ||
@@ -178,22 +180,24 @@ static int dma_flags(int type, int bus_master, int transfer) | |||
178 | static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev, | 180 | static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev, |
179 | u32 dma, int flags) | 181 | u32 dma, int flags) |
180 | { | 182 | { |
181 | struct pnp_resource_table *res = dev->res; | 183 | struct resource *res; |
182 | int i = 0; | 184 | int i; |
183 | static unsigned char warned; | 185 | static unsigned char warned; |
184 | 186 | ||
185 | while (i < PNP_MAX_DMA && | 187 | for (i = 0; i < PNP_MAX_DMA; i++) { |
186 | !(res->dma_resource[i].flags & IORESOURCE_UNSET)) | 188 | res = pnp_get_resource(dev, IORESOURCE_DMA, i); |
187 | i++; | 189 | if (!pnp_resource_valid(res)) |
190 | break; | ||
191 | } | ||
188 | if (i < PNP_MAX_DMA) { | 192 | if (i < PNP_MAX_DMA) { |
189 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag | 193 | res->flags = IORESOURCE_DMA; // Also clears _UNSET flag |
190 | res->dma_resource[i].flags |= flags; | 194 | res->flags |= flags; |
191 | if (dma == -1) { | 195 | if (dma == -1) { |
192 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; | 196 | res->flags |= IORESOURCE_DISABLED; |
193 | return; | 197 | return; |
194 | } | 198 | } |
195 | res->dma_resource[i].start = dma; | 199 | res->start = dma; |
196 | res->dma_resource[i].end = dma; | 200 | res->end = dma; |
197 | } else if (!warned) { | 201 | } else if (!warned) { |
198 | printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA " | 202 | printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA " |
199 | "resources: %d \n", PNP_MAX_DMA); | 203 | "resources: %d \n", PNP_MAX_DMA); |
@@ -204,23 +208,25 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev, | |||
204 | static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, | 208 | static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, |
205 | u64 io, u64 len, int io_decode) | 209 | u64 io, u64 len, int io_decode) |
206 | { | 210 | { |
207 | struct pnp_resource_table *res = dev->res; | 211 | struct resource *res; |
208 | int i = 0; | 212 | int i; |
209 | static unsigned char warned; | 213 | static unsigned char warned; |
210 | 214 | ||
211 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 215 | for (i = 0; i < PNP_MAX_PORT; i++) { |
212 | i < PNP_MAX_PORT) | 216 | res = pnp_get_resource(dev, IORESOURCE_IO, i); |
213 | i++; | 217 | if (!pnp_resource_valid(res)) |
218 | break; | ||
219 | } | ||
214 | if (i < PNP_MAX_PORT) { | 220 | if (i < PNP_MAX_PORT) { |
215 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag | 221 | res->flags = IORESOURCE_IO; // Also clears _UNSET flag |
216 | if (io_decode == ACPI_DECODE_16) | 222 | if (io_decode == ACPI_DECODE_16) |
217 | res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR; | 223 | res->flags |= PNP_PORT_FLAG_16BITADDR; |
218 | if (len <= 0 || (io + len - 1) >= 0x10003) { | 224 | if (len <= 0 || (io + len - 1) >= 0x10003) { |
219 | res->port_resource[i].flags |= IORESOURCE_DISABLED; | 225 | res->flags |= IORESOURCE_DISABLED; |
220 | return; | 226 | return; |
221 | } | 227 | } |
222 | res->port_resource[i].start = io; | 228 | res->start = io; |
223 | res->port_resource[i].end = io + len - 1; | 229 | res->end = io + len - 1; |
224 | } else if (!warned) { | 230 | } else if (!warned) { |
225 | printk(KERN_WARNING "pnpacpi: exceeded the max number of IO " | 231 | printk(KERN_WARNING "pnpacpi: exceeded the max number of IO " |
226 | "resources: %d \n", PNP_MAX_PORT); | 232 | "resources: %d \n", PNP_MAX_PORT); |
@@ -232,24 +238,26 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, | |||
232 | u64 mem, u64 len, | 238 | u64 mem, u64 len, |
233 | int write_protect) | 239 | int write_protect) |
234 | { | 240 | { |
235 | struct pnp_resource_table *res = dev->res; | 241 | struct resource *res; |
236 | int i = 0; | 242 | int i; |
237 | static unsigned char warned; | 243 | static unsigned char warned; |
238 | 244 | ||
239 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && | 245 | for (i = 0; i < PNP_MAX_MEM; i++) { |
240 | (i < PNP_MAX_MEM)) | 246 | res = pnp_get_resource(dev, IORESOURCE_MEM, i); |
241 | i++; | 247 | if (!pnp_resource_valid(res)) |
248 | break; | ||
249 | } | ||
242 | if (i < PNP_MAX_MEM) { | 250 | if (i < PNP_MAX_MEM) { |
243 | res->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag | 251 | res->flags = IORESOURCE_MEM; // Also clears _UNSET flag |
244 | if (len <= 0) { | 252 | if (len <= 0) { |
245 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; | 253 | res->flags |= IORESOURCE_DISABLED; |
246 | return; | 254 | return; |
247 | } | 255 | } |
248 | if (write_protect == ACPI_READ_WRITE_MEMORY) | 256 | if (write_protect == ACPI_READ_WRITE_MEMORY) |
249 | res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE; | 257 | res->flags |= IORESOURCE_MEM_WRITEABLE; |
250 | 258 | ||
251 | res->mem_resource[i].start = mem; | 259 | res->start = mem; |
252 | res->mem_resource[i].end = mem + len - 1; | 260 | res->end = mem + len - 1; |
253 | } else if (!warned) { | 261 | } else if (!warned) { |
254 | printk(KERN_WARNING "pnpacpi: exceeded the max number of mem " | 262 | printk(KERN_WARNING "pnpacpi: exceeded the max number of mem " |
255 | "resources: %d\n", PNP_MAX_MEM); | 263 | "resources: %d\n", PNP_MAX_MEM); |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 9f0538af0321..d3b0a4e53692 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -56,80 +56,90 @@ inline void pcibios_penalize_isa_irq(int irq, int active) | |||
56 | 56 | ||
57 | static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq) | 57 | static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq) |
58 | { | 58 | { |
59 | struct pnp_resource_table *res = dev->res; | 59 | struct resource *res; |
60 | int i = 0; | 60 | int i; |
61 | |||
62 | for (i = 0; i < PNP_MAX_IRQ; i++) { | ||
63 | res = pnp_get_resource(dev, IORESOURCE_IRQ, i); | ||
64 | if (!pnp_resource_valid(res)) | ||
65 | break; | ||
66 | } | ||
61 | 67 | ||
62 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) | ||
63 | && i < PNP_MAX_IRQ) | ||
64 | i++; | ||
65 | if (i < PNP_MAX_IRQ) { | 68 | if (i < PNP_MAX_IRQ) { |
66 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 69 | res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
67 | if (irq == -1) { | 70 | if (irq == -1) { |
68 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 71 | res->flags |= IORESOURCE_DISABLED; |
69 | return; | 72 | return; |
70 | } | 73 | } |
71 | res->irq_resource[i].start = | 74 | res->start = res->end = (unsigned long)irq; |
72 | res->irq_resource[i].end = (unsigned long)irq; | ||
73 | pcibios_penalize_isa_irq(irq, 1); | 75 | pcibios_penalize_isa_irq(irq, 1); |
74 | } | 76 | } |
75 | } | 77 | } |
76 | 78 | ||
77 | static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma) | 79 | static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma) |
78 | { | 80 | { |
79 | struct pnp_resource_table *res = dev->res; | 81 | struct resource *res; |
80 | int i = 0; | 82 | int i; |
83 | |||
84 | for (i = 0; i < PNP_MAX_DMA; i++) { | ||
85 | res = pnp_get_resource(dev, IORESOURCE_DMA, i); | ||
86 | if (!pnp_resource_valid(res)) | ||
87 | break; | ||
88 | } | ||
81 | 89 | ||
82 | while (i < PNP_MAX_DMA && | ||
83 | !(res->dma_resource[i].flags & IORESOURCE_UNSET)) | ||
84 | i++; | ||
85 | if (i < PNP_MAX_DMA) { | 90 | if (i < PNP_MAX_DMA) { |
86 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag | 91 | res->flags = IORESOURCE_DMA; // Also clears _UNSET flag |
87 | if (dma == -1) { | 92 | if (dma == -1) { |
88 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; | 93 | res->flags |= IORESOURCE_DISABLED; |
89 | return; | 94 | return; |
90 | } | 95 | } |
91 | res->dma_resource[i].start = | 96 | res->start = res->end = (unsigned long)dma; |
92 | res->dma_resource[i].end = (unsigned long)dma; | ||
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
96 | static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev, | 100 | static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev, |
97 | int io, int len) | 101 | int io, int len) |
98 | { | 102 | { |
99 | struct pnp_resource_table *res = dev->res; | 103 | struct resource *res; |
100 | int i = 0; | 104 | int i; |
105 | |||
106 | for (i = 0; i < PNP_MAX_PORT; i++) { | ||
107 | res = pnp_get_resource(dev, IORESOURCE_IO, i); | ||
108 | if (!pnp_resource_valid(res)) | ||
109 | break; | ||
110 | } | ||
101 | 111 | ||
102 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) | ||
103 | && i < PNP_MAX_PORT) | ||
104 | i++; | ||
105 | if (i < PNP_MAX_PORT) { | 112 | if (i < PNP_MAX_PORT) { |
106 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag | 113 | res->flags = IORESOURCE_IO; // Also clears _UNSET flag |
107 | if (len <= 0 || (io + len - 1) >= 0x10003) { | 114 | if (len <= 0 || (io + len - 1) >= 0x10003) { |
108 | res->port_resource[i].flags |= IORESOURCE_DISABLED; | 115 | res->flags |= IORESOURCE_DISABLED; |
109 | return; | 116 | return; |
110 | } | 117 | } |
111 | res->port_resource[i].start = (unsigned long)io; | 118 | res->start = (unsigned long)io; |
112 | res->port_resource[i].end = (unsigned long)(io + len - 1); | 119 | res->end = (unsigned long)(io + len - 1); |
113 | } | 120 | } |
114 | } | 121 | } |
115 | 122 | ||
116 | static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev, | 123 | static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev, |
117 | int mem, int len) | 124 | int mem, int len) |
118 | { | 125 | { |
119 | struct pnp_resource_table *res = dev->res; | 126 | struct resource *res; |
120 | int i = 0; | 127 | int i; |
128 | |||
129 | for (i = 0; i < PNP_MAX_MEM; i++) { | ||
130 | res = pnp_get_resource(dev, IORESOURCE_MEM, i); | ||
131 | if (!pnp_resource_valid(res)) | ||
132 | break; | ||
133 | } | ||
121 | 134 | ||
122 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) | ||
123 | && i < PNP_MAX_MEM) | ||
124 | i++; | ||
125 | if (i < PNP_MAX_MEM) { | 135 | if (i < PNP_MAX_MEM) { |
126 | res->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag | 136 | res->flags = IORESOURCE_MEM; // Also clears _UNSET flag |
127 | if (len <= 0) { | 137 | if (len <= 0) { |
128 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; | 138 | res->flags |= IORESOURCE_DISABLED; |
129 | return; | 139 | return; |
130 | } | 140 | } |
131 | res->mem_resource[i].start = (unsigned long)mem; | 141 | res->start = (unsigned long)mem; |
132 | res->mem_resource[i].end = (unsigned long)(mem + len - 1); | 142 | res->end = (unsigned long)(mem + len - 1); |
133 | } | 143 | } |
134 | } | 144 | } |
135 | 145 | ||