提交 c1caf06c 编写于 作者: B Bjorn Helgaas 提交者: Len Brown

PNP: add debug output to option registration

Add debug output to resource option registration functions (enabled
by CONFIG_PNP_DEBUG).  This uses dev_printk, so I had to add pnp_dev
arguments at the same time.
Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: NRene Herman <rene.herman@gmail.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 cdef6254
...@@ -431,7 +431,8 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, ...@@ -431,7 +431,8 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
/* /*
* Add IRQ resource to resources list. * Add IRQ resource to resources list.
*/ */
static void __init isapnp_parse_irq_resource(struct pnp_option *option, static void __init isapnp_parse_irq_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[3]; unsigned char tmp[3];
...@@ -448,13 +449,14 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option, ...@@ -448,13 +449,14 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
irq->flags = tmp[2]; irq->flags = tmp[2];
else else
irq->flags = IORESOURCE_IRQ_HIGHEDGE; irq->flags = IORESOURCE_IRQ_HIGHEDGE;
pnp_register_irq_resource(option, irq); pnp_register_irq_resource(dev, option, irq);
} }
/* /*
* Add DMA resource to resources list. * Add DMA resource to resources list.
*/ */
static void __init isapnp_parse_dma_resource(struct pnp_option *option, static void __init isapnp_parse_dma_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[2]; unsigned char tmp[2];
...@@ -466,13 +468,14 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option, ...@@ -466,13 +468,14 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
return; return;
dma->map = tmp[0]; dma->map = tmp[0];
dma->flags = tmp[1]; dma->flags = tmp[1];
pnp_register_dma_resource(option, dma); pnp_register_dma_resource(dev, option, dma);
} }
/* /*
* Add port resource to resources list. * Add port resource to resources list.
*/ */
static void __init isapnp_parse_port_resource(struct pnp_option *option, static void __init isapnp_parse_port_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[7]; unsigned char tmp[7];
...@@ -487,13 +490,14 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option, ...@@ -487,13 +490,14 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
port->align = tmp[5]; port->align = tmp[5];
port->size = tmp[6]; port->size = tmp[6];
port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0; port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
/* /*
* Add fixed port resource to resources list. * Add fixed port resource to resources list.
*/ */
static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, static void __init isapnp_parse_fixed_port_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[3]; unsigned char tmp[3];
...@@ -507,13 +511,14 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, ...@@ -507,13 +511,14 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
port->size = tmp[2]; port->size = tmp[2];
port->align = 0; port->align = 0;
port->flags = PNP_PORT_FLAG_FIXED; port->flags = PNP_PORT_FLAG_FIXED;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
/* /*
* Add memory resource to resources list. * Add memory resource to resources list.
*/ */
static void __init isapnp_parse_mem_resource(struct pnp_option *option, static void __init isapnp_parse_mem_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[9]; unsigned char tmp[9];
...@@ -528,13 +533,14 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option, ...@@ -528,13 +533,14 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
mem->align = (tmp[6] << 8) | tmp[5]; mem->align = (tmp[6] << 8) | tmp[5];
mem->size = ((tmp[8] << 8) | tmp[7]) << 8; mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
mem->flags = tmp[0]; mem->flags = tmp[0];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
/* /*
* Add 32-bit memory resource to resources list. * Add 32-bit memory resource to resources list.
*/ */
static void __init isapnp_parse_mem32_resource(struct pnp_option *option, static void __init isapnp_parse_mem32_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[17]; unsigned char tmp[17];
...@@ -551,13 +557,14 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option, ...@@ -551,13 +557,14 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
mem->size = mem->size =
(tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13]; (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13];
mem->flags = tmp[0]; mem->flags = tmp[0];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
/* /*
* Add 32-bit fixed memory resource to resources list. * Add 32-bit fixed memory resource to resources list.
*/ */
static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, static void __init isapnp_parse_fixed_mem32_resource(struct pnp_dev *dev,
struct pnp_option *option,
int size) int size)
{ {
unsigned char tmp[9]; unsigned char tmp[9];
...@@ -572,7 +579,7 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, ...@@ -572,7 +579,7 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
mem->align = 0; mem->align = 0;
mem->flags = tmp[0]; mem->flags = tmp[0];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
/* /*
...@@ -656,13 +663,13 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -656,13 +663,13 @@ static int __init isapnp_create_device(struct pnp_card *card,
case _STAG_IRQ: case _STAG_IRQ:
if (size < 2 || size > 3) if (size < 2 || size > 3)
goto __skip; goto __skip;
isapnp_parse_irq_resource(option, size); isapnp_parse_irq_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _STAG_DMA: case _STAG_DMA:
if (size != 2) if (size != 2)
goto __skip; goto __skip;
isapnp_parse_dma_resource(option, size); isapnp_parse_dma_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _STAG_STARTDEP: case _STAG_STARTDEP:
...@@ -682,17 +689,18 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -682,17 +689,18 @@ static int __init isapnp_create_device(struct pnp_card *card,
if (size != 0) if (size != 0)
goto __skip; goto __skip;
priority = 0; priority = 0;
dev_dbg(&dev->dev, "end dependent options\n");
break; break;
case _STAG_IOPORT: case _STAG_IOPORT:
if (size != 7) if (size != 7)
goto __skip; goto __skip;
isapnp_parse_port_resource(option, size); isapnp_parse_port_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _STAG_FIXEDIO: case _STAG_FIXEDIO:
if (size != 3) if (size != 3)
goto __skip; goto __skip;
isapnp_parse_fixed_port_resource(option, size); isapnp_parse_fixed_port_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _STAG_VENDOR: case _STAG_VENDOR:
...@@ -700,7 +708,7 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -700,7 +708,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
case _LTAG_MEMRANGE: case _LTAG_MEMRANGE:
if (size != 9) if (size != 9)
goto __skip; goto __skip;
isapnp_parse_mem_resource(option, size); isapnp_parse_mem_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _LTAG_ANSISTR: case _LTAG_ANSISTR:
...@@ -715,13 +723,13 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -715,13 +723,13 @@ static int __init isapnp_create_device(struct pnp_card *card,
case _LTAG_MEM32RANGE: case _LTAG_MEM32RANGE:
if (size != 17) if (size != 17)
goto __skip; goto __skip;
isapnp_parse_mem32_resource(option, size); isapnp_parse_mem32_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _LTAG_FIXEDMEM32RANGE: case _LTAG_FIXEDMEM32RANGE:
if (size != 9) if (size != 9)
goto __skip; goto __skip;
isapnp_parse_fixed_mem32_resource(option, size); isapnp_parse_fixed_mem32_resource(dev, option, size);
size = 0; size = 0;
break; break;
case _STAG_END: case _STAG_END:
......
...@@ -410,7 +410,8 @@ acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, ...@@ -410,7 +410,8 @@ acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle,
pnpacpi_allocated_resource, res); pnpacpi_allocated_resource, res);
} }
static __init void pnpacpi_parse_dma_option(struct pnp_option *option, static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_dma *p) struct acpi_resource_dma *p)
{ {
int i; int i;
...@@ -427,10 +428,11 @@ static __init void pnpacpi_parse_dma_option(struct pnp_option *option, ...@@ -427,10 +428,11 @@ static __init void pnpacpi_parse_dma_option(struct pnp_option *option,
dma->flags = dma_flags(p->type, p->bus_master, p->transfer); dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
pnp_register_dma_resource(option, dma); pnp_register_dma_resource(dev, option, dma);
} }
static __init void pnpacpi_parse_irq_option(struct pnp_option *option, static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_irq *p) struct acpi_resource_irq *p)
{ {
int i; int i;
...@@ -447,10 +449,11 @@ static __init void pnpacpi_parse_irq_option(struct pnp_option *option, ...@@ -447,10 +449,11 @@ static __init void pnpacpi_parse_irq_option(struct pnp_option *option,
__set_bit(p->interrupts[i], irq->map); __set_bit(p->interrupts[i], irq->map);
irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
pnp_register_irq_resource(option, irq); pnp_register_irq_resource(dev, option, irq);
} }
static __init void pnpacpi_parse_ext_irq_option(struct pnp_option *option, static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_extended_irq *p) struct acpi_resource_extended_irq *p)
{ {
int i; int i;
...@@ -467,10 +470,11 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_option *option, ...@@ -467,10 +470,11 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
__set_bit(p->interrupts[i], irq->map); __set_bit(p->interrupts[i], irq->map);
irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); irq->flags = irq_flags(p->triggering, p->polarity, p->sharable);
pnp_register_irq_resource(option, irq); pnp_register_irq_resource(dev, option, irq);
} }
static __init void pnpacpi_parse_port_option(struct pnp_option *option, static __init void pnpacpi_parse_port_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_io *io) struct acpi_resource_io *io)
{ {
struct pnp_port *port; struct pnp_port *port;
...@@ -486,10 +490,11 @@ static __init void pnpacpi_parse_port_option(struct pnp_option *option, ...@@ -486,10 +490,11 @@ static __init void pnpacpi_parse_port_option(struct pnp_option *option,
port->size = io->address_length; port->size = io->address_length;
port->flags = ACPI_DECODE_16 == io->io_decode ? port->flags = ACPI_DECODE_16 == io->io_decode ?
PNP_PORT_FLAG_16BITADDR : 0; PNP_PORT_FLAG_16BITADDR : 0;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
static __init void pnpacpi_parse_fixed_port_option(struct pnp_option *option, static __init void pnpacpi_parse_fixed_port_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_fixed_io *io) struct acpi_resource_fixed_io *io)
{ {
struct pnp_port *port; struct pnp_port *port;
...@@ -503,10 +508,11 @@ static __init void pnpacpi_parse_fixed_port_option(struct pnp_option *option, ...@@ -503,10 +508,11 @@ static __init void pnpacpi_parse_fixed_port_option(struct pnp_option *option,
port->size = io->address_length; port->size = io->address_length;
port->align = 0; port->align = 0;
port->flags = PNP_PORT_FLAG_FIXED; port->flags = PNP_PORT_FLAG_FIXED;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
static __init void pnpacpi_parse_mem24_option(struct pnp_option *option, static __init void pnpacpi_parse_mem24_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_memory24 *p) struct acpi_resource_memory24 *p)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -524,10 +530,11 @@ static __init void pnpacpi_parse_mem24_option(struct pnp_option *option, ...@@ -524,10 +530,11 @@ static __init void pnpacpi_parse_mem24_option(struct pnp_option *option,
mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0; IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpacpi_parse_mem32_option(struct pnp_option *option, static __init void pnpacpi_parse_mem32_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_memory32 *p) struct acpi_resource_memory32 *p)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -545,10 +552,11 @@ static __init void pnpacpi_parse_mem32_option(struct pnp_option *option, ...@@ -545,10 +552,11 @@ static __init void pnpacpi_parse_mem32_option(struct pnp_option *option,
mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0; IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource_fixed_memory32 *p) struct acpi_resource_fixed_memory32 *p)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -565,10 +573,11 @@ static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, ...@@ -565,10 +573,11 @@ static __init void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
IORESOURCE_MEM_WRITEABLE : 0; IORESOURCE_MEM_WRITEABLE : 0;
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpacpi_parse_address_option(struct pnp_option *option, static __init void pnpacpi_parse_address_option(struct pnp_dev *dev,
struct pnp_option *option,
struct acpi_resource *r) struct acpi_resource *r)
{ {
struct acpi_resource_address64 addr, *p = &addr; struct acpi_resource_address64 addr, *p = &addr;
...@@ -596,7 +605,7 @@ static __init void pnpacpi_parse_address_option(struct pnp_option *option, ...@@ -596,7 +605,7 @@ static __init void pnpacpi_parse_address_option(struct pnp_option *option,
mem->flags = (p->info.mem.write_protect == mem->flags = (p->info.mem.write_protect ==
ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE
: 0; : 0;
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} else if (p->resource_type == ACPI_IO_RANGE) { } else if (p->resource_type == ACPI_IO_RANGE) {
port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
if (!port) if (!port)
...@@ -605,7 +614,7 @@ static __init void pnpacpi_parse_address_option(struct pnp_option *option, ...@@ -605,7 +614,7 @@ static __init void pnpacpi_parse_address_option(struct pnp_option *option,
port->size = p->address_length; port->size = p->address_length;
port->align = 0; port->align = 0;
port->flags = PNP_PORT_FLAG_FIXED; port->flags = PNP_PORT_FLAG_FIXED;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
} }
...@@ -625,11 +634,11 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -625,11 +634,11 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
switch (res->type) { switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
pnpacpi_parse_irq_option(option, &res->data.irq); pnpacpi_parse_irq_option(dev, option, &res->data.irq);
break; break;
case ACPI_RESOURCE_TYPE_DMA: case ACPI_RESOURCE_TYPE_DMA:
pnpacpi_parse_dma_option(option, &res->data.dma); pnpacpi_parse_dma_option(dev, option, &res->data.dma);
break; break;
case ACPI_RESOURCE_TYPE_START_DEPENDENT: case ACPI_RESOURCE_TYPE_START_DEPENDENT:
...@@ -664,14 +673,16 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -664,14 +673,16 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
} }
parse_data->option = parse_data->option_independent; parse_data->option = parse_data->option_independent;
parse_data->option_independent = NULL; parse_data->option_independent = NULL;
dev_dbg(&dev->dev, "end dependent options\n");
break; break;
case ACPI_RESOURCE_TYPE_IO: case ACPI_RESOURCE_TYPE_IO:
pnpacpi_parse_port_option(option, &res->data.io); pnpacpi_parse_port_option(dev, option, &res->data.io);
break; break;
case ACPI_RESOURCE_TYPE_FIXED_IO: case ACPI_RESOURCE_TYPE_FIXED_IO:
pnpacpi_parse_fixed_port_option(option, &res->data.fixed_io); pnpacpi_parse_fixed_port_option(dev, option,
&res->data.fixed_io);
break; break;
case ACPI_RESOURCE_TYPE_VENDOR: case ACPI_RESOURCE_TYPE_VENDOR:
...@@ -679,29 +690,30 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -679,29 +690,30 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
break; break;
case ACPI_RESOURCE_TYPE_MEMORY24: case ACPI_RESOURCE_TYPE_MEMORY24:
pnpacpi_parse_mem24_option(option, &res->data.memory24); pnpacpi_parse_mem24_option(dev, option, &res->data.memory24);
break; break;
case ACPI_RESOURCE_TYPE_MEMORY32: case ACPI_RESOURCE_TYPE_MEMORY32:
pnpacpi_parse_mem32_option(option, &res->data.memory32); pnpacpi_parse_mem32_option(dev, option, &res->data.memory32);
break; break;
case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
pnpacpi_parse_fixed_mem32_option(option, pnpacpi_parse_fixed_mem32_option(dev, option,
&res->data.fixed_memory32); &res->data.fixed_memory32);
break; break;
case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS16:
case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS32:
case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_ADDRESS64:
pnpacpi_parse_address_option(option, res); pnpacpi_parse_address_option(dev, option, res);
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
pnpacpi_parse_ext_irq_option(option, &res->data.extended_irq); pnpacpi_parse_ext_irq_option(dev, option,
&res->data.extended_irq);
break; break;
case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
......
...@@ -263,7 +263,8 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, ...@@ -263,7 +263,8 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
* Resource Configuration Options * Resource Configuration Options
*/ */
static __init void pnpbios_parse_mem_option(unsigned char *p, int size, static __init void pnpbios_parse_mem_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -276,10 +277,11 @@ static __init void pnpbios_parse_mem_option(unsigned char *p, int size, ...@@ -276,10 +277,11 @@ static __init void pnpbios_parse_mem_option(unsigned char *p, int size,
mem->align = (p[9] << 8) | p[8]; mem->align = (p[9] << 8) | p[8];
mem->size = ((p[11] << 8) | p[10]) << 8; mem->size = ((p[11] << 8) | p[10]) << 8;
mem->flags = p[3]; mem->flags = p[3];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpbios_parse_mem32_option(unsigned char *p, int size, static __init void pnpbios_parse_mem32_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -292,10 +294,11 @@ static __init void pnpbios_parse_mem32_option(unsigned char *p, int size, ...@@ -292,10 +294,11 @@ static __init void pnpbios_parse_mem32_option(unsigned char *p, int size,
mem->align = (p[15] << 24) | (p[14] << 16) | (p[13] << 8) | p[12]; mem->align = (p[15] << 24) | (p[14] << 16) | (p[13] << 8) | p[12];
mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16]; mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16];
mem->flags = p[3]; mem->flags = p[3];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, static __init void pnpbios_parse_fixed_mem32_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_mem *mem; struct pnp_mem *mem;
...@@ -307,10 +310,11 @@ static __init void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, ...@@ -307,10 +310,11 @@ static __init void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
mem->size = (p[11] << 24) | (p[10] << 16) | (p[9] << 8) | p[8]; mem->size = (p[11] << 24) | (p[10] << 16) | (p[9] << 8) | p[8];
mem->align = 0; mem->align = 0;
mem->flags = p[3]; mem->flags = p[3];
pnp_register_mem_resource(option, mem); pnp_register_mem_resource(dev, option, mem);
} }
static __init void pnpbios_parse_irq_option(unsigned char *p, int size, static __init void pnpbios_parse_irq_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_irq *irq; struct pnp_irq *irq;
...@@ -325,10 +329,11 @@ static __init void pnpbios_parse_irq_option(unsigned char *p, int size, ...@@ -325,10 +329,11 @@ static __init void pnpbios_parse_irq_option(unsigned char *p, int size,
irq->flags = p[3]; irq->flags = p[3];
else else
irq->flags = IORESOURCE_IRQ_HIGHEDGE; irq->flags = IORESOURCE_IRQ_HIGHEDGE;
pnp_register_irq_resource(option, irq); pnp_register_irq_resource(dev, option, irq);
} }
static __init void pnpbios_parse_dma_option(unsigned char *p, int size, static __init void pnpbios_parse_dma_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_dma *dma; struct pnp_dma *dma;
...@@ -338,10 +343,11 @@ static __init void pnpbios_parse_dma_option(unsigned char *p, int size, ...@@ -338,10 +343,11 @@ static __init void pnpbios_parse_dma_option(unsigned char *p, int size,
return; return;
dma->map = p[1]; dma->map = p[1];
dma->flags = p[2]; dma->flags = p[2];
pnp_register_dma_resource(option, dma); pnp_register_dma_resource(dev, option, dma);
} }
static __init void pnpbios_parse_port_option(unsigned char *p, int size, static __init void pnpbios_parse_port_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_port *port; struct pnp_port *port;
...@@ -354,10 +360,11 @@ static __init void pnpbios_parse_port_option(unsigned char *p, int size, ...@@ -354,10 +360,11 @@ static __init void pnpbios_parse_port_option(unsigned char *p, int size,
port->align = p[6]; port->align = p[6];
port->size = p[7]; port->size = p[7];
port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0; port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
static __init void pnpbios_parse_fixed_port_option(unsigned char *p, int size, static __init void pnpbios_parse_fixed_port_option(struct pnp_dev *dev,
unsigned char *p, int size,
struct pnp_option *option) struct pnp_option *option)
{ {
struct pnp_port *port; struct pnp_port *port;
...@@ -369,7 +376,7 @@ static __init void pnpbios_parse_fixed_port_option(unsigned char *p, int size, ...@@ -369,7 +376,7 @@ static __init void pnpbios_parse_fixed_port_option(unsigned char *p, int size,
port->size = p[3]; port->size = p[3];
port->align = 0; port->align = 0;
port->flags = PNP_PORT_FLAG_FIXED; port->flags = PNP_PORT_FLAG_FIXED;
pnp_register_port_resource(option, port); pnp_register_port_resource(dev, option, port);
} }
static __init unsigned char * static __init unsigned char *
...@@ -403,37 +410,37 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -403,37 +410,37 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
case LARGE_TAG_MEM: case LARGE_TAG_MEM:
if (len != 9) if (len != 9)
goto len_err; goto len_err;
pnpbios_parse_mem_option(p, len, option); pnpbios_parse_mem_option(dev, p, len, option);
break; break;
case LARGE_TAG_MEM32: case LARGE_TAG_MEM32:
if (len != 17) if (len != 17)
goto len_err; goto len_err;
pnpbios_parse_mem32_option(p, len, option); pnpbios_parse_mem32_option(dev, p, len, option);
break; break;
case LARGE_TAG_FIXEDMEM32: case LARGE_TAG_FIXEDMEM32:
if (len != 9) if (len != 9)
goto len_err; goto len_err;
pnpbios_parse_fixed_mem32_option(p, len, option); pnpbios_parse_fixed_mem32_option(dev, p, len, option);
break; break;
case SMALL_TAG_IRQ: case SMALL_TAG_IRQ:
if (len < 2 || len > 3) if (len < 2 || len > 3)
goto len_err; goto len_err;
pnpbios_parse_irq_option(p, len, option); pnpbios_parse_irq_option(dev, p, len, option);
break; break;
case SMALL_TAG_DMA: case SMALL_TAG_DMA:
if (len != 2) if (len != 2)
goto len_err; goto len_err;
pnpbios_parse_dma_option(p, len, option); pnpbios_parse_dma_option(dev, p, len, option);
break; break;
case SMALL_TAG_PORT: case SMALL_TAG_PORT:
if (len != 7) if (len != 7)
goto len_err; goto len_err;
pnpbios_parse_port_option(p, len, option); pnpbios_parse_port_option(dev, p, len, option);
break; break;
case SMALL_TAG_VENDOR: case SMALL_TAG_VENDOR:
...@@ -443,7 +450,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -443,7 +450,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
case SMALL_TAG_FIXEDPORT: case SMALL_TAG_FIXEDPORT:
if (len != 3) if (len != 3)
goto len_err; goto len_err;
pnpbios_parse_fixed_port_option(p, len, option); pnpbios_parse_fixed_port_option(dev, p, len, option);
break; break;
case SMALL_TAG_STARTDEP: case SMALL_TAG_STARTDEP:
...@@ -464,6 +471,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -464,6 +471,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
printk(KERN_WARNING printk(KERN_WARNING
"PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n"); "PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n");
option = option_independent; option = option_independent;
dev_dbg(&dev->dev, "end dependent options\n");
break; break;
case SMALL_TAG_END: case SMALL_TAG_END:
......
...@@ -53,6 +53,8 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) ...@@ -53,6 +53,8 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
if (dev->independent) if (dev->independent)
dev_err(&dev->dev, "independent resource already registered\n"); dev_err(&dev->dev, "independent resource already registered\n");
dev->independent = option; dev->independent = option;
dev_dbg(&dev->dev, "new independent option\n");
return option; return option;
} }
...@@ -70,12 +72,18 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, ...@@ -70,12 +72,18 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
parent->next = option; parent->next = option;
} else } else
dev->dependent = option; dev->dependent = option;
dev_dbg(&dev->dev, "new dependent option (priority %#x)\n", priority);
return option; return option;
} }
int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_irq *data)
{ {
struct pnp_irq *ptr; struct pnp_irq *ptr;
#ifdef DEBUG
char buf[PNP_IRQ_NR]; /* hex-encoded, so this is overkill but safe */
#endif
ptr = option->irq; ptr = option->irq;
while (ptr && ptr->next) while (ptr && ptr->next)
...@@ -94,10 +102,17 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) ...@@ -94,10 +102,17 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
pcibios_penalize_isa_irq(i, 0); pcibios_penalize_isa_irq(i, 0);
} }
#endif #endif
#ifdef DEBUG
bitmap_scnprintf(buf, sizeof(buf), data->map, PNP_IRQ_NR);
dev_dbg(&dev->dev, " irq bitmask %s flags %#x\n", buf,
data->flags);
#endif
return 0; return 0;
} }
int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_dma *data)
{ {
struct pnp_dma *ptr; struct pnp_dma *ptr;
...@@ -109,10 +124,13 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) ...@@ -109,10 +124,13 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
else else
option->dma = data; option->dma = data;
dev_dbg(&dev->dev, " dma bitmask %#x flags %#x\n", data->map,
data->flags);
return 0; return 0;
} }
int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_port *data)
{ {
struct pnp_port *ptr; struct pnp_port *ptr;
...@@ -124,10 +142,14 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) ...@@ -124,10 +142,14 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
else else
option->port = data; option->port = data;
dev_dbg(&dev->dev, " io "
"min %#x max %#x align %d size %d flags %#x\n",
data->min, data->max, data->align, data->size, data->flags);
return 0; return 0;
} }
int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_mem *data)
{ {
struct pnp_mem *ptr; struct pnp_mem *ptr;
...@@ -138,6 +160,10 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) ...@@ -138,6 +160,10 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
ptr->next = data; ptr->next = data;
else else
option->mem = data; option->mem = data;
dev_dbg(&dev->dev, " mem "
"min %#x max %#x align %d size %d flags %#x\n",
data->min, data->max, data->align, data->size, data->flags);
return 0; return 0;
} }
......
...@@ -382,11 +382,14 @@ extern struct list_head pnp_cards; ...@@ -382,11 +382,14 @@ extern struct list_head pnp_cards;
struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
int priority); int priority);
int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); struct pnp_irq *data);
int pnp_register_port_resource(struct pnp_option *option, int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_dma *data);
int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_port *data); struct pnp_port *data);
int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
struct pnp_mem *data);
void pnp_init_resource_table(struct pnp_resource_table *table); void pnp_init_resource_table(struct pnp_resource_table *table);
int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
int mode); int mode);
...@@ -430,10 +433,10 @@ static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } ...@@ -430,10 +433,10 @@ static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
/* resource management */ /* resource management */
static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } static inline int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; }
static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } static inline int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } static inline int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
static inline int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; } static inline int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; }
static inline void pnp_init_resource_table(struct pnp_resource_table *table) { } static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册