diff options
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_vio.c')
-rw-r--r-- | drivers/pci/hotplug/rpaphp_vio.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/drivers/pci/hotplug/rpaphp_vio.c b/drivers/pci/hotplug/rpaphp_vio.c deleted file mode 100644 index 74df6a305e64..000000000000 --- a/drivers/pci/hotplug/rpaphp_vio.c +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* | ||
2 | * RPA Hot Plug Virtual I/O device functions | ||
3 | * Copyright (C) 2004 Linda Xie <lxie@us.ibm.com> | ||
4 | * | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or (at | ||
10 | * your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
15 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
16 | * details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | * | ||
22 | * Send feedback to <lxie@us.ibm.com> | ||
23 | * | ||
24 | */ | ||
25 | #include <asm/vio.h> | ||
26 | #include "rpaphp.h" | ||
27 | |||
28 | /* | ||
29 | * get_vio_adapter_status - get the status of a slot | ||
30 | * | ||
31 | * status: | ||
32 | * | ||
33 | * 1-- adapter is configured | ||
34 | * 2-- adapter is not configured | ||
35 | * 3-- not valid | ||
36 | */ | ||
37 | inline int rpaphp_get_vio_adapter_status(struct slot *slot, int is_init, u8 *value) | ||
38 | { | ||
39 | *value = slot->state; | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | int rpaphp_unconfig_vio_adapter(struct slot *slot) | ||
44 | { | ||
45 | int retval = 0; | ||
46 | |||
47 | dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); | ||
48 | if (!slot->dev.vio_dev) { | ||
49 | info("%s: no VIOA in slot[%s]\n", __FUNCTION__, slot->name); | ||
50 | retval = -EINVAL; | ||
51 | goto exit; | ||
52 | } | ||
53 | /* remove the device from the vio core */ | ||
54 | vio_unregister_device(slot->dev.vio_dev); | ||
55 | slot->state = NOT_CONFIGURED; | ||
56 | info("%s: adapter in slot[%s] unconfigured.\n", __FUNCTION__, slot->name); | ||
57 | exit: | ||
58 | dbg("Exit %s, rc=0x%x\n", __FUNCTION__, retval); | ||
59 | return retval; | ||
60 | } | ||
61 | |||
62 | static int setup_vio_hotplug_slot_info(struct slot *slot) | ||
63 | { | ||
64 | slot->hotplug_slot->info->power_status = 1; | ||
65 | rpaphp_get_vio_adapter_status(slot, 1, | ||
66 | &slot->hotplug_slot->info->adapter_status); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | int register_vio_slot(struct device_node *dn) | ||
71 | { | ||
72 | u32 *index; | ||
73 | char *name; | ||
74 | int rc = -EINVAL; | ||
75 | struct slot *slot = NULL; | ||
76 | |||
77 | rc = rpaphp_get_drc_props(dn, NULL, &name, NULL, NULL); | ||
78 | if (rc < 0) | ||
79 | goto exit_rc; | ||
80 | index = (u32 *) get_property(dn, "ibm,my-drc-index", NULL); | ||
81 | if (!index) | ||
82 | goto exit_rc; | ||
83 | if (!(slot = alloc_slot_struct(dn, *index, name, 0))) { | ||
84 | rc = -ENOMEM; | ||
85 | goto exit_rc; | ||
86 | } | ||
87 | slot->dev_type = VIO_DEV; | ||
88 | slot->dev.vio_dev = vio_find_node(dn); | ||
89 | if (slot->dev.vio_dev) { | ||
90 | /* | ||
91 | * rpaphp is the only owner of vio devices and | ||
92 | * does not need extra reference taken by | ||
93 | * vio_find_node | ||
94 | */ | ||
95 | put_device(&slot->dev.vio_dev->dev); | ||
96 | } else | ||
97 | slot->dev.vio_dev = vio_register_device_node(dn); | ||
98 | if (slot->dev.vio_dev) | ||
99 | slot->state = CONFIGURED; | ||
100 | else | ||
101 | slot->state = NOT_CONFIGURED; | ||
102 | if (setup_vio_hotplug_slot_info(slot)) | ||
103 | goto exit_rc; | ||
104 | strcpy(slot->name, slot->dev.vio_dev->dev.bus_id); | ||
105 | info("%s: registered VIO device[name=%s vio_dev=%p]\n", | ||
106 | __FUNCTION__, slot->name, slot->dev.vio_dev); | ||
107 | rc = register_slot(slot); | ||
108 | exit_rc: | ||
109 | if (rc && slot) | ||
110 | dealloc_slot_struct(slot); | ||
111 | return (rc); | ||
112 | } | ||
113 | |||
114 | int rpaphp_enable_vio_slot(struct slot *slot) | ||
115 | { | ||
116 | int retval = 0; | ||
117 | |||
118 | if ((slot->dev.vio_dev = vio_register_device_node(slot->dn))) { | ||
119 | info("%s: VIO adapter %s in slot[%s] has been configured\n", | ||
120 | __FUNCTION__, slot->dn->name, slot->name); | ||
121 | slot->state = CONFIGURED; | ||
122 | } else { | ||
123 | info("%s: no vio_dev struct for adapter in slot[%s]\n", | ||
124 | __FUNCTION__, slot->name); | ||
125 | slot->state = NOT_CONFIGURED; | ||
126 | } | ||
127 | |||
128 | return retval; | ||
129 | } | ||