diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-05-17 13:06:38 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-05-17 13:06:38 -0700 |
commit | d00a604eef0a8dda16d93fbb423878e703bbc506 (patch) | |
tree | 612767232b316295410c20a0fc896d4e92db020c /pci | |
parent | 468b33ff03bc265acda25ae8d4704210899c753f (diff) | |
download | patches-d00a604eef0a8dda16d93fbb423878e703bbc506.tar.gz |
pci bugfixes
Diffstat (limited to 'pci')
4 files changed, 212 insertions, 23 deletions
diff --git a/pci/acpi_pcihp-add-support-for-_hpx.patch b/pci/acpi_pcihp-add-support-for-_hpx.patch index 201a6c5b71958..e4dafc5655d6b 100644 --- a/pci/acpi_pcihp-add-support-for-_hpx.patch +++ b/pci/acpi_pcihp-add-support-for-_hpx.patch @@ -22,9 +22,9 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/pci/hotplug/acpi_pcihp.c +++ gregkh-2.6/drivers/pci/hotplug/acpi_pcihp.c -@@ -37,6 +37,171 @@ - #define METHOD_NAME__HPP "_HPP" - #define METHOD_NAME_OSHP "OSHP" +@@ -47,6 +47,171 @@ + + static int debug_acpi; +static acpi_status +decode_type0_hpx_record(union acpi_object *record, struct hotplug_params *hpx) @@ -194,7 +194,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> static acpi_status acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) -@@ -50,6 +215,9 @@ acpi_run_hpp(acpi_handle handle, struct +@@ -60,6 +225,9 @@ acpi_run_hpp(acpi_handle handle, struct acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); @@ -204,7 +204,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* get _hpp */ status = acpi_evaluate_object(handle, METHOD_NAME__HPP, NULL, &ret_buf); switch (status) { -@@ -98,15 +266,16 @@ acpi_run_hpp(acpi_handle handle, struct +@@ -108,15 +276,16 @@ acpi_run_hpp(acpi_handle handle, struct } } @@ -230,7 +230,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> free_and_return: kfree(string.pointer); -@@ -174,6 +343,9 @@ acpi_status acpi_get_hp_params_from_firm +@@ -188,6 +357,9 @@ acpi_status acpi_get_hp_params_from_firm * this pci dev. If we don't find any _HPP, use hardcoded defaults */ while (handle) { diff --git a/pci/acpi_pcihp-remove-improper-error-message-about-oshp.patch b/pci/acpi_pcihp-remove-improper-error-message-about-oshp.patch index 2adf2db50eee7..2b0c9471a786d 100644 --- a/pci/acpi_pcihp-remove-improper-error-message-about-oshp.patch +++ b/pci/acpi_pcihp-remove-improper-error-message-about-oshp.patch @@ -1,30 +1,75 @@ -From pcihpd-discuss-admin@lists.sourceforge.net Mon May 1 18:59:10 2006 -Message-ID: <4456BC22.8090806@jp.fujitsu.com> +From kaneshige.kenji@jp.fujitsu.com Wed May 10 06:23:17 2006 +Message-ID: <4461E8A2.10809@jp.fujitsu.com> +Date: Wed, 10 May 2006 22:20:34 +0900 From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> -To: gregkh@suse.de, kristen.c.accardi@intel.com -Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> +To: Rajesh Shah <rajesh.shah@intel.com>, gregkh@suse.de, Greg KH <greg@kroah.com> +Cc: "Accardi, Kristen C" <kristen.c.accardi@intel.com> Subject: acpi_pcihp: Remove improper error message about OSHP -Date: Tue, 02 May 2006 10:55:46 +0900 -This patch removes improper error messages from the acpi_run_oshp() -function. + +This patch converts the improper error message about OSHP evaluation +to debug message which is displayed only when pci_hotplug.ko is loaded +with debugging mode enabled. To do this, this patch adds a new module +parameter "debug_acpi" to pci_hotplug.ko for enabling/disabling debug +messages in acpi_pcihp.c. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Cc: Kristen Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- - drivers/pci/hotplug/acpi_pcihp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + drivers/pci/hotplug/acpi_pcihp.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/drivers/pci/hotplug/acpi_pcihp.c +++ gregkh-2.6/drivers/pci/hotplug/acpi_pcihp.c -@@ -129,7 +129,7 @@ acpi_status acpi_run_oshp(acpi_handle ha +@@ -25,6 +25,7 @@ + */ + + #include <linux/module.h> ++#include <linux/moduleparam.h> + #include <linux/kernel.h> + #include <linux/types.h> + #include <linux/pci.h> +@@ -33,10 +34,19 @@ + #include <acpi/actypes.h> + #include "pci_hotplug.h" + ++#define MY_NAME "acpi_pcihp" ++ ++#define dbg(fmt, arg...) do { if (debug_acpi) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0) ++#define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) ++#define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) ++#define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) ++ + #define METHOD_NAME__SUN "_SUN" + #define METHOD_NAME__HPP "_HPP" + #define METHOD_NAME_OSHP "OSHP" + ++static int debug_acpi; ++ + static acpi_status + acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp) +@@ -130,8 +140,12 @@ acpi_status acpi_run_oshp(acpi_handle ha /* run OSHP */ status = acpi_evaluate_object(handle, METHOD_NAME_OSHP, NULL, NULL); -- if (ACPI_FAILURE(status)) -+ if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) - printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", __FUNCTION__, - (char *)string.pointer, status); + if (ACPI_FAILURE(status)) +- printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", __FUNCTION__, +- (char *)string.pointer, status); ++ if (status != AE_NOT_FOUND) ++ printk(KERN_ERR "%s:%s OSHP fails=0x%x\n", ++ __FUNCTION__, (char *)string.pointer, status); ++ else ++ dbg("%s:%s OSHP not found\n", ++ __FUNCTION__, (char *)string.pointer); else + pr_debug("%s:%s OSHP passes\n", __FUNCTION__, + (char *)string.pointer); +@@ -223,3 +237,6 @@ int acpi_root_bridge(acpi_handle handle) + return 0; + } + EXPORT_SYMBOL_GPL(acpi_root_bridge); ++ ++module_param(debug_acpi, bool, 0644); ++MODULE_PARM_DESC(debug_acpi, "Debugging mode for ACPI enabled or not"); diff --git a/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch b/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch index 7c5fe1411650e..84d3fe6ddd702 100644 --- a/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch +++ b/pci/pci-acpi-rename-the-functions-to-avoid-multiple-instances.patch @@ -20,7 +20,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/pci/pci-acpi.c +++ gregkh-2.6/drivers/pci/pci-acpi.c -@@ -257,7 +257,7 @@ static int acpi_pci_set_power_state(stru +@@ -267,7 +267,7 @@ static int acpi_pci_set_power_state(stru /* ACPI bus type */ @@ -29,7 +29,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> { struct pci_dev * pci_dev; acpi_integer addr; -@@ -271,7 +271,7 @@ static int pci_acpi_find_device(struct d +@@ -281,7 +281,7 @@ static int pci_acpi_find_device(struct d return 0; } @@ -38,7 +38,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> { int num; unsigned int seg, bus; -@@ -289,21 +289,21 @@ static int pci_acpi_find_root_bridge(str +@@ -299,21 +299,21 @@ static int pci_acpi_find_root_bridge(str return 0; } diff --git a/pci/pci-correctly-allocate-return-buffers-for-osc-calls.patch b/pci/pci-correctly-allocate-return-buffers-for-osc-calls.patch new file mode 100644 index 0000000000000..8ccfca5839bc8 --- /dev/null +++ b/pci/pci-correctly-allocate-return-buffers-for-osc-calls.patch @@ -0,0 +1,144 @@ +From owner-linux-pci@atrey.karlin.mff.cuni.cz Wed May 17 11:04:37 2006 +Subject: PCI: correctly allocate return buffers for osc calls +From: Kristen Accardi <kristen.c.accardi@intel.com> +To: linux-pci@atrey.karlin.mff.cuni.cz +Cc: linux-kernel@vger.kernel.org, greg@kroah.com +Date: Wed, 17 May 2006 11:13:37 -0700 +Message-Id: <1147889618.8472.6.camel@whizzy> + +The OSC set and query functions do not allocate enough space for return values, +and set the output buffer length to a false, too large value. This causes the +acpi-ca code to assume that the output buffer is larger than it actually is, +and overwrite memory when copying acpi return buffers into this caller provided +buffer. In some cases this can cause kernel oops if the memory that is +overwritten is a pointer. This patch will change these calls to use a +dynamically allocated output buffer, thus allowing the acpi-ca code to decide +how much space is needed. + +Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/pci/pci-acpi.c | 60 ++++++++++++++++++++++++++++--------------------- + 1 file changed, 35 insertions(+), 25 deletions(-) + +--- gregkh-2.6.orig/drivers/pci/pci-acpi.c ++++ gregkh-2.6/drivers/pci/pci-acpi.c +@@ -33,13 +33,10 @@ acpi_query_osc ( + acpi_status status; + struct acpi_object_list input; + union acpi_object in_params[4]; +- struct acpi_buffer output; +- union acpi_object out_obj; ++ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; ++ union acpi_object *out_obj; + u32 osc_dw0; + +- /* Setting up output buffer */ +- output.length = sizeof(out_obj) + 3*sizeof(u32); +- output.pointer = &out_obj; + + /* Setting up input parameters */ + input.count = 4; +@@ -61,12 +58,15 @@ acpi_query_osc ( + "Evaluate _OSC Set fails. Status = 0x%04x\n", status); + return status; + } +- if (out_obj.type != ACPI_TYPE_BUFFER) { ++ out_obj = output.pointer; ++ ++ if (out_obj->type != ACPI_TYPE_BUFFER) { + printk(KERN_DEBUG + "Evaluate _OSC returns wrong type\n"); +- return AE_TYPE; ++ status = AE_TYPE; ++ goto query_osc_out; + } +- osc_dw0 = *((u32 *) out_obj.buffer.pointer); ++ osc_dw0 = *((u32 *) out_obj->buffer.pointer); + if (osc_dw0) { + if (osc_dw0 & OSC_REQUEST_ERROR) + printk(KERN_DEBUG "_OSC request fails\n"); +@@ -76,15 +76,21 @@ acpi_query_osc ( + printk(KERN_DEBUG "_OSC invalid revision\n"); + if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { + /* Update Global Control Set */ +- global_ctrlsets = *((u32 *)(out_obj.buffer.pointer+8)); +- return AE_OK; ++ global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8)); ++ status = AE_OK; ++ goto query_osc_out; + } +- return AE_ERROR; ++ status = AE_ERROR; ++ goto query_osc_out; + } + + /* Update Global Control Set */ +- global_ctrlsets = *((u32 *)(out_obj.buffer.pointer + 8)); +- return AE_OK; ++ global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); ++ status = AE_OK; ++ ++query_osc_out: ++ kfree(output.pointer); ++ return status; + } + + +@@ -96,14 +102,10 @@ acpi_run_osc ( + acpi_status status; + struct acpi_object_list input; + union acpi_object in_params[4]; +- struct acpi_buffer output; +- union acpi_object out_obj; ++ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; ++ union acpi_object *out_obj; + u32 osc_dw0; + +- /* Setting up output buffer */ +- output.length = sizeof(out_obj) + 3*sizeof(u32); +- output.pointer = &out_obj; +- + /* Setting up input parameters */ + input.count = 4; + input.pointer = in_params; +@@ -124,12 +126,14 @@ acpi_run_osc ( + "Evaluate _OSC Set fails. Status = 0x%04x\n", status); + return status; + } +- if (out_obj.type != ACPI_TYPE_BUFFER) { ++ out_obj = output.pointer; ++ if (out_obj->type != ACPI_TYPE_BUFFER) { + printk(KERN_DEBUG + "Evaluate _OSC returns wrong type\n"); +- return AE_TYPE; ++ status = AE_TYPE; ++ goto run_osc_out; + } +- osc_dw0 = *((u32 *) out_obj.buffer.pointer); ++ osc_dw0 = *((u32 *) out_obj->buffer.pointer); + if (osc_dw0) { + if (osc_dw0 & OSC_REQUEST_ERROR) + printk(KERN_DEBUG "_OSC request fails\n"); +@@ -139,11 +143,17 @@ acpi_run_osc ( + printk(KERN_DEBUG "_OSC invalid revision\n"); + if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { + printk(KERN_DEBUG "_OSC FW not grant req. control\n"); +- return AE_SUPPORT; ++ status = AE_SUPPORT; ++ goto run_osc_out; + } +- return AE_ERROR; ++ status = AE_ERROR; ++ goto run_osc_out; + } +- return AE_OK; ++ status = AE_OK; ++ ++run_osc_out: ++ kfree(output.pointer); ++ return status; + } + + /** |