Skip to contentSkip to conversation

PNPACPI: handle address descriptors in _PRS

PATCH In review Bjorn Helgaas 2 participants 6 messages Sep 20, 2005 – Sep 23, 2005 5 messages not in the archive

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

PATCH 1/1 PNPACPI: handle address descriptors in _PRS

PNPACPI complained about and ignored devices with ADDRESS16, ADDRESS32, or ADDRESS64 descriptors in _PRS. Those descriptors seem legitimate, and HP firmware uses them for built-in serial ports, so this patch adds support for them.

But I notice the mention of them under "#if 0" -- did somebody explicitly decide not to handle them? If so, what was the reason?

drivers/pnp/pnpacpi/rsparser.c +43 -4
Index: work-vga2/drivers/pnp/pnpacpi/rsparser.c
===================================================================
@@ -453,6 +453,36 @@
 	return;
 }
 
+static void
+pnpacpi_parse_address_option(struct pnp_option *option,
+	struct acpi_resource_address64 *p)
+{
+	struct pnp_mem * mem;
+	struct pnp_port * port;
+
+	if (p->address_length == 0)
+		return;
+
+	if (p->resource_type == ACPI_MEMORY_RANGE) {
+		mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
+		if (!mem)
+			return;
+		mem->min = mem->max = p->min_address_range;
+		mem->size = p->address_length;
+		mem->align = 0;
+		pnp_register_mem_resource(option,mem);
+	} else if (p->resource_type == ACPI_IO_RANGE) {
+		port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
+		if (!port)
+			return;
+		port->min = port->max = p->min_address_range;
+		port->size = p->address_length;
+		port->align = 0;
+		port->flags = PNP_PORT_FLAG_FIXED;
+		pnp_register_port_resource(option,port);
+	}
+}
+
 struct acpipnp_parse_option_s {
 	struct pnp_option *option;
 	struct pnp_option *option_independent;
@@ -466,6 +496,8 @@
 	struct acpipnp_parse_option_s *parse_data = (struct acpipnp_parse_option_s *)data;
 	struct pnp_dev *dev = parse_data->dev;
 	struct pnp_option *option = parse_data->option;
+	struct acpi_resource_address64 addr;
+	acpi_status status;
 
 	switch (res->id) {
 		case ACPI_RSTYPE_IRQ:
@@ -495,6 +527,17 @@
 			pnpacpi_parse_fixed_mem32_option(option,
 				&res->data.fixed_memory32);
 			break;
+		case ACPI_RSTYPE_ADDRESS16:
+		case ACPI_RSTYPE_ADDRESS32:
+		case ACPI_RSTYPE_ADDRESS64:
+			status = acpi_resource_to_address64(res, &addr);
+			if (!ACPI_SUCCESS(status)) {
+				pnp_warn("PnPACPI: failed to convert resource "
+					"type %d", res->id);
+				return AE_ERROR;
+			}
+			pnpacpi_parse_address_option(option, &addr);
+			break;
 		case ACPI_RSTYPE_START_DPF:
 			switch (res->data.start_dpf.compatibility_priority) {
 				case ACPI_GOOD_CONFIGURATION:
@@ -568,11 +611,9 @@
 	case ACPI_RSTYPE_MEM24:
 	case ACPI_RSTYPE_MEM32:
 	case ACPI_RSTYPE_FIXED_MEM32:
-#if 0
 	case ACPI_RSTYPE_ADDRESS16:
 	case ACPI_RSTYPE_ADDRESS32:
 	case ACPI_RSTYPE_ADDRESS64:
-#endif
 		(*res_cnt) ++;
 	default:
 		return AE_OK;
@@ -593,11 +634,9 @@
 	case ACPI_RSTYPE_MEM24:
 	case ACPI_RSTYPE_MEM32:
 	case ACPI_RSTYPE_FIXED_MEM32:
-#if 0
 	case ACPI_RSTYPE_ADDRESS16:
 	case ACPI_RSTYPE_ADDRESS32:
 	case ACPI_RSTYPE_ADDRESS64:
-#endif
 		(*resource)->id = res->id;
 		(*resource)++;
 	default:

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi,

Quoted 7 lines · Bjorn Helgaas

PNPACPI complained about and ignored devices with ADDRESS16, ADDRESS32, or ADDRESS64 descriptors in _PRS. Those descriptors seem legitimate, and HP firmware uses them for built-in serial ports, so this patch adds support for them.

But I notice the mention of them under "#if 0" -- did somebody explicitly decide not to handle them? If so, what was the reason?

IIRC, the reason is just we did find any pnp device uses it. If hp firmware uses it, we should add the support.
You might have missed the similar change in pnpacpi_encode_resources in your patch. It's used when we assign new resources (_SRS method) to pnp devices.

Thanks,
Shaohua

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

A message that is not in the archive (sent off-list or not yet received): 1127265452.4040.3.camel-ECwVeV2eNyQD0+JXs3kMbRL4W9x8LtSr@public.gmane.org

#4 lore raw
Quoted 9 lines · Shaohua Li
Quoted 4 lines · Bjorn Helgaas

PNPACPI complained about and ignored devices with ADDRESS16, ADDRESS32, or ADDRESS64 descriptors in _PRS. Those descriptors seem legitimate, and HP firmware uses them for built-in serial ports, so this patch adds support for them.

You might have missed the similar change in pnpacpi_encode_resources in your patch. It's used when we assign new resources (_SRS method) to pnp devices.

You're right, I did miss the corresponding encoding change. I'll add that. I feel a bit uneasy about it, though, because it will be a fair amount of code, and I don't know how to test it. Do we ever really use _SRS today? And there's information lost when decoding the ACPI resources, such as the _TRA.

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 13 lines · Bjorn Helgaas
Quoted 2 lines · Shaohua Li
Quoted 1 line · Bjorn Helgaas

PNPACPI complained about and ignored devices with ADDRESS16,

ADDRESS32,

Quoted 1 line
Quoted 1 line

or ADDRESS64 descriptors in _PRS. Those descriptors seem

legitimate,

Quoted 1 line
Quoted 1 line

and HP firmware uses them for built-in serial ports, so this patch

adds

Quoted 3 lines
Quoted 1 line

support for them.

You might have missed the similar change in pnpacpi_encode_resources

in

Quoted 1 line

your patch. It's used when we assign new resources (_SRS method) to

Quoted 8 lines

pnp

Quoted 1 line

devices.

You're right, I did miss the corresponding encoding change. I'll add that. I feel a bit uneasy about it, though, because it will be a fair amount of code, and I don't know how to test it. Do we ever really use _SRS today? And there's information lost when decoding the ACPI resources, such as the _TRA.

We did use _SRS, at least under x86. This only is done when some PNP devices havn't resources, so only very small number of systems need it. Ignoring it might be ok currently, if HP firmware always assigns resources to PNP devices. Yes, we did lose the info of _TRA. I didn't find any system uses it. Maybe some big IA64 systems use.

Thanks,
Shaohua

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

A message that is not in the archive (sent off-list or not yet received): 1127350144.3961.5.camel-ECwVeV2eNyQD0+JXs3kMbRL4W9x8LtSr@public.gmane.org

#8 lore raw
Quoted 22 lines · Shaohua Li
Quoted 13 lines · Bjorn Helgaas
Quoted 2 lines · Shaohua Li
Quoted 1 line · Bjorn Helgaas

PNPACPI complained about and ignored devices with ADDRESS16,

ADDRESS32,

Quoted 1 line
Quoted 1 line

or ADDRESS64 descriptors in _PRS. Those descriptors seem

legitimate,

Quoted 1 line
Quoted 1 line

and HP firmware uses them for built-in serial ports, so this patch

adds

Quoted 3 lines
Quoted 1 line

support for them.

You might have missed the similar change in pnpacpi_encode_resources

in

Quoted 1 line

your patch. It's used when we assign new resources (_SRS method) to

Quoted 8 lines

pnp

Quoted 1 line

devices.

You're right, I did miss the corresponding encoding change. I'll add that. I feel a bit uneasy about it, though, because it will be a fair amount of code, and I don't know how to test it. Do we ever really use _SRS today? And there's information lost when decoding the ACPI resources, such as the _TRA.

Quoted 5 lines

We did use _SRS, at least under x86. This only is done when some PNP devices havn't resources, so only very small number of systems need it. Ignoring it might be ok currently, if HP firmware always assigns resources to PNP devices. Yes, we did lose the info of _TRA. I didn't find any system uses it. Maybe some big IA64 systems use.

HP ia64 systems definitely use _TRA. I would expect most systems with multiple PCI root bridges would use _TRA, because if you don't, the amount of 32-bit PCI bus address space you can use is severely limited.

HP firmware does assign resources to the PNP devices (typically they're things hardwired onto the motherboard at fixed addresses). So we don't actually need the encoding changes at the moment.

I'm inclined to just leave the encoding out for now. That way, we don't carry around the untested code, and if somebody eventually tries to use it, the attempt to set resources will fail, and we can write the code and test it at that time.

What do you think?

Bjorn

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 34 lines · Bjorn Helgaas
Quoted 22 lines · Shaohua Li
Quoted 13 lines · Bjorn Helgaas
Quoted 2 lines · Shaohua Li
Quoted 1 line · Bjorn Helgaas

PNPACPI complained about and ignored devices with ADDRESS16,

ADDRESS32,

Quoted 1 line
Quoted 1 line

or ADDRESS64 descriptors in _PRS. Those descriptors seem

legitimate,

Quoted 1 line
Quoted 1 line

and HP firmware uses them for built-in serial ports, so this patch

adds

Quoted 3 lines
Quoted 1 line

support for them.

You might have missed the similar change in pnpacpi_encode_resources

in

Quoted 1 line

your patch. It's used when we assign new resources (_SRS method) to

Quoted 8 lines

pnp

Quoted 1 line

devices.

You're right, I did miss the corresponding encoding change. I'll add that. I feel a bit uneasy about it, though, because it will be a fair amount of code, and I don't know how to test it. Do we ever really use _SRS today? And there's information lost when decoding the ACPI resources, such as the _TRA.

Quoted 5 lines

We did use _SRS, at least under x86. This only is done when some PNP devices havn't resources, so only very small number of systems need it. Ignoring it might be ok currently, if HP firmware always assigns resources to PNP devices. Yes, we did lose the info of _TRA. I didn't find any system uses it. Maybe some big IA64 systems use.

HP ia64 systems definitely use _TRA. I would expect most systems with multiple PCI root bridges would use _TRA, because if you don't, the amount of 32-bit PCI bus address space you can use is severely limited.

Quoted 8 lines

HP firmware does assign resources to the PNP devices (typically they're things hardwired onto the motherboard at fixed addresses). So we don't actually need the encoding changes at the moment.

I'm inclined to just leave the encoding out for now. That way, we don't carry around the untested code, and if somebody eventually tries to use it, the attempt to set resources will fail, and we can write the code and test it at that time.

Ok, lets wait till it actually is used.

Thanks,
Shaohua

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php