patch-2.4.10 linux/drivers/acpi/ospm/processor/pr_osl.c
Next file: linux/drivers/acpi/ospm/processor/prperf.c
Previous file: linux/drivers/acpi/ospm/processor/pr.c
Back to the patch index
Back to the overall index
- Lines: 220
- Date:
Sun Sep 23 09:42:32 2001
- Orig file:
v2.4.9/linux/drivers/acpi/ospm/processor/pr_osl.c
- Orig date:
Tue Jul 3 17:08:19 2001
diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/ospm/processor/pr_osl.c linux/drivers/acpi/ospm/processor/pr_osl.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pr_osl.c
- * $Revision: 14 $
+ * $Revision: 18 $
*
*****************************************************************************/
@@ -29,6 +29,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
+#include <linux/pci.h>
#include <acpi.h>
#include <bm.h>
#include "pr.h"
@@ -36,6 +37,7 @@
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - IA32 Processor Driver");
+MODULE_LICENSE("GPL");
#define PR_PROC_ROOT "processor"
@@ -44,21 +46,22 @@
extern struct proc_dir_entry *bm_proc_root;
static struct proc_dir_entry *pr_proc_root = NULL;
+extern unsigned short acpi_piix4_bmisx;
/****************************************************************************
- *
+ *
* FUNCTION: pr_osl_proc_read_status
*
****************************************************************************/
static int
pr_osl_proc_read_status (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
+ char *page,
+ char **start,
+ off_t off,
+ int count,
+ int *eof,
void *context)
{
PR_CONTEXT *processor = NULL;
@@ -71,10 +74,10 @@
processor = (PR_CONTEXT*)context;
- p += sprintf(p, "Bus Mastering Activity: %08x\n",
+ p += sprintf(p, "Bus Mastering Activity: %08x\n",
processor->power.bm_activity);
- p += sprintf(p, "C-State Utilization: C1[%d] C2[%d] C3[%d]\n",
+ p += sprintf(p, "C-State Utilization: C1[%d] C2[%d] C3[%d]\n",
processor->power.state[PR_C1].utilization,
processor->power.state[PR_C2].utilization,
processor->power.state[PR_C3].utilization);
@@ -92,18 +95,18 @@
/****************************************************************************
- *
+ *
* FUNCTION: pr_osl_proc_read_info
*
****************************************************************************/
static int
pr_osl_proc_read_info (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
+ char *page,
+ char **start,
+ off_t off,
+ int count,
+ int *eof,
void *context)
{
PR_CONTEXT *processor = NULL;
@@ -136,7 +139,7 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
pr_osl_add_device(
PR_CONTEXT *processor)
{
@@ -159,6 +162,9 @@
printk(", throttling states: %d", processor->performance.state_count);
}
+ if (acpi_piix4_bmisx)
+ printk(", PIIX workaround active");
+
printk("\n");
sprintf(processor_uid, "%d", processor->uid);
@@ -168,10 +174,10 @@
return(AE_ERROR);
}
- create_proc_read_entry(PR_PROC_STATUS, S_IFREG | S_IRUGO,
+ create_proc_read_entry(PR_PROC_STATUS, S_IFREG | S_IRUGO,
proc_entry, pr_osl_proc_read_status, (void*)processor);
- create_proc_read_entry(PR_PROC_INFO, S_IFREG | S_IRUGO,
+ create_proc_read_entry(PR_PROC_INFO, S_IFREG | S_IRUGO,
proc_entry, pr_osl_proc_read_info, (void*)processor);
return(AE_OK);
@@ -184,7 +190,7 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
pr_osl_remove_device (
PR_CONTEXT *processor)
{
@@ -213,12 +219,12 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
pr_osl_generate_event (
u32 event,
PR_CONTEXT *processor)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
char processor_uid[16];
if (!processor) {
@@ -230,7 +236,7 @@
case PR_NOTIFY_PERF_STATES:
case PR_NOTIFY_POWER_STATES:
sprintf(processor_uid, "%d", processor->uid);
- status = bm_osl_generate_event(processor->device_handle,
+ status = bm_osl_generate_event(processor->device_handle,
PR_PROC_ROOT, processor_uid, event, 0);
break;
@@ -244,6 +250,34 @@
/****************************************************************************
+ * Errata Handling
+ ****************************************************************************/
+
+void acpi_pr_errata (void)
+{
+ struct pci_dev *dev = NULL;
+
+ while ((dev = pci_find_subsys(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
+ PCI_ANY_ID, PCI_ANY_ID, dev))) {
+ switch (dev->device) {
+ case PCI_DEVICE_ID_INTEL_82801BA_8: /* PIIX4U4 */
+ case PCI_DEVICE_ID_INTEL_82801BA_9: /* PIIX4U3 */
+ case PCI_DEVICE_ID_INTEL_82451NX: /* PIIX4NX */
+ case PCI_DEVICE_ID_INTEL_82372FB_1: /* PIIX4U2 */
+ case PCI_DEVICE_ID_INTEL_82801AA_1: /* PIIX4U */
+ case PCI_DEVICE_ID_INTEL_82443MX_1: /* PIIX4E2 */
+ case PCI_DEVICE_ID_INTEL_82801AB_1: /* PIIX4E */
+ case PCI_DEVICE_ID_INTEL_82371AB: /* PIIX4 */
+ acpi_piix4_bmisx = pci_resource_start(dev, 4);
+ return;
+ }
+ }
+
+ return;
+}
+
+
+/****************************************************************************
*
* FUNCTION: pr_osl_init
*
@@ -255,10 +289,16 @@
*
****************************************************************************/
-static int __init
+static int __init
pr_osl_init (void)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
+
+ /* abort if no busmgr */
+ if (!bm_proc_root)
+ return -ENODEV;
+
+ acpi_pr_errata();
pr_proc_root = proc_mkdir(PR_PROC_ROOT, bm_proc_root);
if (!pr_proc_root) {
@@ -288,7 +328,7 @@
*
****************************************************************************/
-static void __exit
+static void __exit
pr_osl_cleanup (void)
{
pr_terminate();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)