35 #include <linux/module.h>
38 #include <linux/kernel.h>
39 #include <linux/pci.h>
41 #include <linux/slab.h>
45 #define MY_NAME "acpiphp"
48 #define SLOT_NAME_SIZE 21
56 #define DRIVER_VERSION "0.5"
58 #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver"
70 static int enable_slot (
struct hotplug_slot *
slot);
71 static int disable_slot (
struct hotplug_slot *
slot);
72 static int set_attention_status (
struct hotplug_slot *
slot,
u8 value);
73 static int get_power_status (
struct hotplug_slot *
slot,
u8 *
value);
74 static int get_attention_status (
struct hotplug_slot *
slot,
u8 *
value);
75 static int get_latch_status (
struct hotplug_slot *
slot,
u8 *
value);
76 static int get_adapter_status (
struct hotplug_slot *
slot,
u8 *
value);
101 info->
get_attn && !attention_info) {
103 attention_info =
info;
121 if (info && attention_info == info) {
122 attention_info =
NULL;
135 static int enable_slot(
struct hotplug_slot *hotplug_slot)
137 struct slot *
slot = hotplug_slot->private;
139 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
152 static int disable_slot(
struct hotplug_slot *hotplug_slot)
154 struct slot *slot = hotplug_slot->private;
157 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
176 static int set_attention_status(
struct hotplug_slot *hotplug_slot,
u8 status)
180 dbg(
"%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot));
182 if (attention_info && try_module_get(attention_info->
owner)) {
183 retval = attention_info->
set_attn(hotplug_slot, status);
184 module_put(attention_info->
owner);
186 attention_info =
NULL;
199 static int get_power_status(
struct hotplug_slot *hotplug_slot,
u8 *
value)
201 struct slot *slot = hotplug_slot->private;
203 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
221 static int get_attention_status(
struct hotplug_slot *hotplug_slot,
u8 *value)
225 dbg(
"%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot));
227 if (attention_info && try_module_get(attention_info->
owner)) {
228 retval = attention_info->
get_attn(hotplug_slot, value);
229 module_put(attention_info->
owner);
231 attention_info =
NULL;
244 static int get_latch_status(
struct hotplug_slot *hotplug_slot,
u8 *value)
246 struct slot *slot = hotplug_slot->private;
248 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
264 static int get_adapter_status(
struct hotplug_slot *hotplug_slot,
u8 *value)
266 struct slot *slot = hotplug_slot->private;
268 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
275 static int __init init_acpi(
void)
298 static void release_slot(
struct hotplug_slot *hotplug_slot)
300 struct slot *slot = hotplug_slot->private;
302 dbg(
"%s - physical_slot = %s\n", __func__, slot_name(slot));
339 acpiphp_slot->
bridge->pci_bus,
342 if (retval == -
EBUSY)
345 err(
"pci_hp_register failed with error %d\n", retval);
349 info(
"Slot [%s] registered\n", slot_name(slot));
363 struct slot *slot = acpiphp_slot->
slot;
366 info(
"Slot [%s] unregistered\n", slot_name(slot));
370 err(
"pci_hp_deregister failed with error %d\n", retval);
374 static int __init acpiphp_init(
void)
386 static void __exit acpiphp_exit(
void)