13 #include <linux/kernel.h>
19 #include <linux/slab.h>
23 #include <asm/machdep.h>
24 #include <asm/uaccess.h>
90 static void dlpar_free_one_cc_node(
struct device_node *dn)
112 dlpar_free_one_cc_node(dn);
116 #define NEXT_SIBLING 1
118 #define NEXT_PROPERTY 3
119 #define PREV_PARENT 4
120 #define MORE_MEMORY 5
121 #define CALL_AGAIN -2
122 #define ERR_CFG_USE -9003
130 struct property *last_property =
NULL;
136 cc_token =
rtas_token(
"ibm,configure-connector");
137 if (cc_token == RTAS_UNKNOWN_SERVICE)
140 data_buf = kzalloc(RTAS_DATA_BUF_SIZE,
GFP_KERNEL);
153 spin_lock(&rtas_data_buf_lock);
155 memcpy(rtas_data_buf, data_buf, RTAS_DATA_BUF_SIZE);
157 memcpy(data_buf, rtas_data_buf, RTAS_DATA_BUF_SIZE);
159 spin_unlock(&rtas_data_buf_lock);
166 dn = dlpar_parse_cc_node(ccwa);
176 dn = dlpar_parse_cc_node(ccwa);
192 property = dlpar_parse_cc_property(ccwa);
199 last_property->
next = property;
201 last_property = property;
205 last_dn = last_dn->
parent;
215 "returned from configure-connector\n", rc);
238 last_slash =
strrchr(path,
'/');
239 if (last_slash == path) {
243 int parent_path_len = last_slash - path + 1;
248 strlcpy(parent_path, path, parent_path_len);
258 #ifdef CONFIG_PROC_DEVICETREE
263 of_node_set_flag(dn, OF_DYNAMIC);
264 kref_init(&dn->
kref);
278 #ifdef CONFIG_PROC_DEVICETREE
290 #ifdef CONFIG_PROC_DEVICETREE
310 #define DR_ENTITY_SENSE 9003
311 #define DR_ENTITY_PRESENT 1
312 #define DR_ENTITY_UNUSABLE 2
313 #define ALLOCATION_STATE 9003
314 #define ALLOC_UNUSABLE 0
315 #define ALLOC_USABLE 1
316 #define ISOLATION_STATE 9001
364 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
366 static int dlpar_online_cpu(
struct device_node *dn)
370 int len, nthreads,
i;
377 nthreads = len /
sizeof(
u32);
379 cpu_maps_update_begin();
380 for (i = 0; i < nthreads; i++) {
382 if (get_hard_smp_processor_id(cpu) != intserv[i])
386 cpu_maps_update_done();
390 cpu_maps_update_begin();
396 "with physical id 0x%x\n", intserv[i]);
398 cpu_maps_update_done();
408 unsigned long drc_index;
412 cpu_hotplug_driver_lock();
453 rc = dlpar_online_cpu(dn);
455 cpu_hotplug_driver_unlock();
457 return rc ? rc :
count;
460 static int dlpar_offline_cpu(
struct device_node *dn)
464 int len, nthreads,
i;
471 nthreads = len /
sizeof(
u32);
473 cpu_maps_update_begin();
474 for (i = 0; i < nthreads; i++) {
476 if (get_hard_smp_processor_id(cpu) != intserv[i])
484 cpu_maps_update_done();
488 cpu_maps_update_begin();
498 BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
505 "with physical id 0x%x\n", intserv[i]);
507 cpu_maps_update_done();
514 static ssize_t dlpar_cpu_release(
const char *buf,
size_t count)
517 const u32 *drc_index;
530 cpu_hotplug_driver_lock();
531 rc = dlpar_offline_cpu(dn);
552 cpu_hotplug_driver_unlock();
553 return rc ? rc :
count;
556 static int __init pseries_dlpar_init(
void)
558 ppc_md.cpu_probe = dlpar_cpu_probe;
559 ppc_md.cpu_release = dlpar_cpu_release;