Skip to contentSkip to conversation

PNPACPI: fix types when decoding ACPI resources [resend]

PATCH In review Bjorn Helgaas 4 participants 14 messages Aug 2, 2005 – Aug 28, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PNPACPI: fix types when decoding ACPI resources [resend]

Any objections to the patch below? I posted it last Wednesday, but haven't heard anything. Once we have this fix, 8250_pnp should have sufficient functionality that we can get rid of 8250_acpi.

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

drivers/pnp/pnpacpi/rsparser.c +12 -12
Index: work/drivers/pnp/pnpacpi/rsparser.c
===================================================================
@@ -73,7 +73,7 @@
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 irq)
 {
 	int i = 0;
 	while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
@@ -85,13 +85,13 @@
 			res->irq_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->irq_resource[i].start =(unsigned long) irq;
-		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].start = irq;
+		res->irq_resource[i].end = irq;
 	}
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 {
 	int i = 0;
 	while (i < PNP_MAX_DMA &&
@@ -103,14 +103,14 @@
 			res->dma_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->dma_resource[i].start =(unsigned long) dma;
-		res->dma_resource[i].end = (unsigned long) dma;
+		res->dma_resource[i].start = dma;
+		res->dma_resource[i].end = dma;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-	int io, int len)
+	u32 io, u32 len)
 {
 	int i = 0;
 	while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -122,14 +122,14 @@
 			res->port_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->port_resource[i].start = (unsigned long) io;
-		res->port_resource[i].end = (unsigned long)(io + len - 1);
+		res->port_resource[i].start = io;
+		res->port_resource[i].end = io + len - 1;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
-	int mem, int len)
+	u64 mem, u64 len)
 {
 	int i = 0;
 	while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -141,8 +141,8 @@
 			res->mem_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->mem_resource[i].start = (unsigned long) mem;
-		res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+		res->mem_resource[i].start = mem;
+		res->mem_resource[i].end = mem + len - 1;
 	}
 }
 

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#1 lore raw
Quoted 7 lines · Bjorn Helgaas

Any objections to the patch below? I posted it last Wednesday, but haven't heard anything. Once we have this fix, 8250_pnp should have sufficient functionality that we can get rid of 8250_acpi.

Quoted 7 lines

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

We might always use 'unsigned long'. Did you have plan to remove other legacy acpi drivers?

Thanks,
Shaohua

#2 lore raw
Quoted 6 lines · Shaohua Li
Quoted 5 lines · Bjorn Helgaas

Any objections to the patch below? I posted it last Wednesday, but haven't heard anything. Once we have this fix, 8250_pnp should have sufficient functionality that we can get rid of 8250_acpi.

Quoted 8 lines
Quoted 7 lines

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

We might always use 'unsigned long'.

Do you have a reason for preferring 'unsigned long' over the exact types used in the ACPI resource structures? I thought it was useful to use the exact types, because then whatever conversion needs to happen is all in one place.

In the existing code, there's implicit conversion when you call "pnpacpi_parse_allocated_memresource(..., int mem, int len)" and pass u64 values as "mem" and "len". You have to look both at the call site and the called code. And gcc doesn't even complain about this truncation.

But I guess it doesn't matter much either way.

Quoted 2 lines

Did you have plan to remove other
legacy acpi drivers?

No, I didn't -- which ones are you thinking about? Looking at the callers of acpi_bus_register_driver(), I see:

arch/ia64/hp/common/sba_iommu.c
Probably can't be converted because it needs the ACPI handle to extract a vendor-specific data item from _CRS.

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

Then of course, there are a bunch of things in drivers/acpi/ (battery, button, fan, ec, etc). I expect the reason they are in drivers/acpi/ is because they need ACPI-specific functionality, so they probably couldn't be converted to PNP.

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#3 lore raw

Hi,

Quoted 10 lines · Bjorn Helgaas
Quoted 2 lines · Shaohua Li

Did you have plan to remove other
legacy acpi drivers?

No, I didn't -- which ones are you thinking about? Looking at the callers of acpi_bus_register_driver(), I see:

looking for METHOD_NAME__CRS is more acurate.

Quoted 9 lines

arch/ia64/hp/common/sba_iommu.c
Probably can't be converted because it needs the ACPI handle to extract a vendor-specific data item from _CRS.

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

IIRC, I am not sure that the pnp layer was able to pass the 64 bits memory adress for hpet correctly. But it would be nice if it works.

There are drivers/acpi/motherboard.c that done some stuff already handle by pnp/system.c.

There was an extention of a floppy driver in order to use acpi in -mm, but it seems to have been dropped.

Quoted 5 lines

Then of course, there are a bunch of things in drivers/acpi/ (battery, button, fan, ec, etc). I expect the reason they are in drivers/acpi/ is because they need ACPI-specific functionality, so they probably couldn't be converted to PNP.

yes.

Matthieu

PS : I saw in acpi ols paper that you plan once all dupe acpi drivers will be removed to register again the pnp device in acpi layer. Do you plan to add more check and for example add only device that have a CRS in pnp layer ?

PPS : is there any plan to integrate http://marc.theaimsgroup.com/?l=linux-kernel&m=111827568001255&w=2 that seem to fix some init problem ?

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#4 lore raw
Quoted 7 lines · matthieu castet
Quoted 5 lines · Bjorn Helgaas
Quoted 2 lines · Shaohua Li

Did you have plan to remove other
legacy acpi drivers?

No, I didn't -- which ones are you thinking about? Looking at the callers of acpi_bus_register_driver(), I see:

looking for METHOD_NAME__CRS is more acurate.

I didn't see any new ones when I looked for METHOD_NAME__CRS.

Quoted 5 lines
Quoted 3 lines

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

IIRC, I am not sure that the pnp layer was able to pass the 64 bits memory adress for hpet correctly. But it would be nice if it works.

You're right, this was broken. But I've been pushing a PNPACPI patch to fix this.

Quoted 2 lines

There was an extention of a floppy driver in order to use acpi in -mm, but it seems to have been dropped.

Yeah, I did that, and it was a huge mistake. The point was to avoid blind probing for the device, but my concern was for ia64, and no ia64 boxes have floppy, so it's much easier to just not build the driver.

Quoted 4 lines

PS : I saw in acpi ols paper that you plan once all dupe acpi drivers will be removed to register again the pnp device in acpi layer. Do you plan to add more check and for example add only device that have a CRS in pnp layer ?

If you mean the last paragraph of section 6, I don't really understand it. But it mentions 8250_acpi.c as an obstacle, and I do know that we are very close to being able to remove that. I've already posted two patches (one to PNPACPI to fix the 64-bit address problem, and one to 8250_pnp to add support for MMIO UARTs). Once those are accepted, we should be able to remove 8250_acpi.c. I think only ia64 really relies on it anyway.

Quoted 2 lines

PPS : is there any plan to integrate
http://marc.theaimsgroup.com/?l=linux-kernel&m=111827568001255&w=2

I'm afraid I don't know anything about this one.

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#5 lore raw

Hi,

Quoted 13 lines · Bjorn Helgaas
Quoted 5 lines · matthieu castet
Quoted 3 lines · Bjorn Helgaas

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

IIRC, I am not sure that the pnp layer was able to pass the 64 bits memory adress for hpet correctly. But it would be nice if it works.

You're right, this was broken. But I've been pushing a PNPACPI patch to fix this.

Yes but is ACPI_RSTYPE_ADDRESS64 possible on 32 bit machine ?
In this case your patch won't work as res->mem_resource[i].start and res->mem_resource[i].end are unsigned long, and 64 bit value won't fit.

Matthieu

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#6 lore raw
Quoted 6 lines · matthieu castet
Quoted 5 lines · Bjorn Helgaas
Quoted 4 lines · matthieu castet
Quoted 3 lines · Bjorn Helgaas

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

IIRC, I am not sure that the pnp layer was able to pass the 64 bits memory adress for hpet correctly. But it would be nice if it works.

You're right, this was broken. But I've been pushing a PNPACPI patch to fix this.

Yes but is ACPI_RSTYPE_ADDRESS64 possible on 32 bit machine ?

I can't think of a case where that would make sense, but I don't actually know the answer.

Quoted 2 lines

In this case your patch won't work as res->mem_resource[i].start and res->mem_resource[i].end are unsigned long, and 64 bit value won't fit.

True. But fixing that would be pretty far-reaching (changing struct resource), so I'm not worried until it is shown to be a problem.

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#7 lore raw
Quoted 25 lines · Bjorn Helgaas
Quoted 10 lines · matthieu castet
Quoted 8 lines · Bjorn Helgaas
Quoted 6 lines · matthieu castet
Quoted 3 lines · Bjorn Helgaas

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

IIRC, I am not sure that the pnp layer was able to pass the 64 bits memory adress for hpet correctly. But it would be nice if it works.

You're right, this was broken. But I've been pushing a PNPACPI patch to fix this.

Yes but is ACPI_RSTYPE_ADDRESS64 possible on 32 bit machine ?

I can't think of a case where that would make sense, but I don't actually know the answer.

Quoted 6 lines
Quoted 1 line

In this case your patch won't work as res->mem_resource[i].start and res->mem_resource[i].end are unsigned long, and 64 bit value won't fit.

True. But fixing that would be pretty far-reaching (changing struct resource), so I'm not worried until it is shown to be a problem.

Ok, may be you could add a BUG_ON(sizeof(long)==4) for ACPI_RSTYPE_ADDRESS64.

Matthieu

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#8 lore raw
In reply to matthieu castet
Quoted 3 lines · matthieu castet

There are drivers/acpi/motherboard.c that done some stuff already handle by pnp/system.c.

Yes, it should be disabled if pnpacpi is enabled. The only concern is motherboard.c also request some ACPI resources, which might not declaim in ACPI motherboard device, but it's completely BIOS dependent. We might could try remove it at -mm tree to see if it breaks any system later.

Quoted 5 lines

PS : I saw in acpi ols paper that you plan once all dupe acpi drivers will be removed to register again the pnp device in acpi layer. Do you plan to add more check and for example add only device that have a CRS in pnp layer ?

For detecting PNP device? it's worthy trying.

Thanks,
Shaohua

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#9 lore raw

Hi,

Quoted 5 lines · Shaohua Li
Quoted 1 line · matthieu castet

There are drivers/acpi/motherboard.c that done some stuff already handle by pnp/system.c.

Yes, it should be disabled if pnpacpi is enabled.

But even if pnpacpi is disabled, pnp/system.c sould work with pnpbios.

Quoted 6 lines

The only concern is
motherboard.c also request some ACPI resources, which might not declaim in ACPI motherboard device, but it's completely BIOS dependent. We might could try remove it at -mm tree to see if it breaks any system later.

Ok,
may be we should split in 2 modules : the one that request some ACPI resources and the other that use PNP resource.

Quoted 4 lines
Quoted 1 line

PS : I saw in acpi ols paper that you plan once all dupe acpi drivers will be removed to register again the pnp device in acpi layer. Do you plan to add more check and for example add only device that have a CRS in pnp layer ?

For detecting PNP device? it's worthy trying.

I will send a patch for that.

Matthieu

#10 lore raw
In reply to Bjorn Helgaas
Quoted 21 lines · Bjorn Helgaas
Quoted 6 lines · Shaohua Li
Quoted 5 lines · Bjorn Helgaas

Any objections to the patch below? I posted it last Wednesday, but haven't heard anything. Once we have this fix, 8250_pnp should have sufficient functionality that we can get rid of 8250_acpi.

Quoted 8 lines
Quoted 7 lines

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

We might always use 'unsigned long'.

Do you have a reason for preferring 'unsigned long' over the exact types used in the ACPI resource structures? I thought it was useful to use the exact types, because then whatever conversion needs to happen is all in one place.

Quoted 7 lines

In the existing code, there's implicit conversion when you call "pnpacpi_parse_allocated_memresource(..., int mem, int len)" and pass u64 values as "mem" and "len". You have to look both at the call site and the called code. And gcc doesn't even complain about this truncation.

But I guess it doesn't matter much either way.

Either is ok to me.

Quoted 7 lines
Quoted 3 lines

Did you have plan to remove other
legacy acpi drivers?

No, I didn't -- which ones are you thinking about? Looking at the callers of acpi_bus_register_driver(), I see:

Quoted 8 lines

arch/ia64/hp/common/sba_iommu.c
Probably can't be converted because it needs the ACPI handle to extract a vendor-specific data item from _CRS.

drivers/char/hpet.c
This probably should be converted to PNP. I'll look into doing this.

Great! After then we could push the ACPIPNP hotplug staff.

Thanks,
Shaohua

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#11 lore raw
In reply to Bjorn Helgaas

Hi Bjorn,

Quoted 7 lines

static void

drivers/pnp/pnpacpi/rsparser.c +1 -1
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 irq)
 {
 	int i = 0;
 	while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&

drivers/pnp/pnpacpi/rsparser.c line 91

Quoted 9 lines
drivers/pnp/pnpacpi/rsparser.c +2 -2
@@ -85,13 +85,13 @@
 			res->irq_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->irq_resource[i].start =(unsigned long) irq;
-		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].start = irq;
+		res->irq_resource[i].end = irq;
 	}
 }

This breaks the following patch that is already included into -mm tree.

http://sourceforge.net/mailarchive/forum.php?thread_id=7844247&forum_id=6102

I think we need to check if acpi_register_gsi() succeeded or not.

Thanks,
Kenji Kaneshige

Quoted 97 lines · Bjorn Helgaas
(quoted diff) +0 -0
 Any objections to the patch below?  I posted it last Wednesday,

but haven't heard anything. Once we have this fix, 8250_pnp should have sufficient functionality that we can get rid of 8250_acpi.

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

Index: work/drivers/pnp/pnpacpi/rsparser.c
===================================================================

drivers/pnp/pnpacpi/rsparser.c +12 -13
@@ -73,7 +73,7 @@
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 irq)
 {
 	int i = 0;
 	while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
@@ -85,13 +85,13 @@
 			res->irq_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->irq_resource[i].start =(unsigned long) irq;
-		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].start = irq;
+		res->irq_resource[i].end = irq;
 	}
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 {
 	int i = 0;
 	while (i < PNP_MAX_DMA &&
@@ -103,14 +103,14 @@
 			res->dma_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->dma_resource[i].start =(unsigned long) dma;
-		res->dma_resource[i].end = (unsigned long) dma;
+		res->dma_resource[i].start = dma;
+		res->dma_resource[i].end = dma;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-	int io, int len)
+	u32 io, u32 len)
 {
 	int i = 0;
 	while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -122,14 +122,14 @@
 			res->port_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->port_resource[i].start = (unsigned long) io;
-		res->port_resource[i].end = (unsigned long)(io + len - 1);
+		res->port_resource[i].start = io;
+		res->port_resource[i].end = io + len - 1;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
-	int mem, int len)
+	u64 mem, u64 len)
 {
 	int i = 0;
 	while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -141,8 +141,8 @@
 			res->mem_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->mem_resource[i].start = (unsigned long) mem;
-		res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+		res->mem_resource[i].start = mem;
+		res->mem_resource[i].end = mem + len - 1;
 	}
 }
 
 
 
-------------------------------------------------------
Quoted 9 lines

SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#12 lore raw
Quoted 6 lines · Kenji Kaneshige

This breaks the following patch that is already included into -mm tree.

http://sourceforge.net/mailarchive/forum.php?thread_id=7844247&forum_id=6102

I think we need to check if acpi_register_gsi() succeeded or not.

You're absolutely right. I was just based off a Linus tree, non -mm, and didn't notice that your patch conflicted. How about the following (based on 2.6.13-rc4-mm1)? I moved the acpi_register_gsi() into pnpacpi_parse_allocated_irqresource(), which I think is nice because the test for failure is right next to the call.

PNPACPI: fix types when decoding ACPI resources

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

drivers/pnp/pnpacpi/rsparser.c +23 -20
Index: work-mm/drivers/pnp/pnpacpi/rsparser.c
===================================================================
@@ -73,25 +73,28 @@
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
+	int edge_level, int active_high_low)
 {
 	int i = 0;
+	int irq;
 	while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
 			i < PNP_MAX_IRQ)
 		i++;
 	if (i < PNP_MAX_IRQ) {
 		res->irq_resource[i].flags = IORESOURCE_IRQ;  //Also clears _UNSET flag
+		irq = acpi_register_gsi(gsi, edge_level, active_high_low);
 		if (irq < 0) {
 			res->irq_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->irq_resource[i].start =(unsigned long) irq;
-		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].start = irq;
+		res->irq_resource[i].end = irq;
 	}
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 {
 	int i = 0;
 	while (i < PNP_MAX_DMA &&
@@ -103,14 +106,14 @@
 			res->dma_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->dma_resource[i].start =(unsigned long) dma;
-		res->dma_resource[i].end = (unsigned long) dma;
+		res->dma_resource[i].start = dma;
+		res->dma_resource[i].end = dma;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-	int io, int len)
+	u32 io, u32 len)
 {
 	int i = 0;
 	while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -122,14 +125,14 @@
 			res->port_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->port_resource[i].start = (unsigned long) io;
-		res->port_resource[i].end = (unsigned long)(io + len - 1);
+		res->port_resource[i].start = io;
+		res->port_resource[i].end = io + len - 1;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
-	int mem, int len)
+	u64 mem, u64 len)
 {
 	int i = 0;
 	while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -141,8 +144,8 @@
 			res->mem_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->mem_resource[i].start = (unsigned long) mem;
-		res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+		res->mem_resource[i].start = mem;
+		res->mem_resource[i].end = mem + len - 1;
 	}
 }
 
@@ -156,10 +159,10 @@
 	case ACPI_RSTYPE_IRQ:
 		if ((res->data.irq.number_of_interrupts > 0) &&
 			valid_IRQ(res->data.irq.interrupts[0])) {
-			pnpacpi_parse_allocated_irqresource(res_table, 
-				acpi_register_gsi(res->data.irq.interrupts[0],
-					res->data.irq.edge_level,
-					res->data.irq.active_high_low));
+			pnpacpi_parse_allocated_irqresource(res_table,
+				res->data.irq.interrupts[0],
+				res->data.irq.edge_level,
+				res->data.irq.active_high_low);
 			pcibios_penalize_isa_irq(res->data.irq.interrupts[0], 1);
 		}
 		break;
@@ -167,10 +170,10 @@
 	case ACPI_RSTYPE_EXT_IRQ:
 		if ((res->data.extended_irq.number_of_interrupts > 0) &&
 			valid_IRQ(res->data.extended_irq.interrupts[0])) {
-			pnpacpi_parse_allocated_irqresource(res_table, 
-				acpi_register_gsi(res->data.extended_irq.interrupts[0],
-					res->data.extended_irq.edge_level,
-					res->data.extended_irq.active_high_low));
+			pnpacpi_parse_allocated_irqresource(res_table,
+				res->data.extended_irq.interrupts[0],
+				res->data.extended_irq.edge_level,
+				res->data.extended_irq.active_high_low);
 			pcibios_penalize_isa_irq(res->data.extended_irq.interrupts[0], 1);
 		}
 		break;

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

#13 lore raw

Hi Bjorn,

Thank you very much for the new patch
and I'm very sorry for troubling you.

The patch looks very good to me.

Thanks,
Kenji Kaneshige

Quoted 135 lines · Bjorn Helgaas
Quoted 6 lines · Kenji Kaneshige

This breaks the following patch that is already included into -mm tree.

http://sourceforge.net/mailarchive/forum.php?thread_id=7844247&forum_id=6102

I think we need to check if acpi_register_gsi() succeeded or not.

You're absolutely right. I was just based off a Linus tree, non -mm, and didn't notice that your patch conflicted. How about the following (based on 2.6.13-rc4-mm1)? I moved the acpi_register_gsi() into pnpacpi_parse_allocated_irqresource(), which I think is nice because the test for failure is right next to the call.

PNPACPI: fix types when decoding ACPI resources

Use types that match the ACPI resource structures. Previously the u64 value from an RSTYPE_ADDRESS64 was passed as an int, which corrupts the value.

This is one of the things that prevents 8250_pnp from working on HP ia64 boxes. After 8250_pnp works, we will be able to remove 8250_acpi.c.

Index: work-mm/drivers/pnp/pnpacpi/rsparser.c
===================================================================

drivers/pnp/pnpacpi/rsparser.c +19 -17
@@ -73,25 +73,28 @@
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
+	int edge_level, int active_high_low)
 {
 	int i = 0;
+	int irq;
 	while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
 			i < PNP_MAX_IRQ)
 		i++;
 	if (i < PNP_MAX_IRQ) {
 		res->irq_resource[i].flags = IORESOURCE_IRQ;  //Also clears _UNSET flag
+		irq = acpi_register_gsi(gsi, edge_level, active_high_low);
 		if (irq < 0) {
 			res->irq_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->irq_resource[i].start =(unsigned long) irq;
-		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].start = irq;
+		res->irq_resource[i].end = irq;
 	}
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 {
 	int i = 0;
 	while (i < PNP_MAX_DMA &&
@@ -103,14 +106,14 @@
 			res->dma_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->dma_resource[i].start =(unsigned long) dma;
-		res->dma_resource[i].end = (unsigned long) dma;
+		res->dma_resource[i].start = dma;
+		res->dma_resource[i].end = dma;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-	int io, int len)
+	u32 io, u32 len)
 {
 	int i = 0;
 	while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -122,14 +125,14 @@
 			res->port_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->port_resource[i].start = (unsigned long) io;
-		res->port_resource[i].end = (unsigned long)(io + len - 1);
+		res->port_resource[i].start = io;
+		res->port_resource[i].end = io + len - 1;
 	}
 }
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
-	int mem, int len)
+	u64 mem, u64 len)
 {
 	int i = 0;
 	while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -141,8 +144,8 @@
 			res->mem_resource[i].flags |= IORESOURCE_DISABLED;
 			return;
 		}
-		res->mem_resource[i].start = (unsigned long) mem;
-		res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+		res->mem_resource[i].start = mem;
+		res->mem_resource[i].end = mem + len - 1;
 	}
 }
 
@@ -156,10 +159,10 @@
 	case ACPI_RSTYPE_IRQ:
 		if ((res->data.irq.number_of_interrupts > 0) &&
 			valid_IRQ(res->data.irq.interrupts[0])) {
-			pnpacpi_parse_allocated_irqresource(res_table, 
-				acpi_register_gsi(res->data.irq.interrupts[0],
-					res->data.irq.edge_level,
-					res->data.irq.active_high_low));
+			pnpacpi_parse_allocated_irqresource(res_table,
+				res->data.irq.interrupts[0],
+				res->data.irq.edge_level,
+				res->data.irq.active_high_low);
 			pcibios_penalize_isa_irq(res->data.irq.interrupts[0], 1);
 		}
 		break;
@@ -167,10 +170,10 @@
 	case ACPI_RSTYPE_EXT_IRQ:
 		if ((res->data.extended_irq.number_of_interrupts > 0) &&
 			valid_IRQ(res->data.extended_irq.interrupts[0])) {
-			pnpacpi_parse_allocated_irqresource(res_table, 

drivers/pnp/pnpacpi/rsparser.c line 179

Quoted 10 lines
drivers/pnp/pnpacpi/rsparser.c +4 -3
-				acpi_register_gsi(res->data.extended_irq.interrupts[0],
-					res->data.extended_irq.edge_level,
-					res->data.extended_irq.active_high_low));
+			pnpacpi_parse_allocated_irqresource(res_table,
+				res->data.extended_irq.interrupts[0],
+				res->data.extended_irq.edge_level,
+				res->data.extended_irq.active_high_low);
 			pcibios_penalize_isa_irq(res->data.extended_irq.interrupts[0], 1);
 		}
 		break;

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf