mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 16:19:53 +00:00
PNP: remove more pnp_resource_table arguments
Stop passing around struct pnp_resource_table pointers. In most cases, the caller doesn't need to know how the resources are stored inside the struct pnp_dev. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
59284cb409
commit
4ab55d8d4f
@ -932,9 +932,9 @@ EXPORT_SYMBOL(isapnp_cfg_begin);
|
|||||||
EXPORT_SYMBOL(isapnp_cfg_end);
|
EXPORT_SYMBOL(isapnp_cfg_end);
|
||||||
EXPORT_SYMBOL(isapnp_write_byte);
|
EXPORT_SYMBOL(isapnp_write_byte);
|
||||||
|
|
||||||
static int isapnp_read_resources(struct pnp_dev *dev,
|
static int isapnp_read_resources(struct pnp_dev *dev)
|
||||||
struct pnp_resource_table *res)
|
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int tmp, ret;
|
int tmp, ret;
|
||||||
|
|
||||||
dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
|
dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
|
||||||
@ -982,7 +982,7 @@ static int isapnp_get_resources(struct pnp_dev *dev)
|
|||||||
|
|
||||||
pnp_init_resource_table(&dev->res);
|
pnp_init_resource_table(&dev->res);
|
||||||
isapnp_cfg_begin(dev->card->number, dev->number);
|
isapnp_cfg_begin(dev->card->number, dev->number);
|
||||||
ret = isapnp_read_resources(dev, &dev->res);
|
ret = isapnp_read_resources(dev);
|
||||||
isapnp_cfg_end();
|
isapnp_cfg_end();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev)
|
|||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data,
|
status = pnpacpi_parse_allocated_resource(dev);
|
||||||
&dev->res);
|
|
||||||
return ACPI_FAILURE(status) ? -ENODEV : 0;
|
return ACPI_FAILURE(status) ? -ENODEV : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
|
|||||||
ret = pnpacpi_build_resource_template(dev, &buffer);
|
ret = pnpacpi_build_resource_template(dev, &buffer);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret = pnpacpi_encode_resources(&dev->res, &buffer);
|
ret = pnpacpi_encode_resources(dev, &buffer);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
return ret;
|
return ret;
|
||||||
@ -183,8 +182,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
|
|||||||
|
|
||||||
if (dev->active) {
|
if (dev->active) {
|
||||||
/* parse allocated resource */
|
/* parse allocated resource */
|
||||||
status = pnpacpi_parse_allocated_resource(device->handle,
|
status = pnpacpi_parse_allocated_resource(dev);
|
||||||
&dev->res);
|
|
||||||
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
|
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
|
||||||
pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
|
pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
|
||||||
acpi_device_hid(device));
|
acpi_device_hid(device));
|
||||||
@ -192,8 +190,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dev->capabilities & PNP_CONFIGURABLE) {
|
if (dev->capabilities & PNP_CONFIGURABLE) {
|
||||||
status = pnpacpi_parse_resource_option_data(device->handle,
|
status = pnpacpi_parse_resource_option_data(dev);
|
||||||
dev);
|
|
||||||
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
|
if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
|
||||||
pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
|
pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
|
||||||
acpi_device_hid(device));
|
acpi_device_hid(device));
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <linux/pnp.h>
|
#include <linux/pnp.h>
|
||||||
|
|
||||||
acpi_status pnpacpi_parse_allocated_resource(acpi_handle, struct pnp_resource_table*);
|
acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *);
|
||||||
acpi_status pnpacpi_parse_resource_option_data(acpi_handle, struct pnp_dev*);
|
acpi_status pnpacpi_parse_resource_option_data(struct pnp_dev *);
|
||||||
int pnpacpi_encode_resources(struct pnp_resource_table *, struct acpi_buffer *);
|
int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *);
|
||||||
int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *);
|
int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *);
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,10 +76,11 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
|
static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
|
||||||
u32 gsi, int triggering,
|
u32 gsi, int triggering,
|
||||||
int polarity, int shareable)
|
int polarity, int shareable)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int irq;
|
int irq;
|
||||||
int p, t;
|
int p, t;
|
||||||
@ -172,9 +173,10 @@ static int dma_flags(int type, int bus_master, int transfer)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
|
static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev,
|
||||||
u32 dma, int flags)
|
u32 dma, int flags)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static unsigned char warned;
|
static unsigned char warned;
|
||||||
|
|
||||||
@ -197,9 +199,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
|
static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev,
|
||||||
u64 io, u64 len, int io_decode)
|
u64 io, u64 len, int io_decode)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static unsigned char warned;
|
static unsigned char warned;
|
||||||
|
|
||||||
@ -223,10 +226,11 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
|
static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
|
||||||
u64 mem, u64 len,
|
u64 mem, u64 len,
|
||||||
int write_protect)
|
int write_protect)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static unsigned char warned;
|
static unsigned char warned;
|
||||||
|
|
||||||
@ -251,7 +255,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
|
static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
|
||||||
struct acpi_resource *res)
|
struct acpi_resource *res)
|
||||||
{
|
{
|
||||||
struct acpi_resource_address64 addr, *p = &addr;
|
struct acpi_resource_address64 addr, *p = &addr;
|
||||||
@ -268,11 +272,11 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (p->resource_type == ACPI_MEMORY_RANGE)
|
if (p->resource_type == ACPI_MEMORY_RANGE)
|
||||||
pnpacpi_parse_allocated_memresource(res_table,
|
pnpacpi_parse_allocated_memresource(dev,
|
||||||
p->minimum, p->address_length,
|
p->minimum, p->address_length,
|
||||||
p->info.mem.write_protect);
|
p->info.mem.write_protect);
|
||||||
else if (p->resource_type == ACPI_IO_RANGE)
|
else if (p->resource_type == ACPI_IO_RANGE)
|
||||||
pnpacpi_parse_allocated_ioresource(res_table,
|
pnpacpi_parse_allocated_ioresource(dev,
|
||||||
p->minimum, p->address_length,
|
p->minimum, p->address_length,
|
||||||
p->granularity == 0xfff ? ACPI_DECODE_10 :
|
p->granularity == 0xfff ? ACPI_DECODE_10 :
|
||||||
ACPI_DECODE_16);
|
ACPI_DECODE_16);
|
||||||
@ -281,7 +285,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res
|
|||||||
static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct pnp_resource_table *res_table = data;
|
struct pnp_dev *dev = data;
|
||||||
struct acpi_resource_irq *irq;
|
struct acpi_resource_irq *irq;
|
||||||
struct acpi_resource_dma *dma;
|
struct acpi_resource_dma *dma;
|
||||||
struct acpi_resource_io *io;
|
struct acpi_resource_io *io;
|
||||||
@ -300,7 +304,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
*/
|
*/
|
||||||
irq = &res->data.irq;
|
irq = &res->data.irq;
|
||||||
for (i = 0; i < irq->interrupt_count; i++) {
|
for (i = 0; i < irq->interrupt_count; i++) {
|
||||||
pnpacpi_parse_allocated_irqresource(res_table,
|
pnpacpi_parse_allocated_irqresource(dev,
|
||||||
irq->interrupts[i],
|
irq->interrupts[i],
|
||||||
irq->triggering,
|
irq->triggering,
|
||||||
irq->polarity,
|
irq->polarity,
|
||||||
@ -311,7 +315,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
case ACPI_RESOURCE_TYPE_DMA:
|
case ACPI_RESOURCE_TYPE_DMA:
|
||||||
dma = &res->data.dma;
|
dma = &res->data.dma;
|
||||||
if (dma->channel_count > 0)
|
if (dma->channel_count > 0)
|
||||||
pnpacpi_parse_allocated_dmaresource(res_table,
|
pnpacpi_parse_allocated_dmaresource(dev,
|
||||||
dma->channels[0],
|
dma->channels[0],
|
||||||
dma_flags(dma->type, dma->bus_master,
|
dma_flags(dma->type, dma->bus_master,
|
||||||
dma->transfer));
|
dma->transfer));
|
||||||
@ -319,7 +323,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
|
|
||||||
case ACPI_RESOURCE_TYPE_IO:
|
case ACPI_RESOURCE_TYPE_IO:
|
||||||
io = &res->data.io;
|
io = &res->data.io;
|
||||||
pnpacpi_parse_allocated_ioresource(res_table,
|
pnpacpi_parse_allocated_ioresource(dev,
|
||||||
io->minimum,
|
io->minimum,
|
||||||
io->address_length,
|
io->address_length,
|
||||||
io->io_decode);
|
io->io_decode);
|
||||||
@ -331,7 +335,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
|
|
||||||
case ACPI_RESOURCE_TYPE_FIXED_IO:
|
case ACPI_RESOURCE_TYPE_FIXED_IO:
|
||||||
fixed_io = &res->data.fixed_io;
|
fixed_io = &res->data.fixed_io;
|
||||||
pnpacpi_parse_allocated_ioresource(res_table,
|
pnpacpi_parse_allocated_ioresource(dev,
|
||||||
fixed_io->address,
|
fixed_io->address,
|
||||||
fixed_io->address_length,
|
fixed_io->address_length,
|
||||||
ACPI_DECODE_10);
|
ACPI_DECODE_10);
|
||||||
@ -345,21 +349,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
|
|
||||||
case ACPI_RESOURCE_TYPE_MEMORY24:
|
case ACPI_RESOURCE_TYPE_MEMORY24:
|
||||||
memory24 = &res->data.memory24;
|
memory24 = &res->data.memory24;
|
||||||
pnpacpi_parse_allocated_memresource(res_table,
|
pnpacpi_parse_allocated_memresource(dev,
|
||||||
memory24->minimum,
|
memory24->minimum,
|
||||||
memory24->address_length,
|
memory24->address_length,
|
||||||
memory24->write_protect);
|
memory24->write_protect);
|
||||||
break;
|
break;
|
||||||
case ACPI_RESOURCE_TYPE_MEMORY32:
|
case ACPI_RESOURCE_TYPE_MEMORY32:
|
||||||
memory32 = &res->data.memory32;
|
memory32 = &res->data.memory32;
|
||||||
pnpacpi_parse_allocated_memresource(res_table,
|
pnpacpi_parse_allocated_memresource(dev,
|
||||||
memory32->minimum,
|
memory32->minimum,
|
||||||
memory32->address_length,
|
memory32->address_length,
|
||||||
memory32->write_protect);
|
memory32->write_protect);
|
||||||
break;
|
break;
|
||||||
case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
|
case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
|
||||||
fixed_memory32 = &res->data.fixed_memory32;
|
fixed_memory32 = &res->data.fixed_memory32;
|
||||||
pnpacpi_parse_allocated_memresource(res_table,
|
pnpacpi_parse_allocated_memresource(dev,
|
||||||
fixed_memory32->address,
|
fixed_memory32->address,
|
||||||
fixed_memory32->address_length,
|
fixed_memory32->address_length,
|
||||||
fixed_memory32->write_protect);
|
fixed_memory32->write_protect);
|
||||||
@ -367,7 +371,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
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_allocated_address_space(res_table, res);
|
pnpacpi_parse_allocated_address_space(dev, res);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
|
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
|
||||||
@ -381,7 +385,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
return AE_OK;
|
return AE_OK;
|
||||||
|
|
||||||
for (i = 0; i < extended_irq->interrupt_count; i++) {
|
for (i = 0; i < extended_irq->interrupt_count; i++) {
|
||||||
pnpacpi_parse_allocated_irqresource(res_table,
|
pnpacpi_parse_allocated_irqresource(dev,
|
||||||
extended_irq->interrupts[i],
|
extended_irq->interrupts[i],
|
||||||
extended_irq->triggering,
|
extended_irq->triggering,
|
||||||
extended_irq->polarity,
|
extended_irq->polarity,
|
||||||
@ -400,14 +404,15 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
|
|||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle,
|
acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
|
||||||
struct pnp_resource_table * res)
|
|
||||||
{
|
{
|
||||||
|
acpi_handle handle = dev->data;
|
||||||
|
|
||||||
/* Blank the resource table values */
|
/* Blank the resource table values */
|
||||||
pnp_init_resource_table(res);
|
pnp_init_resource_table(&dev->res);
|
||||||
|
|
||||||
return acpi_walk_resources(handle, METHOD_NAME__CRS,
|
return acpi_walk_resources(handle, METHOD_NAME__CRS,
|
||||||
pnpacpi_allocated_resource, res);
|
pnpacpi_allocated_resource, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev,
|
static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev,
|
||||||
@ -727,9 +732,9 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
|
|||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_status __init pnpacpi_parse_resource_option_data(acpi_handle handle,
|
acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
|
||||||
struct pnp_dev *dev)
|
|
||||||
{
|
{
|
||||||
|
acpi_handle handle = dev->data;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpipnp_parse_option_s parse_data;
|
struct acpipnp_parse_option_s parse_data;
|
||||||
|
|
||||||
@ -959,9 +964,9 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
|
|||||||
fixed_memory32->address_length = p->end - p->start + 1;
|
fixed_memory32->address_length = p->end - p->start + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
|
int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer)
|
||||||
struct acpi_buffer *buffer)
|
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res_table = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
/* pnpacpi_build_resource_template allocates extra mem */
|
/* pnpacpi_build_resource_template allocates extra mem */
|
||||||
int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
|
int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
|
||||||
|
@ -219,7 +219,7 @@ static int pnpbios_get_resources(struct pnp_dev *dev)
|
|||||||
kfree(node);
|
kfree(node);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
pnpbios_read_resources_from_node(&dev->res, node);
|
pnpbios_read_resources_from_node(dev, node);
|
||||||
dev->active = pnp_is_active(dev);
|
dev->active = pnp_is_active(dev);
|
||||||
kfree(node);
|
kfree(node);
|
||||||
return 0;
|
return 0;
|
||||||
@ -241,7 +241,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev)
|
|||||||
kfree(node);
|
kfree(node);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (pnpbios_write_resources_to_node(&dev->res, node) < 0) {
|
if (pnpbios_write_resources_to_node(dev, node) < 0) {
|
||||||
kfree(node);
|
kfree(node);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ extern int pnp_bios_present(void);
|
|||||||
extern int pnpbios_dont_use_current_config;
|
extern int pnpbios_dont_use_current_config;
|
||||||
|
|
||||||
extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node);
|
extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node);
|
||||||
extern int pnpbios_read_resources_from_node(struct pnp_resource_table *res, struct pnp_bios_node * node);
|
extern int pnpbios_read_resources_from_node(struct pnp_dev *dev, struct pnp_bios_node *node);
|
||||||
extern int pnpbios_write_resources_to_node(struct pnp_resource_table *res, struct pnp_bios_node * node);
|
extern int pnpbios_write_resources_to_node(struct pnp_dev *dev, struct pnp_bios_node *node);
|
||||||
extern void pnpid32_to_pnpid(u32 id, char *str);
|
extern void pnpid32_to_pnpid(u32 id, char *str);
|
||||||
|
|
||||||
extern void pnpbios_print_status(const char * module, u16 status);
|
extern void pnpbios_print_status(const char * module, u16 status);
|
||||||
|
@ -54,9 +54,9 @@ inline void pcibios_penalize_isa_irq(int irq, int active)
|
|||||||
* Allocated Resources
|
* Allocated Resources
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res,
|
static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq)
|
||||||
int irq)
|
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (!(res->irq_resource[i].flags & IORESOURCE_UNSET)
|
while (!(res->irq_resource[i].flags & IORESOURCE_UNSET)
|
||||||
@ -74,9 +74,9 @@ static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res,
|
static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma)
|
||||||
int dma)
|
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (i < PNP_MAX_DMA &&
|
while (i < PNP_MAX_DMA &&
|
||||||
@ -93,9 +93,10 @@ static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res,
|
static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev,
|
||||||
int io, int len)
|
int io, int len)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (!(res->port_resource[i].flags & IORESOURCE_UNSET)
|
while (!(res->port_resource[i].flags & IORESOURCE_UNSET)
|
||||||
@ -112,9 +113,10 @@ static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res,
|
static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev,
|
||||||
int mem, int len)
|
int mem, int len)
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (!(res->mem_resource[i].flags & IORESOURCE_UNSET)
|
while (!(res->mem_resource[i].flags & IORESOURCE_UNSET)
|
||||||
@ -131,11 +133,9 @@ static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
|
||||||
unsigned char *end,
|
unsigned char *p,
|
||||||
struct
|
unsigned char *end)
|
||||||
pnp_resource_table
|
|
||||||
*res)
|
|
||||||
{
|
{
|
||||||
unsigned int len, tag;
|
unsigned int len, tag;
|
||||||
int io, size, mask, i;
|
int io, size, mask, i;
|
||||||
@ -144,7 +144,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Blank the resource table values */
|
/* Blank the resource table values */
|
||||||
pnp_init_resource_table(res);
|
pnp_init_resource_table(&dev->res);
|
||||||
|
|
||||||
while ((char *)p < (char *)end) {
|
while ((char *)p < (char *)end) {
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
goto len_err;
|
goto len_err;
|
||||||
io = *(short *)&p[4];
|
io = *(short *)&p[4];
|
||||||
size = *(short *)&p[10];
|
size = *(short *)&p[10];
|
||||||
pnpbios_parse_allocated_memresource(res, io, size);
|
pnpbios_parse_allocated_memresource(dev, io, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LARGE_TAG_ANSISTR:
|
case LARGE_TAG_ANSISTR:
|
||||||
@ -180,7 +180,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
goto len_err;
|
goto len_err;
|
||||||
io = *(int *)&p[4];
|
io = *(int *)&p[4];
|
||||||
size = *(int *)&p[16];
|
size = *(int *)&p[16];
|
||||||
pnpbios_parse_allocated_memresource(res, io, size);
|
pnpbios_parse_allocated_memresource(dev, io, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LARGE_TAG_FIXEDMEM32:
|
case LARGE_TAG_FIXEDMEM32:
|
||||||
@ -188,7 +188,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
goto len_err;
|
goto len_err;
|
||||||
io = *(int *)&p[4];
|
io = *(int *)&p[4];
|
||||||
size = *(int *)&p[8];
|
size = *(int *)&p[8];
|
||||||
pnpbios_parse_allocated_memresource(res, io, size);
|
pnpbios_parse_allocated_memresource(dev, io, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMALL_TAG_IRQ:
|
case SMALL_TAG_IRQ:
|
||||||
@ -199,7 +199,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
for (i = 0; i < 16; i++, mask = mask >> 1)
|
for (i = 0; i < 16; i++, mask = mask >> 1)
|
||||||
if (mask & 0x01)
|
if (mask & 0x01)
|
||||||
io = i;
|
io = i;
|
||||||
pnpbios_parse_allocated_irqresource(res, io);
|
pnpbios_parse_allocated_irqresource(dev, io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMALL_TAG_DMA:
|
case SMALL_TAG_DMA:
|
||||||
@ -210,7 +210,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
for (i = 0; i < 8; i++, mask = mask >> 1)
|
for (i = 0; i < 8; i++, mask = mask >> 1)
|
||||||
if (mask & 0x01)
|
if (mask & 0x01)
|
||||||
io = i;
|
io = i;
|
||||||
pnpbios_parse_allocated_dmaresource(res, io);
|
pnpbios_parse_allocated_dmaresource(dev, io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMALL_TAG_PORT:
|
case SMALL_TAG_PORT:
|
||||||
@ -218,7 +218,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
goto len_err;
|
goto len_err;
|
||||||
io = p[2] + p[3] * 256;
|
io = p[2] + p[3] * 256;
|
||||||
size = p[7];
|
size = p[7];
|
||||||
pnpbios_parse_allocated_ioresource(res, io, size);
|
pnpbios_parse_allocated_ioresource(dev, io, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMALL_TAG_VENDOR:
|
case SMALL_TAG_VENDOR:
|
||||||
@ -230,7 +230,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
|
|||||||
goto len_err;
|
goto len_err;
|
||||||
io = p[1] + p[2] * 256;
|
io = p[1] + p[2] * 256;
|
||||||
size = p[3];
|
size = p[3];
|
||||||
pnpbios_parse_allocated_ioresource(res, io, size);
|
pnpbios_parse_allocated_ioresource(dev, io, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMALL_TAG_END:
|
case SMALL_TAG_END:
|
||||||
@ -660,12 +660,12 @@ static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res)
|
|||||||
p[3] = len & 0xff;
|
p[3] = len & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p,
|
static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
|
||||||
unsigned char *end,
|
*dev,
|
||||||
struct
|
unsigned char *p,
|
||||||
pnp_resource_table
|
unsigned char *end)
|
||||||
*res)
|
|
||||||
{
|
{
|
||||||
|
struct pnp_resource_table *res = &dev->res;
|
||||||
unsigned int len, tag;
|
unsigned int len, tag;
|
||||||
int port = 0, irq = 0, dma = 0, mem = 0;
|
int port = 0, irq = 0, dma = 0, mem = 0;
|
||||||
|
|
||||||
@ -774,7 +774,7 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev,
|
|||||||
unsigned char *p = (char *)node->data;
|
unsigned char *p = (char *)node->data;
|
||||||
unsigned char *end = (char *)(node->data + node->size);
|
unsigned char *end = (char *)(node->data + node->size);
|
||||||
|
|
||||||
p = pnpbios_parse_allocated_resource_data(p, end, &dev->res);
|
p = pnpbios_parse_allocated_resource_data(dev, p, end);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
p = pnpbios_parse_resource_option_data(p, end, dev);
|
p = pnpbios_parse_resource_option_data(p, end, dev);
|
||||||
@ -786,25 +786,25 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pnpbios_read_resources_from_node(struct pnp_resource_table *res,
|
int pnpbios_read_resources_from_node(struct pnp_dev *dev,
|
||||||
struct pnp_bios_node *node)
|
struct pnp_bios_node *node)
|
||||||
{
|
{
|
||||||
unsigned char *p = (char *)node->data;
|
unsigned char *p = (char *)node->data;
|
||||||
unsigned char *end = (char *)(node->data + node->size);
|
unsigned char *end = (char *)(node->data + node->size);
|
||||||
|
|
||||||
p = pnpbios_parse_allocated_resource_data(p, end, res);
|
p = pnpbios_parse_allocated_resource_data(dev, p, end);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pnpbios_write_resources_to_node(struct pnp_resource_table *res,
|
int pnpbios_write_resources_to_node(struct pnp_dev *dev,
|
||||||
struct pnp_bios_node *node)
|
struct pnp_bios_node *node)
|
||||||
{
|
{
|
||||||
unsigned char *p = (char *)node->data;
|
unsigned char *p = (char *)node->data;
|
||||||
unsigned char *end = (char *)(node->data + node->size);
|
unsigned char *end = (char *)(node->data + node->size);
|
||||||
|
|
||||||
p = pnpbios_encode_allocated_resource_data(p, end, res);
|
p = pnpbios_encode_allocated_resource_data(dev, p, end);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user