Re: PNP parallel&serial ports: module reload fails (2.6.11)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 09, 2005 at 12:29:25AM +0400, Michael Tokarev wrote:
> Adam Belay wrote:
> []
> >>>>[ it's in http://www.corpit.ru/mjt/hpml310.dsdt - apache ships it
> >>>> as Content-Type: text/plain, for some reason.  I grabbed iasl
> >>>> and converted that stuff into .dsls, available at:
> >>>> http://www.corpit.ru/mjt/hpml310.dsl and
> >>>> http://www.corpit.ru/mjt/hpml150.dsl ]
> []
> > Hi,
> > 
> > I'm sorry for the delayed response, as this bug is very difficult to
> > track down.  The information you provided was helpful and I appreciate
> > it.  I have a theory as to what is going on, and the patch below might
> > solve your problem.  If not, it will at least give us some more
> > information.
> 
> Well, not much of info, really.. ;)
> 
> > The following would be useful:
> > 
> > 1.) a complete dmesg after initial boot with the patch
> > 2.) kernel message output after "rmmod parport_pc" and "modprobe
> > parport_pc" with the patch
> 
> Here it is.  From HP ML 150 box.  I compiled 2.6.11-rc6 with
> the patch you've sent.
> 

Sorry, I forgot to set the range length, so it looped in
acpi_rs_list_to_byte_stream forever, instead of making it to _SRS.
This rediff should fix the problem.

Thanks,
Adam

--- a/drivers/pnp/pnpacpi/core.c	2005-03-02 02:38:09.000000000 -0500
+++ b/drivers/pnp/pnpacpi/core.c	2005-06-08 19:37:12.000000000 -0400
@@ -99,17 +99,21 @@
 	int ret = 0;
 	acpi_status status;
 
+	printk (KERN_INFO "pnp: building resource template\n");
 	ret = pnpacpi_build_resource_template(handle, &buffer);
 	if (ret)
 		return ret;
+	printk (KERN_INFO "pnp: encoding resources\n");
 	ret = pnpacpi_encode_resources(res, &buffer);
 	if (ret) {
 		kfree(buffer.pointer);
 		return ret;
 	}
+	printk (KERN_INFO "pnp: setting resources\n");
 	status = acpi_set_current_resources(handle, &buffer);
 	if (ACPI_FAILURE(status))
 		ret = -EINVAL;
+	printk (KERN_INFO "pnp: _SRS worked correctly\n");
 	kfree(buffer.pointer);
 	return ret;
 }
--- a/drivers/pnp/pnpacpi/rsparser.c	2005-05-27 22:06:02.000000000 -0400
+++ b/drivers/pnp/pnpacpi/rsparser.c	2005-06-08 19:38:14.802869256 -0400
@@ -178,6 +178,8 @@
 		if (res->data.dma.number_of_channels > 0)
 			pnpacpi_parse_allocated_dmaresource(res_table, 
 					res->data.dma.channels[0]);
+		else
+			printk(KERN_INFO "pnp: skipping dma from _CRS\n");
 		break;
 	case ACPI_RSTYPE_IO:
 		pnpacpi_parse_allocated_ioresource(res_table, 
@@ -242,8 +244,10 @@
 	int i;
 	struct pnp_dma * dma;
 
-	if (p->number_of_channels == 0)
+	if (p->number_of_channels == 0) {
+		printk(KERN_INFO "pnp: broken dma code, fix me\n");
 		return;
+	}
 	dma = pnpacpi_kmalloc(sizeof(struct pnp_dma), GFP_KERNEL);
 	if (!dma)
 		return;
@@ -298,8 +302,10 @@
 	int i;
 	struct pnp_irq * irq;
 	
-	if (p->number_of_interrupts == 0)
+	if (p->number_of_interrupts == 0) {
+		printk(KERN_INFO "pnp: broken irq code, fix me\n");
 		return;
+	}
 	irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL);
 	if (!irq)
 		return;
@@ -625,7 +631,15 @@
 	struct resource *p)
 {
 	int edge_level, active_high_low;
-	
+
+	if (p->flags & IORESOURCE_UNSET) {
+		printk(KERN_INFO "bug squashed - irq\n");
+		resource->id = ACPI_RSTYPE_IRQ;
+		resource->length = sizeof(struct acpi_resource);
+		resource->data.irq.number_of_interrupts = 0;
+		return;
+	}
+
 	decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 
 		&active_high_low);
 	resource->id = ACPI_RSTYPE_IRQ;
@@ -636,6 +650,18 @@
 		resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
 	else
 		resource->data.irq.shared_exclusive = ACPI_SHARED;
+
+	if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
+		ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
+		ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
+		printk(KERN_INFO "pnp: irq flags are correct\n");
+	} else {
+		printk(KERN_INFO "pnp: attempting to fix irq flags\n");
+		resource->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
+		resource->data.irq.active_high_low = ACPI_ACTIVE_HIGH;
+		resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+	}
+
 	resource->data.irq.number_of_interrupts = 1;
 	resource->data.irq.interrupts[0] = p->start;
 }
@@ -644,6 +670,14 @@
 	struct resource *p)
 {
 	int edge_level, active_high_low;
+
+	if (p->flags & IORESOURCE_UNSET) {
+		printk(KERN_INFO "bug squashed - irq_ext\n");
+		resource->id = ACPI_RSTYPE_EXT_IRQ;
+		resource->length = sizeof(struct acpi_resource);
+		resource->data.extended_irq.number_of_interrupts = 0;
+		return;
+	}
 	
 	decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 
 		&active_high_low);
@@ -663,6 +697,14 @@
 static void pnpacpi_encode_dma(struct acpi_resource *resource,
 	struct resource *p)
 {
+	if (p->flags & IORESOURCE_UNSET) {
+		printk(KERN_INFO "bug squashed - dma \n");
+		resource->id = ACPI_RSTYPE_DMA;
+		resource->length = sizeof(struct acpi_resource);
+		resource->data.dma.number_of_channels = 0;
+		return;
+	}
+
 	resource->id = ACPI_RSTYPE_DMA;
 	resource->length = sizeof(struct acpi_resource);
 	/* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
@@ -695,7 +737,6 @@
 		ACPI_DECODE_16 : ACPI_DECODE_10; 
 	resource->data.io.min_base_address = p->start;
 	resource->data.io.max_base_address = p->end;
-	resource->data.io.alignment = 0; /* Correct? */
 	resource->data.io.range_length = p->end - p->start + 1;
 }
 
@@ -719,7 +760,6 @@
 		ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
 	resource->data.memory24.min_base_address = p->start;
 	resource->data.memory24.max_base_address = p->end;
-	resource->data.memory24.alignment = 0;
 	resource->data.memory24.range_length = p->end - p->start + 1;
 }
 
@@ -733,7 +773,6 @@
 		ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
 	resource->data.memory32.min_base_address = p->start;
 	resource->data.memory32.max_base_address = p->end;
-	resource->data.memory32.alignment = 0;
 	resource->data.memory32.range_length = p->end - p->start + 1;
 }
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux