22 #include <linux/kernel.h>
23 #include <linux/list.h>
24 #include <linux/module.h>
25 #include <linux/slab.h>
31 #define HVCS_ARCH_VERSION "1.0.0"
43 static int hvcs_convert(
long to_convert)
53 case H_LONG_BUSY_ORDER_1_MSEC:
54 case H_LONG_BUSY_ORDER_10_MSEC:
55 case H_LONG_BUSY_ORDER_100_MSEC:
56 case H_LONG_BUSY_ORDER_1_SEC:
57 case H_LONG_BUSY_ORDER_10_SEC:
58 case H_LONG_BUSY_ORDER_100_SEC:
76 struct hvcs_partner_info *pi;
82 while (!list_empty(head)) {
95 unsigned long last_p_partition_ID,
96 unsigned long last_p_unit_address,
unsigned long *pi_buff)
100 retval = plpar_hcall_norets(H_VTERM_PARTNER_INFO, unit_address,
103 return hvcs_convert(retval);
132 unsigned long *pi_buff)
138 unsigned long last_p_partition_ID;
139 unsigned long last_p_unit_address;
140 struct hvcs_partner_info *next_partner_info =
NULL;
146 if (!head || !pi_buff)
149 last_p_partition_ID = last_p_unit_address = ~0
UL;
150 INIT_LIST_HEAD(head);
153 retval = hvcs_next_partner(unit_address, last_p_partition_ID,
154 last_p_unit_address, pi_buff);
160 if (!list_empty(head))
165 last_p_partition_ID = pi_buff[0];
166 last_p_unit_address = pi_buff[1];
169 if (last_p_partition_ID == ~0
UL
170 && last_p_unit_address == ~0
UL)
175 next_partner_info =
kmalloc(
sizeof(
struct hvcs_partner_info),
178 if (!next_partner_info) {
180 " allocate partner info struct.\n");
185 next_partner_info->unit_address
186 = (
unsigned int)last_p_unit_address;
187 next_partner_info->partition_ID
188 = (
unsigned int)last_p_partition_ID;
191 strncpy(&next_partner_info->location_code[0],
193 strlen((
char *)&pi_buff[2]) + 1);
196 next_partner_info =
NULL;
229 retval = plpar_hcall_norets(H_REGISTER_VTERM, unit_address,
230 p_partition_ID, p_unit_address);
231 return hvcs_convert(retval);
248 retval = plpar_hcall_norets(H_FREE_VTERM, unit_address);
249 return hvcs_convert(retval);