Commit feb66678 authored by Andy Grover's avatar Andy Grover

ACPI: acpiphp update (Takayoshi Kochi)

parent 3ee20564
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001 IBM Corp. * Copyright (c) 2001 IBM Corp.
* Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (c) 2002 NEC Corporation * Copyright (c) 2002,2003 NEC Corporation
* *
* All rights reserved. * All rights reserved.
* *
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Send feedback to <gregkh@us.ibm.com>, * Send feedback to <gregkh@us.ibm.com>,
* <h-aono@ap.jp.nec.com>, * <t-kochi@bq.jp.nec.com>
* <t-kouchi@cq.jp.nec.com>
* *
*/ */
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
#define _ACPIPHP_H #define _ACPIPHP_H
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/kobject.h> /* for KOBJ_NAME_LEN */
#include "pci_hotplug.h" #include "pci_hotplug.h"
#define dbg(format, arg...) \ #define dbg(format, arg...) \
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#define SLOT_MAGIC 0x67267322 #define SLOT_MAGIC 0x67267322
/* name size which is used for entries in pcihpfs */ /* name size which is used for entries in pcihpfs */
#define SLOT_NAME_SIZE 32 /* ACPI{_SUN}-{BUS}:{DEV} */ #define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */
struct acpiphp_bridge; struct acpiphp_bridge;
struct acpiphp_slot; struct acpiphp_slot;
...@@ -212,11 +212,7 @@ struct acpiphp_func { ...@@ -212,11 +212,7 @@ struct acpiphp_func {
#define FUNC_HAS_PS2 (0x00000040) #define FUNC_HAS_PS2 (0x00000040)
#define FUNC_HAS_PS3 (0x00000080) #define FUNC_HAS_PS3 (0x00000080)
/* not yet */ #define FUNC_EXISTS (0x10000000) /* to make sure we call _EJ0 only for existing funcs */
#define SLOT_SUPPORT_66MHZ (0x00010000)
#define SLOT_SUPPORT_100MHZ (0x00020000)
#define SLOT_SUPPORT_133MHZ (0x00040000)
#define SLOT_SUPPORT_PCIX (0x00080000)
/* function prototypes */ /* function prototypes */
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001 IBM Corp. * Copyright (c) 2001 IBM Corp.
* Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (c) 2002 NEC Corporation * Copyright (c) 2002,2003 NEC Corporation
* *
* All rights reserved. * All rights reserved.
* *
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Send feedback to <gregkh@us.ibm.com>, * Send feedback to <gregkh@us.ibm.com>,
* <h-aono@ap.jp.nec.com>, * <t-kochi@bq.jp.nec.com>
* <t-kouchi@cq.jp.nec.com>
* *
*/ */
...@@ -57,7 +56,7 @@ int acpiphp_debug; ...@@ -57,7 +56,7 @@ int acpiphp_debug;
static int num_slots; static int num_slots;
#define DRIVER_VERSION "0.4" #define DRIVER_VERSION "0.4"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kouchi@cq.jp.nec.com>" #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>"
#define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver" #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver"
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
...@@ -376,10 +375,8 @@ static int init_acpi (void) ...@@ -376,10 +375,8 @@ static int init_acpi (void)
*/ */
static void make_slot_name (struct slot *slot) static void make_slot_name (struct slot *slot)
{ {
snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "ACPI%d-%02x:%02x", snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u",
slot->acpi_slot->sun, slot->acpi_slot->sun);
slot->acpi_slot->bridge->bus,
slot->acpi_slot->device);
} }
/** /**
......
/* /*
* ACPI PCI HotPlug glue functions to ACPI CA subsystem * ACPI PCI HotPlug glue functions to ACPI CA subsystem
* *
* Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) * Copyright (c) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (c) 2002 NEC Corporation * Copyright (c) 2002,2003 NEC Corporation
* *
* All rights reserved. * All rights reserved.
* *
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Send feedback to <t-kouchi@cq.jp.nec.com> * Send feedback to <t-kochi@bq.jp.nec.com>
* *
*/ */
...@@ -204,7 +204,6 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -204,7 +204,6 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
err("failed to register interrupt notify handler\n"); err("failed to register interrupt notify handler\n");
kfree(newfunc);
return status; return status;
} }
...@@ -617,9 +616,8 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -617,9 +616,8 @@ find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
/* find hot-pluggable slots, and then find P2P bridge */ /* find hot-pluggable slots, and then find P2P bridge */
static int add_bridges(struct acpi_device *device) static int add_bridge(acpi_handle handle)
{ {
acpi_handle *handle = device->handle;
acpi_status status; acpi_status status;
unsigned long tmp; unsigned long tmp;
int seg, bus; int seg, bus;
...@@ -673,6 +671,12 @@ static int add_bridges(struct acpi_device *device) ...@@ -673,6 +671,12 @@ static int add_bridges(struct acpi_device *device)
} }
static void remove_bridge (acpi_handle handle)
{
/* No-op for now .. */
}
static int power_on_slot (struct acpiphp_slot *slot) static int power_on_slot (struct acpiphp_slot *slot)
{ {
acpi_status status; acpi_status status;
...@@ -725,9 +729,7 @@ static int power_off_slot (struct acpiphp_slot *slot) ...@@ -725,9 +729,7 @@ static int power_off_slot (struct acpiphp_slot *slot)
list_for_each (l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_PS3) { if (func->flags & (FUNC_HAS_PS3 | FUNC_EXISTS)) {
dbg("%s: executing _PS3 on %s\n", __FUNCTION__,
func->pci_dev->slot_name);
status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
warn("%s: _PS3 failed\n", __FUNCTION__); warn("%s: _PS3 failed\n", __FUNCTION__);
...@@ -740,10 +742,8 @@ static int power_off_slot (struct acpiphp_slot *slot) ...@@ -740,10 +742,8 @@ static int power_off_slot (struct acpiphp_slot *slot)
list_for_each (l, &slot->funcs) { list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling); func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_EJ0) { /* We don't want to call _EJ0 on non-existing functions. */
dbg("%s: executing _EJ0 on %s\n", __FUNCTION__, if (func->flags & (FUNC_HAS_EJ0 | FUNC_EXISTS)) {
func->pci_dev->slot_name);
/* _EJ0 method take one argument */ /* _EJ0 method take one argument */
arg_list.count = 1; arg_list.count = 1;
arg_list.pointer = &arg; arg_list.pointer = &arg;
...@@ -756,6 +756,7 @@ static int power_off_slot (struct acpiphp_slot *slot) ...@@ -756,6 +756,7 @@ static int power_off_slot (struct acpiphp_slot *slot)
retval = -1; retval = -1;
goto err_exit; goto err_exit;
} }
func->flags &= (~FUNC_EXISTS);
} }
} }
...@@ -835,6 +836,8 @@ static int enable_device (struct acpiphp_slot *slot) ...@@ -835,6 +836,8 @@ static int enable_device (struct acpiphp_slot *slot)
retval = acpiphp_configure_function(func); retval = acpiphp_configure_function(func);
if (retval) if (retval)
goto err_exit; goto err_exit;
func->flags |= FUNC_EXISTS;
} }
slot->flags |= SLOT_ENABLED; slot->flags |= SLOT_ENABLED;
...@@ -1029,13 +1032,10 @@ static void handle_hotplug_event_func (acpi_handle handle, u32 type, void *conte ...@@ -1029,13 +1032,10 @@ static void handle_hotplug_event_func (acpi_handle handle, u32 type, void *conte
} }
} }
static struct acpi_driver acpi_pci_hp_driver = {
.name = "pci_hp", static struct acpi_pci_driver acpi_pci_hp_driver = {
.class = "", .add = add_bridge,
.ids = ACPI_PCI_HOST_HID, .remove = remove_bridge,
.ops = {
.add = add_bridges,
}
}; };
/** /**
...@@ -1044,17 +1044,15 @@ static struct acpi_driver acpi_pci_hp_driver = { ...@@ -1044,17 +1044,15 @@ static struct acpi_driver acpi_pci_hp_driver = {
*/ */
int acpiphp_glue_init (void) int acpiphp_glue_init (void)
{ {
acpi_status status; int num;
if (list_empty(&pci_root_buses)) if (list_empty(&pci_root_buses))
return -1; return -1;
status = acpi_bus_register_driver(&acpi_pci_hp_driver); num = acpi_pci_register_driver(&acpi_pci_hp_driver);
if (ACPI_FAILURE(status)) { if (num <= 0)
err("%s: acpi_walk_namespace() failed\n", __FUNCTION__);
return -1; return -1;
}
return 0; return 0;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (c) 1995,2001 Compaq Computer Corporation * Copyright (c) 1995,2001 Compaq Computer Corporation
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001,2002 IBM Corp. * Copyright (c) 2001,2002 IBM Corp.
* Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) * Copyright (c) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (c) 2002 NEC Corporation * Copyright (c) 2002 NEC Corporation
* *
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Send feedback to <t-kouchi@cq.jp.nec.com> * Send feedback to <t-kochi@bq.jp.nec.com>
* *
*/ */
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001 IBM Corp. * Copyright (c) 2001 IBM Corp.
* Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) * Copyright (c) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
* Copyright (c) 2002 Takayoshi Kochi (t-kouchi@cq.jp.nec.com) * Copyright (c) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
* Copyright (c) 2002 NEC Corporation * Copyright (c) 2002 NEC Corporation
* *
* All rights reserved. * All rights reserved.
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Send feedback to <gregkh@us.ibm.com>,<h-aono@ap.jp.nec.com> * Send feedback to <gregkh@us.ibm.com>, <t-kochi@bq.jp.nec.com>
* *
*/ */
......
...@@ -403,8 +403,8 @@ int acpi_pci_irq_init (void); ...@@ -403,8 +403,8 @@ int acpi_pci_irq_init (void);
struct acpi_pci_driver { struct acpi_pci_driver {
struct acpi_pci_driver *next; struct acpi_pci_driver *next;
int (*add)(acpi_handle *handle); int (*add)(acpi_handle handle);
void (*remove)(acpi_handle *handle); void (*remove)(acpi_handle handle);
}; };
int acpi_pci_register_driver(struct acpi_pci_driver *driver); int acpi_pci_register_driver(struct acpi_pci_driver *driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment