public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Belay <ambx1@neo.rr.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: matthieu castet <castet.matthieu@free.fr>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: PNP parallel&serial ports: module reload fails (2.6.11)?
Date: Wed, 08 Jun 2005 19:52:41 -0400	[thread overview]
Message-ID: <1118274762.29855.2.camel@localhost.localdomain> (raw)
In-Reply-To: <42A75525.3050704@tls.msk.ru>

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;
 }
 



  reply	other threads:[~2005-06-09  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02 22:24 Re:PNP parallel&serial ports: module reload fails (2.6.11)? castet.matthieu
2005-06-03  0:18 ` PNP " Michael Tokarev
2005-06-03  5:58   ` matthieu castet
2005-06-05 10:14   ` matthieu castet
2005-06-05 10:27   ` matthieu castet
2005-06-06 15:01     ` Michael Tokarev
2005-06-06 15:43       ` castet.matthieu
2005-06-06 21:18       ` Adam Belay
2005-06-06 22:43         ` Michael Tokarev
2005-06-08  9:52           ` Adam Belay
2005-06-08 20:29             ` Michael Tokarev
2005-06-08 23:52               ` Adam Belay [this message]
2005-06-09 21:07                 ` Michael Tokarev
2005-06-09 21:16                   ` Russell King
2005-06-10 16:01                     ` Bjorn Helgaas
2005-06-10 16:20                       ` Dmitry Torokhov
2005-06-10 16:26                         ` Bjorn Helgaas
2005-06-10 16:30                       ` Russell King
2005-06-14 19:40                   ` Adam Belay
  -- strict thread matches above, loose matches on Subject: below --
2005-05-31 23:01 Michael Tokarev
2005-06-01  5:04 ` Andrew Morton
2005-06-01 15:20   ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118274762.29855.2.camel@localhost.localdomain \
    --to=ambx1@neo.rr.com \
    --cc=akpm@osdl.org \
    --cc=castet.matthieu@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox