Fix DMA resource allocation in ACPIPnP

The ACPIPnP implementation had the understanding of Linux resource flags very
wrong, resulting in a nonfunctional implementation of DMA resource
allocation.

This was usually not a problem, since almost no on-board PnP devices use ISA
DMA, with the exception of ECP parallel ports. Even with that, parallel port
DMA is preconfigured by the BIOS, so this routine isn't normally called.

Except in the case where somebody does 'rmmod parport_pc; modprobe
parport_pc', where the rmmod case disables the ECP parallel port resources,
and they need to be enabled again to initialize the module. This didn't
work, resulting in a non-printing printer.

The application doing exactly the above to force reprobing of printers is
the YaST printer module. Thus without this fix YaST wedged the printer when
configuring it, and was not able to print a test page.

Reported-by: Ralf Flaxa <rf@suse.de>
Reproduced-by: Jiri Dluhos <jdluhos@suse.cz>
Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Vojtech Pavlik 2006-04-07 20:00:27 +02:00 committed by Greg Kroah-Hartman
parent b5e4efe7e0
commit ccc4c7bbd6
1 changed files with 26 additions and 15 deletions

View File

@ -776,21 +776,32 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
struct resource *p) struct resource *p)
{ {
/* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
if (p->flags & IORESOURCE_DMA_COMPATIBLE) switch (p->flags & IORESOURCE_DMA_SPEED_MASK) {
resource->data.dma.type = ACPI_COMPATIBILITY; case IORESOURCE_DMA_TYPEA:
else if (p->flags & IORESOURCE_DMA_TYPEA)
resource->data.dma.type = ACPI_TYPE_A; resource->data.dma.type = ACPI_TYPE_A;
else if (p->flags & IORESOURCE_DMA_TYPEB) break;
case IORESOURCE_DMA_TYPEB:
resource->data.dma.type = ACPI_TYPE_B; resource->data.dma.type = ACPI_TYPE_B;
else if (p->flags & IORESOURCE_DMA_TYPEF) break;
case IORESOURCE_DMA_TYPEF:
resource->data.dma.type = ACPI_TYPE_F; resource->data.dma.type = ACPI_TYPE_F;
if (p->flags & IORESOURCE_DMA_8BIT) break;
default:
resource->data.dma.type = ACPI_COMPATIBILITY;
}
switch (p->flags & IORESOURCE_DMA_TYPE_MASK) {
case IORESOURCE_DMA_8BIT:
resource->data.dma.transfer = ACPI_TRANSFER_8; resource->data.dma.transfer = ACPI_TRANSFER_8;
else if (p->flags & IORESOURCE_DMA_8AND16BIT) break;
case IORESOURCE_DMA_8AND16BIT:
resource->data.dma.transfer = ACPI_TRANSFER_8_16; resource->data.dma.transfer = ACPI_TRANSFER_8_16;
else if (p->flags & IORESOURCE_DMA_16BIT) break;
default:
resource->data.dma.transfer = ACPI_TRANSFER_16; resource->data.dma.transfer = ACPI_TRANSFER_16;
resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; }
resource->data.dma.bus_master = !!(p->flags & IORESOURCE_DMA_MASTER);
resource->data.dma.channel_count = 1; resource->data.dma.channel_count = 1;
resource->data.dma.channels[0] = p->start; resource->data.dma.channels[0] = p->start;
} }