Skip to content

Commit 169aaff

Browse files
Bjorn HelgaasAndi Kleen
authored andcommitted
PNP: increase I/O port & memory option address sizes
ACPI Address Space Descriptors can be up to 64 bits wide. We should keep track of the whole thing when parsing resource options, so this patch changes PNP port and mem option fields from "unsigned short" and "unsigned int" to "resource_size_t". Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 7aefff5 commit 169aaff

3 files changed

Lines changed: 29 additions & 18 deletions

File tree

‎drivers/pnp/base.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
2020
void pnp_remove_card_device(struct pnp_dev *dev);
2121

2222
struct pnp_port {
23-
unsigned short min; /* min base number */
24-
unsigned short max; /* max base number */
25-
unsigned char align; /* align boundary */
26-
unsigned char size; /* size of range */
23+
resource_size_t min; /* min base number */
24+
resource_size_t max; /* max base number */
25+
resource_size_t align; /* align boundary */
26+
resource_size_t size; /* size of range */
2727
unsigned char flags; /* port flags */
2828
unsigned char pad; /* pad */
2929
struct pnp_port *next; /* next port */
@@ -46,10 +46,10 @@ struct pnp_dma {
4646
};
4747

4848
struct pnp_mem {
49-
unsigned int min; /* min base number */
50-
unsigned int max; /* max base number */
51-
unsigned int align; /* align boundary */
52-
unsigned int size; /* size of range */
49+
resource_size_t min; /* min base number */
50+
resource_size_t max; /* max base number */
51+
resource_size_t align; /* align boundary */
52+
resource_size_t size; /* size of range */
5353
unsigned char flags; /* memory flags */
5454
unsigned char pad; /* pad */
5555
struct pnp_mem *next; /* next memory resource */

‎drivers/pnp/interface.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt, ...)
5353
static void pnp_print_port(pnp_info_buffer_t * buffer, char *space,
5454
struct pnp_port *port)
5555
{
56-
pnp_printf(buffer,
57-
"%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n",
58-
space, port->min, port->max,
59-
port->align ? (port->align - 1) : 0, port->size,
56+
pnp_printf(buffer, "%sport %#llx-%#llx, align %#llx, size %#llx, "
57+
"%i-bit address decoding\n", space,
58+
(unsigned long long) port->min,
59+
(unsigned long long) port->max,
60+
port->align ? ((unsigned long long) port->align - 1) : 0,
61+
(unsigned long long) port->size,
6062
port->flags & IORESOURCE_IO_16BIT_ADDR ? 16 : 10);
6163
}
6264

@@ -148,8 +150,11 @@ static void pnp_print_mem(pnp_info_buffer_t * buffer, char *space,
148150
{
149151
char *s;
150152

151-
pnp_printf(buffer, "%sMemory 0x%x-0x%x, align 0x%x, size 0x%x",
152-
space, mem->min, mem->max, mem->align, mem->size);
153+
pnp_printf(buffer, "%sMemory %#llx-%#llx, align %#llx, size %#llx",
154+
space, (unsigned long long) mem->min,
155+
(unsigned long long) mem->max,
156+
(unsigned long long) mem->align,
157+
(unsigned long long) mem->size);
153158
if (mem->flags & IORESOURCE_MEM_WRITEABLE)
154159
pnp_printf(buffer, ", writeable");
155160
if (mem->flags & IORESOURCE_MEM_CACHEABLE)

‎drivers/pnp/resource.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
143143
option->port = data;
144144

145145
dev_dbg(&dev->dev, " io "
146-
"min %#x max %#x align %d size %d flags %#x\n",
147-
data->min, data->max, data->align, data->size, data->flags);
146+
"min %#llx max %#llx align %lld size %lld flags %#x\n",
147+
(unsigned long long) data->min,
148+
(unsigned long long) data->max,
149+
(unsigned long long) data->align,
150+
(unsigned long long) data->size, data->flags);
148151
return 0;
149152
}
150153

@@ -162,8 +165,11 @@ int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
162165
option->mem = data;
163166

164167
dev_dbg(&dev->dev, " mem "
165-
"min %#x max %#x align %d size %d flags %#x\n",
166-
data->min, data->max, data->align, data->size, data->flags);
168+
"min %#llx max %#llx align %lld size %lld flags %#x\n",
169+
(unsigned long long) data->min,
170+
(unsigned long long) data->max,
171+
(unsigned long long) data->align,
172+
(unsigned long long) data->size, data->flags);
167173
return 0;
168174
}
169175

0 commit comments

Comments
 (0)