iucv.c 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805
  1. /*
  2. * IUCV base infrastructure.
  3. *
  4. * Copyright 2001, 2006 IBM Deutschland Entwicklung GmbH, IBM Corporation
  5. * Author(s):
  6. * Original source:
  7. * Alan Altmark (Alan_Altmark@us.ibm.com) Sept. 2000
  8. * Xenia Tkatschow (xenia@us.ibm.com)
  9. * 2Gb awareness and general cleanup:
  10. * Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
  11. * Rewritten for af_iucv:
  12. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  13. *
  14. * Documentation used:
  15. * The original source
  16. * CP Programming Service, IBM document # SC24-5760
  17. *
  18. * This program is free software; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation; either version 2, or (at your option)
  21. * any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  31. */
  32. #define KMSG_COMPONENT "iucv"
  33. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  34. #include <linux/module.h>
  35. #include <linux/moduleparam.h>
  36. #include <linux/spinlock.h>
  37. #include <linux/kernel.h>
  38. #include <linux/slab.h>
  39. #include <linux/init.h>
  40. #include <linux/interrupt.h>
  41. #include <linux/list.h>
  42. #include <linux/errno.h>
  43. #include <linux/err.h>
  44. #include <linux/device.h>
  45. #include <linux/cpu.h>
  46. #include <net/iucv/iucv.h>
  47. #include <asm/atomic.h>
  48. #include <asm/ebcdic.h>
  49. #include <asm/io.h>
  50. #include <asm/s390_ext.h>
  51. #include <asm/smp.h>
  52. /*
  53. * FLAGS:
  54. * All flags are defined in the field IPFLAGS1 of each function
  55. * and can be found in CP Programming Services.
  56. * IPSRCCLS - Indicates you have specified a source class.
  57. * IPTRGCLS - Indicates you have specified a target class.
  58. * IPFGPID - Indicates you have specified a pathid.
  59. * IPFGMID - Indicates you have specified a message ID.
  60. * IPNORPY - Indicates a one-way message. No reply expected.
  61. * IPALL - Indicates that all paths are affected.
  62. */
  63. #define IUCV_IPSRCCLS 0x01
  64. #define IUCV_IPTRGCLS 0x01
  65. #define IUCV_IPFGPID 0x02
  66. #define IUCV_IPFGMID 0x04
  67. #define IUCV_IPNORPY 0x10
  68. #define IUCV_IPALL 0x80
  69. static int iucv_bus_match(struct device *dev, struct device_driver *drv)
  70. {
  71. return 0;
  72. }
  73. struct bus_type iucv_bus = {
  74. .name = "iucv",
  75. .match = iucv_bus_match,
  76. };
  77. EXPORT_SYMBOL(iucv_bus);
  78. struct device *iucv_root;
  79. EXPORT_SYMBOL(iucv_root);
  80. static int iucv_available;
  81. /* General IUCV interrupt structure */
  82. struct iucv_irq_data {
  83. u16 ippathid;
  84. u8 ipflags1;
  85. u8 iptype;
  86. u32 res2[8];
  87. };
  88. struct iucv_irq_list {
  89. struct list_head list;
  90. struct iucv_irq_data data;
  91. };
  92. static struct iucv_irq_data *iucv_irq_data[NR_CPUS];
  93. static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE;
  94. static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE;
  95. /*
  96. * Queue of interrupt buffers lock for delivery via the tasklet
  97. * (fast but can't call smp_call_function).
  98. */
  99. static LIST_HEAD(iucv_task_queue);
  100. /*
  101. * The tasklet for fast delivery of iucv interrupts.
  102. */
  103. static void iucv_tasklet_fn(unsigned long);
  104. static DECLARE_TASKLET(iucv_tasklet, iucv_tasklet_fn,0);
  105. /*
  106. * Queue of interrupt buffers for delivery via a work queue
  107. * (slower but can call smp_call_function).
  108. */
  109. static LIST_HEAD(iucv_work_queue);
  110. /*
  111. * The work element to deliver path pending interrupts.
  112. */
  113. static void iucv_work_fn(struct work_struct *work);
  114. static DECLARE_WORK(iucv_work, iucv_work_fn);
  115. /*
  116. * Spinlock protecting task and work queue.
  117. */
  118. static DEFINE_SPINLOCK(iucv_queue_lock);
  119. enum iucv_command_codes {
  120. IUCV_QUERY = 0,
  121. IUCV_RETRIEVE_BUFFER = 2,
  122. IUCV_SEND = 4,
  123. IUCV_RECEIVE = 5,
  124. IUCV_REPLY = 6,
  125. IUCV_REJECT = 8,
  126. IUCV_PURGE = 9,
  127. IUCV_ACCEPT = 10,
  128. IUCV_CONNECT = 11,
  129. IUCV_DECLARE_BUFFER = 12,
  130. IUCV_QUIESCE = 13,
  131. IUCV_RESUME = 14,
  132. IUCV_SEVER = 15,
  133. IUCV_SETMASK = 16,
  134. };
  135. /*
  136. * Error messages that are used with the iucv_sever function. They get
  137. * converted to EBCDIC.
  138. */
  139. static char iucv_error_no_listener[16] = "NO LISTENER";
  140. static char iucv_error_no_memory[16] = "NO MEMORY";
  141. static char iucv_error_pathid[16] = "INVALID PATHID";
  142. /*
  143. * iucv_handler_list: List of registered handlers.
  144. */
  145. static LIST_HEAD(iucv_handler_list);
  146. /*
  147. * iucv_path_table: an array of iucv_path structures.
  148. */
  149. static struct iucv_path **iucv_path_table;
  150. static unsigned long iucv_max_pathid;
  151. /*
  152. * iucv_lock: spinlock protecting iucv_handler_list and iucv_pathid_table
  153. */
  154. static DEFINE_SPINLOCK(iucv_table_lock);
  155. /*
  156. * iucv_active_cpu: contains the number of the cpu executing the tasklet
  157. * or the work handler. Needed for iucv_path_sever called from tasklet.
  158. */
  159. static int iucv_active_cpu = -1;
  160. /*
  161. * Mutex and wait queue for iucv_register/iucv_unregister.
  162. */
  163. static DEFINE_MUTEX(iucv_register_mutex);
  164. /*
  165. * Counter for number of non-smp capable handlers.
  166. */
  167. static int iucv_nonsmp_handler;
  168. /*
  169. * IUCV control data structure. Used by iucv_path_accept, iucv_path_connect,
  170. * iucv_path_quiesce and iucv_path_sever.
  171. */
  172. struct iucv_cmd_control {
  173. u16 ippathid;
  174. u8 ipflags1;
  175. u8 iprcode;
  176. u16 ipmsglim;
  177. u16 res1;
  178. u8 ipvmid[8];
  179. u8 ipuser[16];
  180. u8 iptarget[8];
  181. } __attribute__ ((packed,aligned(8)));
  182. /*
  183. * Data in parameter list iucv structure. Used by iucv_message_send,
  184. * iucv_message_send2way and iucv_message_reply.
  185. */
  186. struct iucv_cmd_dpl {
  187. u16 ippathid;
  188. u8 ipflags1;
  189. u8 iprcode;
  190. u32 ipmsgid;
  191. u32 iptrgcls;
  192. u8 iprmmsg[8];
  193. u32 ipsrccls;
  194. u32 ipmsgtag;
  195. u32 ipbfadr2;
  196. u32 ipbfln2f;
  197. u32 res;
  198. } __attribute__ ((packed,aligned(8)));
  199. /*
  200. * Data in buffer iucv structure. Used by iucv_message_receive,
  201. * iucv_message_reject, iucv_message_send, iucv_message_send2way
  202. * and iucv_declare_cpu.
  203. */
  204. struct iucv_cmd_db {
  205. u16 ippathid;
  206. u8 ipflags1;
  207. u8 iprcode;
  208. u32 ipmsgid;
  209. u32 iptrgcls;
  210. u32 ipbfadr1;
  211. u32 ipbfln1f;
  212. u32 ipsrccls;
  213. u32 ipmsgtag;
  214. u32 ipbfadr2;
  215. u32 ipbfln2f;
  216. u32 res;
  217. } __attribute__ ((packed,aligned(8)));
  218. /*
  219. * Purge message iucv structure. Used by iucv_message_purge.
  220. */
  221. struct iucv_cmd_purge {
  222. u16 ippathid;
  223. u8 ipflags1;
  224. u8 iprcode;
  225. u32 ipmsgid;
  226. u8 ipaudit[3];
  227. u8 res1[5];
  228. u32 res2;
  229. u32 ipsrccls;
  230. u32 ipmsgtag;
  231. u32 res3[3];
  232. } __attribute__ ((packed,aligned(8)));
  233. /*
  234. * Set mask iucv structure. Used by iucv_enable_cpu.
  235. */
  236. struct iucv_cmd_set_mask {
  237. u8 ipmask;
  238. u8 res1[2];
  239. u8 iprcode;
  240. u32 res2[9];
  241. } __attribute__ ((packed,aligned(8)));
  242. union iucv_param {
  243. struct iucv_cmd_control ctrl;
  244. struct iucv_cmd_dpl dpl;
  245. struct iucv_cmd_db db;
  246. struct iucv_cmd_purge purge;
  247. struct iucv_cmd_set_mask set_mask;
  248. };
  249. /*
  250. * Anchor for per-cpu IUCV command parameter block.
  251. */
  252. static union iucv_param *iucv_param[NR_CPUS];
  253. static union iucv_param *iucv_param_irq[NR_CPUS];
  254. /**
  255. * iucv_call_b2f0
  256. * @code: identifier of IUCV call to CP.
  257. * @parm: pointer to a struct iucv_parm block
  258. *
  259. * Calls CP to execute IUCV commands.
  260. *
  261. * Returns the result of the CP IUCV call.
  262. */
  263. static inline int iucv_call_b2f0(int command, union iucv_param *parm)
  264. {
  265. register unsigned long reg0 asm ("0");
  266. register unsigned long reg1 asm ("1");
  267. int ccode;
  268. reg0 = command;
  269. reg1 = virt_to_phys(parm);
  270. asm volatile(
  271. " .long 0xb2f01000\n"
  272. " ipm %0\n"
  273. " srl %0,28\n"
  274. : "=d" (ccode), "=m" (*parm), "+d" (reg0), "+a" (reg1)
  275. : "m" (*parm) : "cc");
  276. return (ccode == 1) ? parm->ctrl.iprcode : ccode;
  277. }
  278. /**
  279. * iucv_query_maxconn
  280. *
  281. * Determines the maximum number of connections that may be established.
  282. *
  283. * Returns the maximum number of connections or -EPERM is IUCV is not
  284. * available.
  285. */
  286. static int iucv_query_maxconn(void)
  287. {
  288. register unsigned long reg0 asm ("0");
  289. register unsigned long reg1 asm ("1");
  290. void *param;
  291. int ccode;
  292. param = kzalloc(sizeof(union iucv_param), GFP_KERNEL|GFP_DMA);
  293. if (!param)
  294. return -ENOMEM;
  295. reg0 = IUCV_QUERY;
  296. reg1 = (unsigned long) param;
  297. asm volatile (
  298. " .long 0xb2f01000\n"
  299. " ipm %0\n"
  300. " srl %0,28\n"
  301. : "=d" (ccode), "+d" (reg0), "+d" (reg1) : : "cc");
  302. if (ccode == 0)
  303. iucv_max_pathid = reg0;
  304. kfree(param);
  305. return ccode ? -EPERM : 0;
  306. }
  307. /**
  308. * iucv_allow_cpu
  309. * @data: unused
  310. *
  311. * Allow iucv interrupts on this cpu.
  312. */
  313. static void iucv_allow_cpu(void *data)
  314. {
  315. int cpu = smp_processor_id();
  316. union iucv_param *parm;
  317. /*
  318. * Enable all iucv interrupts.
  319. * ipmask contains bits for the different interrupts
  320. * 0x80 - Flag to allow nonpriority message pending interrupts
  321. * 0x40 - Flag to allow priority message pending interrupts
  322. * 0x20 - Flag to allow nonpriority message completion interrupts
  323. * 0x10 - Flag to allow priority message completion interrupts
  324. * 0x08 - Flag to allow IUCV control interrupts
  325. */
  326. parm = iucv_param_irq[cpu];
  327. memset(parm, 0, sizeof(union iucv_param));
  328. parm->set_mask.ipmask = 0xf8;
  329. iucv_call_b2f0(IUCV_SETMASK, parm);
  330. /* Set indication that iucv interrupts are allowed for this cpu. */
  331. cpu_set(cpu, iucv_irq_cpumask);
  332. }
  333. /**
  334. * iucv_block_cpu
  335. * @data: unused
  336. *
  337. * Block iucv interrupts on this cpu.
  338. */
  339. static void iucv_block_cpu(void *data)
  340. {
  341. int cpu = smp_processor_id();
  342. union iucv_param *parm;
  343. /* Disable all iucv interrupts. */
  344. parm = iucv_param_irq[cpu];
  345. memset(parm, 0, sizeof(union iucv_param));
  346. iucv_call_b2f0(IUCV_SETMASK, parm);
  347. /* Clear indication that iucv interrupts are allowed for this cpu. */
  348. cpu_clear(cpu, iucv_irq_cpumask);
  349. }
  350. /**
  351. * iucv_declare_cpu
  352. * @data: unused
  353. *
  354. * Declare a interrupt buffer on this cpu.
  355. */
  356. static void iucv_declare_cpu(void *data)
  357. {
  358. int cpu = smp_processor_id();
  359. union iucv_param *parm;
  360. int rc;
  361. if (cpu_isset(cpu, iucv_buffer_cpumask))
  362. return;
  363. /* Declare interrupt buffer. */
  364. parm = iucv_param_irq[cpu];
  365. memset(parm, 0, sizeof(union iucv_param));
  366. parm->db.ipbfadr1 = virt_to_phys(iucv_irq_data[cpu]);
  367. rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm);
  368. if (rc) {
  369. char *err = "Unknown";
  370. switch (rc) {
  371. case 0x03:
  372. err = "Directory error";
  373. break;
  374. case 0x0a:
  375. err = "Invalid length";
  376. break;
  377. case 0x13:
  378. err = "Buffer already exists";
  379. break;
  380. case 0x3e:
  381. err = "Buffer overlap";
  382. break;
  383. case 0x5c:
  384. err = "Paging or storage error";
  385. break;
  386. }
  387. pr_warning("Defining an interrupt buffer on CPU %i"
  388. " failed with 0x%02x (%s)\n", cpu, rc, err);
  389. return;
  390. }
  391. /* Set indication that an iucv buffer exists for this cpu. */
  392. cpu_set(cpu, iucv_buffer_cpumask);
  393. if (iucv_nonsmp_handler == 0 || cpus_empty(iucv_irq_cpumask))
  394. /* Enable iucv interrupts on this cpu. */
  395. iucv_allow_cpu(NULL);
  396. else
  397. /* Disable iucv interrupts on this cpu. */
  398. iucv_block_cpu(NULL);
  399. }
  400. /**
  401. * iucv_retrieve_cpu
  402. * @data: unused
  403. *
  404. * Retrieve interrupt buffer on this cpu.
  405. */
  406. static void iucv_retrieve_cpu(void *data)
  407. {
  408. int cpu = smp_processor_id();
  409. union iucv_param *parm;
  410. if (!cpu_isset(cpu, iucv_buffer_cpumask))
  411. return;
  412. /* Block iucv interrupts. */
  413. iucv_block_cpu(NULL);
  414. /* Retrieve interrupt buffer. */
  415. parm = iucv_param_irq[cpu];
  416. iucv_call_b2f0(IUCV_RETRIEVE_BUFFER, parm);
  417. /* Clear indication that an iucv buffer exists for this cpu. */
  418. cpu_clear(cpu, iucv_buffer_cpumask);
  419. }
  420. /**
  421. * iucv_setmask_smp
  422. *
  423. * Allow iucv interrupts on all cpus.
  424. */
  425. static void iucv_setmask_mp(void)
  426. {
  427. int cpu;
  428. get_online_cpus();
  429. for_each_online_cpu(cpu)
  430. /* Enable all cpus with a declared buffer. */
  431. if (cpu_isset(cpu, iucv_buffer_cpumask) &&
  432. !cpu_isset(cpu, iucv_irq_cpumask))
  433. smp_call_function_single(cpu, iucv_allow_cpu,
  434. NULL, 1);
  435. put_online_cpus();
  436. }
  437. /**
  438. * iucv_setmask_up
  439. *
  440. * Allow iucv interrupts on a single cpu.
  441. */
  442. static void iucv_setmask_up(void)
  443. {
  444. cpumask_t cpumask;
  445. int cpu;
  446. /* Disable all cpu but the first in cpu_irq_cpumask. */
  447. cpumask = iucv_irq_cpumask;
  448. cpu_clear(first_cpu(iucv_irq_cpumask), cpumask);
  449. for_each_cpu_mask_nr(cpu, cpumask)
  450. smp_call_function_single(cpu, iucv_block_cpu, NULL, 1);
  451. }
  452. /**
  453. * iucv_enable
  454. *
  455. * This function makes iucv ready for use. It allocates the pathid
  456. * table, declares an iucv interrupt buffer and enables the iucv
  457. * interrupts. Called when the first user has registered an iucv
  458. * handler.
  459. */
  460. static int iucv_enable(void)
  461. {
  462. size_t alloc_size;
  463. int cpu, rc;
  464. get_online_cpus();
  465. rc = -ENOMEM;
  466. alloc_size = iucv_max_pathid * sizeof(struct iucv_path);
  467. iucv_path_table = kzalloc(alloc_size, GFP_KERNEL);
  468. if (!iucv_path_table)
  469. goto out;
  470. /* Declare per cpu buffers. */
  471. rc = -EIO;
  472. for_each_online_cpu(cpu)
  473. smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
  474. if (cpus_empty(iucv_buffer_cpumask))
  475. /* No cpu could declare an iucv buffer. */
  476. goto out;
  477. put_online_cpus();
  478. return 0;
  479. out:
  480. kfree(iucv_path_table);
  481. iucv_path_table = NULL;
  482. put_online_cpus();
  483. return rc;
  484. }
  485. /**
  486. * iucv_disable
  487. *
  488. * This function shuts down iucv. It disables iucv interrupts, retrieves
  489. * the iucv interrupt buffer and frees the pathid table. Called after the
  490. * last user unregister its iucv handler.
  491. */
  492. static void iucv_disable(void)
  493. {
  494. get_online_cpus();
  495. on_each_cpu(iucv_retrieve_cpu, NULL, 1);
  496. kfree(iucv_path_table);
  497. iucv_path_table = NULL;
  498. put_online_cpus();
  499. }
  500. static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
  501. unsigned long action, void *hcpu)
  502. {
  503. cpumask_t cpumask;
  504. long cpu = (long) hcpu;
  505. switch (action) {
  506. case CPU_UP_PREPARE:
  507. case CPU_UP_PREPARE_FROZEN:
  508. iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
  509. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  510. if (!iucv_irq_data[cpu])
  511. return NOTIFY_BAD;
  512. iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
  513. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  514. if (!iucv_param[cpu]) {
  515. kfree(iucv_irq_data[cpu]);
  516. iucv_irq_data[cpu] = NULL;
  517. return NOTIFY_BAD;
  518. }
  519. iucv_param_irq[cpu] = kmalloc_node(sizeof(union iucv_param),
  520. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  521. if (!iucv_param_irq[cpu]) {
  522. kfree(iucv_param[cpu]);
  523. iucv_param[cpu] = NULL;
  524. kfree(iucv_irq_data[cpu]);
  525. iucv_irq_data[cpu] = NULL;
  526. return NOTIFY_BAD;
  527. }
  528. break;
  529. case CPU_UP_CANCELED:
  530. case CPU_UP_CANCELED_FROZEN:
  531. case CPU_DEAD:
  532. case CPU_DEAD_FROZEN:
  533. kfree(iucv_param_irq[cpu]);
  534. iucv_param_irq[cpu] = NULL;
  535. kfree(iucv_param[cpu]);
  536. iucv_param[cpu] = NULL;
  537. kfree(iucv_irq_data[cpu]);
  538. iucv_irq_data[cpu] = NULL;
  539. break;
  540. case CPU_ONLINE:
  541. case CPU_ONLINE_FROZEN:
  542. case CPU_DOWN_FAILED:
  543. case CPU_DOWN_FAILED_FROZEN:
  544. if (!iucv_path_table)
  545. break;
  546. smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
  547. break;
  548. case CPU_DOWN_PREPARE:
  549. case CPU_DOWN_PREPARE_FROZEN:
  550. if (!iucv_path_table)
  551. break;
  552. cpumask = iucv_buffer_cpumask;
  553. cpu_clear(cpu, cpumask);
  554. if (cpus_empty(cpumask))
  555. /* Can't offline last IUCV enabled cpu. */
  556. return NOTIFY_BAD;
  557. smp_call_function_single(cpu, iucv_retrieve_cpu, NULL, 1);
  558. if (cpus_empty(iucv_irq_cpumask))
  559. smp_call_function_single(first_cpu(iucv_buffer_cpumask),
  560. iucv_allow_cpu, NULL, 1);
  561. break;
  562. }
  563. return NOTIFY_OK;
  564. }
  565. static struct notifier_block __refdata iucv_cpu_notifier = {
  566. .notifier_call = iucv_cpu_notify,
  567. };
  568. /**
  569. * iucv_sever_pathid
  570. * @pathid: path identification number.
  571. * @userdata: 16-bytes of user data.
  572. *
  573. * Sever an iucv path to free up the pathid. Used internally.
  574. */
  575. static int iucv_sever_pathid(u16 pathid, u8 userdata[16])
  576. {
  577. union iucv_param *parm;
  578. parm = iucv_param_irq[smp_processor_id()];
  579. memset(parm, 0, sizeof(union iucv_param));
  580. if (userdata)
  581. memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
  582. parm->ctrl.ippathid = pathid;
  583. return iucv_call_b2f0(IUCV_SEVER, parm);
  584. }
  585. /**
  586. * __iucv_cleanup_queue
  587. * @dummy: unused dummy argument
  588. *
  589. * Nop function called via smp_call_function to force work items from
  590. * pending external iucv interrupts to the work queue.
  591. */
  592. static void __iucv_cleanup_queue(void *dummy)
  593. {
  594. }
  595. /**
  596. * iucv_cleanup_queue
  597. *
  598. * Function called after a path has been severed to find all remaining
  599. * work items for the now stale pathid. The caller needs to hold the
  600. * iucv_table_lock.
  601. */
  602. static void iucv_cleanup_queue(void)
  603. {
  604. struct iucv_irq_list *p, *n;
  605. /*
  606. * When a path is severed, the pathid can be reused immediatly
  607. * on a iucv connect or a connection pending interrupt. Remove
  608. * all entries from the task queue that refer to a stale pathid
  609. * (iucv_path_table[ix] == NULL). Only then do the iucv connect
  610. * or deliver the connection pending interrupt. To get all the
  611. * pending interrupts force them to the work queue by calling
  612. * an empty function on all cpus.
  613. */
  614. smp_call_function(__iucv_cleanup_queue, NULL, 1);
  615. spin_lock_irq(&iucv_queue_lock);
  616. list_for_each_entry_safe(p, n, &iucv_task_queue, list) {
  617. /* Remove stale work items from the task queue. */
  618. if (iucv_path_table[p->data.ippathid] == NULL) {
  619. list_del(&p->list);
  620. kfree(p);
  621. }
  622. }
  623. spin_unlock_irq(&iucv_queue_lock);
  624. }
  625. /**
  626. * iucv_register:
  627. * @handler: address of iucv handler structure
  628. * @smp: != 0 indicates that the handler can deal with out of order messages
  629. *
  630. * Registers a driver with IUCV.
  631. *
  632. * Returns 0 on success, -ENOMEM if the memory allocation for the pathid
  633. * table failed, or -EIO if IUCV_DECLARE_BUFFER failed on all cpus.
  634. */
  635. int iucv_register(struct iucv_handler *handler, int smp)
  636. {
  637. int rc;
  638. if (!iucv_available)
  639. return -ENOSYS;
  640. mutex_lock(&iucv_register_mutex);
  641. if (!smp)
  642. iucv_nonsmp_handler++;
  643. if (list_empty(&iucv_handler_list)) {
  644. rc = iucv_enable();
  645. if (rc)
  646. goto out_mutex;
  647. } else if (!smp && iucv_nonsmp_handler == 1)
  648. iucv_setmask_up();
  649. INIT_LIST_HEAD(&handler->paths);
  650. spin_lock_bh(&iucv_table_lock);
  651. list_add_tail(&handler->list, &iucv_handler_list);
  652. spin_unlock_bh(&iucv_table_lock);
  653. rc = 0;
  654. out_mutex:
  655. mutex_unlock(&iucv_register_mutex);
  656. return rc;
  657. }
  658. EXPORT_SYMBOL(iucv_register);
  659. /**
  660. * iucv_unregister
  661. * @handler: address of iucv handler structure
  662. * @smp: != 0 indicates that the handler can deal with out of order messages
  663. *
  664. * Unregister driver from IUCV.
  665. */
  666. void iucv_unregister(struct iucv_handler *handler, int smp)
  667. {
  668. struct iucv_path *p, *n;
  669. mutex_lock(&iucv_register_mutex);
  670. spin_lock_bh(&iucv_table_lock);
  671. /* Remove handler from the iucv_handler_list. */
  672. list_del_init(&handler->list);
  673. /* Sever all pathids still refering to the handler. */
  674. list_for_each_entry_safe(p, n, &handler->paths, list) {
  675. iucv_sever_pathid(p->pathid, NULL);
  676. iucv_path_table[p->pathid] = NULL;
  677. list_del(&p->list);
  678. iucv_path_free(p);
  679. }
  680. spin_unlock_bh(&iucv_table_lock);
  681. if (!smp)
  682. iucv_nonsmp_handler--;
  683. if (list_empty(&iucv_handler_list))
  684. iucv_disable();
  685. else if (!smp && iucv_nonsmp_handler == 0)
  686. iucv_setmask_mp();
  687. mutex_unlock(&iucv_register_mutex);
  688. }
  689. EXPORT_SYMBOL(iucv_unregister);
  690. /**
  691. * iucv_path_accept
  692. * @path: address of iucv path structure
  693. * @handler: address of iucv handler structure
  694. * @userdata: 16 bytes of data reflected to the communication partner
  695. * @private: private data passed to interrupt handlers for this path
  696. *
  697. * This function is issued after the user received a connection pending
  698. * external interrupt and now wishes to complete the IUCV communication path.
  699. *
  700. * Returns the result of the CP IUCV call.
  701. */
  702. int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
  703. u8 userdata[16], void *private)
  704. {
  705. union iucv_param *parm;
  706. int rc;
  707. local_bh_disable();
  708. /* Prepare parameter block. */
  709. parm = iucv_param[smp_processor_id()];
  710. memset(parm, 0, sizeof(union iucv_param));
  711. parm->ctrl.ippathid = path->pathid;
  712. parm->ctrl.ipmsglim = path->msglim;
  713. if (userdata)
  714. memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
  715. parm->ctrl.ipflags1 = path->flags;
  716. rc = iucv_call_b2f0(IUCV_ACCEPT, parm);
  717. if (!rc) {
  718. path->private = private;
  719. path->msglim = parm->ctrl.ipmsglim;
  720. path->flags = parm->ctrl.ipflags1;
  721. }
  722. local_bh_enable();
  723. return rc;
  724. }
  725. EXPORT_SYMBOL(iucv_path_accept);
  726. /**
  727. * iucv_path_connect
  728. * @path: address of iucv path structure
  729. * @handler: address of iucv handler structure
  730. * @userid: 8-byte user identification
  731. * @system: 8-byte target system identification
  732. * @userdata: 16 bytes of data reflected to the communication partner
  733. * @private: private data passed to interrupt handlers for this path
  734. *
  735. * This function establishes an IUCV path. Although the connect may complete
  736. * successfully, you are not able to use the path until you receive an IUCV
  737. * Connection Complete external interrupt.
  738. *
  739. * Returns the result of the CP IUCV call.
  740. */
  741. int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
  742. u8 userid[8], u8 system[8], u8 userdata[16],
  743. void *private)
  744. {
  745. union iucv_param *parm;
  746. int rc;
  747. spin_lock_bh(&iucv_table_lock);
  748. iucv_cleanup_queue();
  749. parm = iucv_param[smp_processor_id()];
  750. memset(parm, 0, sizeof(union iucv_param));
  751. parm->ctrl.ipmsglim = path->msglim;
  752. parm->ctrl.ipflags1 = path->flags;
  753. if (userid) {
  754. memcpy(parm->ctrl.ipvmid, userid, sizeof(parm->ctrl.ipvmid));
  755. ASCEBC(parm->ctrl.ipvmid, sizeof(parm->ctrl.ipvmid));
  756. EBC_TOUPPER(parm->ctrl.ipvmid, sizeof(parm->ctrl.ipvmid));
  757. }
  758. if (system) {
  759. memcpy(parm->ctrl.iptarget, system,
  760. sizeof(parm->ctrl.iptarget));
  761. ASCEBC(parm->ctrl.iptarget, sizeof(parm->ctrl.iptarget));
  762. EBC_TOUPPER(parm->ctrl.iptarget, sizeof(parm->ctrl.iptarget));
  763. }
  764. if (userdata)
  765. memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
  766. rc = iucv_call_b2f0(IUCV_CONNECT, parm);
  767. if (!rc) {
  768. if (parm->ctrl.ippathid < iucv_max_pathid) {
  769. path->pathid = parm->ctrl.ippathid;
  770. path->msglim = parm->ctrl.ipmsglim;
  771. path->flags = parm->ctrl.ipflags1;
  772. path->handler = handler;
  773. path->private = private;
  774. list_add_tail(&path->list, &handler->paths);
  775. iucv_path_table[path->pathid] = path;
  776. } else {
  777. iucv_sever_pathid(parm->ctrl.ippathid,
  778. iucv_error_pathid);
  779. rc = -EIO;
  780. }
  781. }
  782. spin_unlock_bh(&iucv_table_lock);
  783. return rc;
  784. }
  785. EXPORT_SYMBOL(iucv_path_connect);
  786. /**
  787. * iucv_path_quiesce:
  788. * @path: address of iucv path structure
  789. * @userdata: 16 bytes of data reflected to the communication partner
  790. *
  791. * This function temporarily suspends incoming messages on an IUCV path.
  792. * You can later reactivate the path by invoking the iucv_resume function.
  793. *
  794. * Returns the result from the CP IUCV call.
  795. */
  796. int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16])
  797. {
  798. union iucv_param *parm;
  799. int rc;
  800. local_bh_disable();
  801. parm = iucv_param[smp_processor_id()];
  802. memset(parm, 0, sizeof(union iucv_param));
  803. if (userdata)
  804. memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
  805. parm->ctrl.ippathid = path->pathid;
  806. rc = iucv_call_b2f0(IUCV_QUIESCE, parm);
  807. local_bh_enable();
  808. return rc;
  809. }
  810. EXPORT_SYMBOL(iucv_path_quiesce);
  811. /**
  812. * iucv_path_resume:
  813. * @path: address of iucv path structure
  814. * @userdata: 16 bytes of data reflected to the communication partner
  815. *
  816. * This function resumes incoming messages on an IUCV path that has
  817. * been stopped with iucv_path_quiesce.
  818. *
  819. * Returns the result from the CP IUCV call.
  820. */
  821. int iucv_path_resume(struct iucv_path *path, u8 userdata[16])
  822. {
  823. union iucv_param *parm;
  824. int rc;
  825. local_bh_disable();
  826. parm = iucv_param[smp_processor_id()];
  827. memset(parm, 0, sizeof(union iucv_param));
  828. if (userdata)
  829. memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
  830. parm->ctrl.ippathid = path->pathid;
  831. rc = iucv_call_b2f0(IUCV_RESUME, parm);
  832. local_bh_enable();
  833. return rc;
  834. }
  835. /**
  836. * iucv_path_sever
  837. * @path: address of iucv path structure
  838. * @userdata: 16 bytes of data reflected to the communication partner
  839. *
  840. * This function terminates an IUCV path.
  841. *
  842. * Returns the result from the CP IUCV call.
  843. */
  844. int iucv_path_sever(struct iucv_path *path, u8 userdata[16])
  845. {
  846. int rc;
  847. preempt_disable();
  848. if (iucv_active_cpu != smp_processor_id())
  849. spin_lock_bh(&iucv_table_lock);
  850. rc = iucv_sever_pathid(path->pathid, userdata);
  851. iucv_path_table[path->pathid] = NULL;
  852. list_del_init(&path->list);
  853. if (iucv_active_cpu != smp_processor_id())
  854. spin_unlock_bh(&iucv_table_lock);
  855. preempt_enable();
  856. return rc;
  857. }
  858. EXPORT_SYMBOL(iucv_path_sever);
  859. /**
  860. * iucv_message_purge
  861. * @path: address of iucv path structure
  862. * @msg: address of iucv msg structure
  863. * @srccls: source class of message
  864. *
  865. * Cancels a message you have sent.
  866. *
  867. * Returns the result from the CP IUCV call.
  868. */
  869. int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
  870. u32 srccls)
  871. {
  872. union iucv_param *parm;
  873. int rc;
  874. local_bh_disable();
  875. parm = iucv_param[smp_processor_id()];
  876. memset(parm, 0, sizeof(union iucv_param));
  877. parm->purge.ippathid = path->pathid;
  878. parm->purge.ipmsgid = msg->id;
  879. parm->purge.ipsrccls = srccls;
  880. parm->purge.ipflags1 = IUCV_IPSRCCLS | IUCV_IPFGMID | IUCV_IPFGPID;
  881. rc = iucv_call_b2f0(IUCV_PURGE, parm);
  882. if (!rc) {
  883. msg->audit = (*(u32 *) &parm->purge.ipaudit) >> 8;
  884. msg->tag = parm->purge.ipmsgtag;
  885. }
  886. local_bh_enable();
  887. return rc;
  888. }
  889. EXPORT_SYMBOL(iucv_message_purge);
  890. /**
  891. * iucv_message_receive_iprmdata
  892. * @path: address of iucv path structure
  893. * @msg: address of iucv msg structure
  894. * @flags: how the message is received (IUCV_IPBUFLST)
  895. * @buffer: address of data buffer or address of struct iucv_array
  896. * @size: length of data buffer
  897. * @residual:
  898. *
  899. * Internal function used by iucv_message_receive and __iucv_message_receive
  900. * to receive RMDATA data stored in struct iucv_message.
  901. */
  902. static int iucv_message_receive_iprmdata(struct iucv_path *path,
  903. struct iucv_message *msg,
  904. u8 flags, void *buffer,
  905. size_t size, size_t *residual)
  906. {
  907. struct iucv_array *array;
  908. u8 *rmmsg;
  909. size_t copy;
  910. /*
  911. * Message is 8 bytes long and has been stored to the
  912. * message descriptor itself.
  913. */
  914. if (residual)
  915. *residual = abs(size - 8);
  916. rmmsg = msg->rmmsg;
  917. if (flags & IUCV_IPBUFLST) {
  918. /* Copy to struct iucv_array. */
  919. size = (size < 8) ? size : 8;
  920. for (array = buffer; size > 0; array++) {
  921. copy = min_t(size_t, size, array->length);
  922. memcpy((u8 *)(addr_t) array->address,
  923. rmmsg, copy);
  924. rmmsg += copy;
  925. size -= copy;
  926. }
  927. } else {
  928. /* Copy to direct buffer. */
  929. memcpy(buffer, rmmsg, min_t(size_t, size, 8));
  930. }
  931. return 0;
  932. }
  933. /**
  934. * __iucv_message_receive
  935. * @path: address of iucv path structure
  936. * @msg: address of iucv msg structure
  937. * @flags: how the message is received (IUCV_IPBUFLST)
  938. * @buffer: address of data buffer or address of struct iucv_array
  939. * @size: length of data buffer
  940. * @residual:
  941. *
  942. * This function receives messages that are being sent to you over
  943. * established paths. This function will deal with RMDATA messages
  944. * embedded in struct iucv_message as well.
  945. *
  946. * Locking: no locking
  947. *
  948. * Returns the result from the CP IUCV call.
  949. */
  950. int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
  951. u8 flags, void *buffer, size_t size, size_t *residual)
  952. {
  953. union iucv_param *parm;
  954. int rc;
  955. if (msg->flags & IUCV_IPRMDATA)
  956. return iucv_message_receive_iprmdata(path, msg, flags,
  957. buffer, size, residual);
  958. parm = iucv_param[smp_processor_id()];
  959. memset(parm, 0, sizeof(union iucv_param));
  960. parm->db.ipbfadr1 = (u32)(addr_t) buffer;
  961. parm->db.ipbfln1f = (u32) size;
  962. parm->db.ipmsgid = msg->id;
  963. parm->db.ippathid = path->pathid;
  964. parm->db.iptrgcls = msg->class;
  965. parm->db.ipflags1 = (flags | IUCV_IPFGPID |
  966. IUCV_IPFGMID | IUCV_IPTRGCLS);
  967. rc = iucv_call_b2f0(IUCV_RECEIVE, parm);
  968. if (!rc || rc == 5) {
  969. msg->flags = parm->db.ipflags1;
  970. if (residual)
  971. *residual = parm->db.ipbfln1f;
  972. }
  973. return rc;
  974. }
  975. EXPORT_SYMBOL(__iucv_message_receive);
  976. /**
  977. * iucv_message_receive
  978. * @path: address of iucv path structure
  979. * @msg: address of iucv msg structure
  980. * @flags: how the message is received (IUCV_IPBUFLST)
  981. * @buffer: address of data buffer or address of struct iucv_array
  982. * @size: length of data buffer
  983. * @residual:
  984. *
  985. * This function receives messages that are being sent to you over
  986. * established paths. This function will deal with RMDATA messages
  987. * embedded in struct iucv_message as well.
  988. *
  989. * Locking: local_bh_enable/local_bh_disable
  990. *
  991. * Returns the result from the CP IUCV call.
  992. */
  993. int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
  994. u8 flags, void *buffer, size_t size, size_t *residual)
  995. {
  996. int rc;
  997. if (msg->flags & IUCV_IPRMDATA)
  998. return iucv_message_receive_iprmdata(path, msg, flags,
  999. buffer, size, residual);
  1000. local_bh_disable();
  1001. rc = __iucv_message_receive(path, msg, flags, buffer, size, residual);
  1002. local_bh_enable();
  1003. return rc;
  1004. }
  1005. EXPORT_SYMBOL(iucv_message_receive);
  1006. /**
  1007. * iucv_message_reject
  1008. * @path: address of iucv path structure
  1009. * @msg: address of iucv msg structure
  1010. *
  1011. * The reject function refuses a specified message. Between the time you
  1012. * are notified of a message and the time that you complete the message,
  1013. * the message may be rejected.
  1014. *
  1015. * Returns the result from the CP IUCV call.
  1016. */
  1017. int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg)
  1018. {
  1019. union iucv_param *parm;
  1020. int rc;
  1021. local_bh_disable();
  1022. parm = iucv_param[smp_processor_id()];
  1023. memset(parm, 0, sizeof(union iucv_param));
  1024. parm->db.ippathid = path->pathid;
  1025. parm->db.ipmsgid = msg->id;
  1026. parm->db.iptrgcls = msg->class;
  1027. parm->db.ipflags1 = (IUCV_IPTRGCLS | IUCV_IPFGMID | IUCV_IPFGPID);
  1028. rc = iucv_call_b2f0(IUCV_REJECT, parm);
  1029. local_bh_enable();
  1030. return rc;
  1031. }
  1032. EXPORT_SYMBOL(iucv_message_reject);
  1033. /**
  1034. * iucv_message_reply
  1035. * @path: address of iucv path structure
  1036. * @msg: address of iucv msg structure
  1037. * @flags: how the reply is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
  1038. * @reply: address of reply data buffer or address of struct iucv_array
  1039. * @size: length of reply data buffer
  1040. *
  1041. * This function responds to the two-way messages that you receive. You
  1042. * must identify completely the message to which you wish to reply. ie,
  1043. * pathid, msgid, and trgcls. Prmmsg signifies the data is moved into
  1044. * the parameter list.
  1045. *
  1046. * Returns the result from the CP IUCV call.
  1047. */
  1048. int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
  1049. u8 flags, void *reply, size_t size)
  1050. {
  1051. union iucv_param *parm;
  1052. int rc;
  1053. local_bh_disable();
  1054. parm = iucv_param[smp_processor_id()];
  1055. memset(parm, 0, sizeof(union iucv_param));
  1056. if (flags & IUCV_IPRMDATA) {
  1057. parm->dpl.ippathid = path->pathid;
  1058. parm->dpl.ipflags1 = flags;
  1059. parm->dpl.ipmsgid = msg->id;
  1060. parm->dpl.iptrgcls = msg->class;
  1061. memcpy(parm->dpl.iprmmsg, reply, min_t(size_t, size, 8));
  1062. } else {
  1063. parm->db.ipbfadr1 = (u32)(addr_t) reply;
  1064. parm->db.ipbfln1f = (u32) size;
  1065. parm->db.ippathid = path->pathid;
  1066. parm->db.ipflags1 = flags;
  1067. parm->db.ipmsgid = msg->id;
  1068. parm->db.iptrgcls = msg->class;
  1069. }
  1070. rc = iucv_call_b2f0(IUCV_REPLY, parm);
  1071. local_bh_enable();
  1072. return rc;
  1073. }
  1074. EXPORT_SYMBOL(iucv_message_reply);
  1075. /**
  1076. * __iucv_message_send
  1077. * @path: address of iucv path structure
  1078. * @msg: address of iucv msg structure
  1079. * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
  1080. * @srccls: source class of message
  1081. * @buffer: address of send buffer or address of struct iucv_array
  1082. * @size: length of send buffer
  1083. *
  1084. * This function transmits data to another application. Data to be
  1085. * transmitted is in a buffer and this is a one-way message and the
  1086. * receiver will not reply to the message.
  1087. *
  1088. * Locking: no locking
  1089. *
  1090. * Returns the result from the CP IUCV call.
  1091. */
  1092. int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
  1093. u8 flags, u32 srccls, void *buffer, size_t size)
  1094. {
  1095. union iucv_param *parm;
  1096. int rc;
  1097. parm = iucv_param[smp_processor_id()];
  1098. memset(parm, 0, sizeof(union iucv_param));
  1099. if (flags & IUCV_IPRMDATA) {
  1100. /* Message of 8 bytes can be placed into the parameter list. */
  1101. parm->dpl.ippathid = path->pathid;
  1102. parm->dpl.ipflags1 = flags | IUCV_IPNORPY;
  1103. parm->dpl.iptrgcls = msg->class;
  1104. parm->dpl.ipsrccls = srccls;
  1105. parm->dpl.ipmsgtag = msg->tag;
  1106. memcpy(parm->dpl.iprmmsg, buffer, 8);
  1107. } else {
  1108. parm->db.ipbfadr1 = (u32)(addr_t) buffer;
  1109. parm->db.ipbfln1f = (u32) size;
  1110. parm->db.ippathid = path->pathid;
  1111. parm->db.ipflags1 = flags | IUCV_IPNORPY;
  1112. parm->db.iptrgcls = msg->class;
  1113. parm->db.ipsrccls = srccls;
  1114. parm->db.ipmsgtag = msg->tag;
  1115. }
  1116. rc = iucv_call_b2f0(IUCV_SEND, parm);
  1117. if (!rc)
  1118. msg->id = parm->db.ipmsgid;
  1119. return rc;
  1120. }
  1121. EXPORT_SYMBOL(__iucv_message_send);
  1122. /**
  1123. * iucv_message_send
  1124. * @path: address of iucv path structure
  1125. * @msg: address of iucv msg structure
  1126. * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
  1127. * @srccls: source class of message
  1128. * @buffer: address of send buffer or address of struct iucv_array
  1129. * @size: length of send buffer
  1130. *
  1131. * This function transmits data to another application. Data to be
  1132. * transmitted is in a buffer and this is a one-way message and the
  1133. * receiver will not reply to the message.
  1134. *
  1135. * Locking: local_bh_enable/local_bh_disable
  1136. *
  1137. * Returns the result from the CP IUCV call.
  1138. */
  1139. int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
  1140. u8 flags, u32 srccls, void *buffer, size_t size)
  1141. {
  1142. int rc;
  1143. local_bh_disable();
  1144. rc = __iucv_message_send(path, msg, flags, srccls, buffer, size);
  1145. local_bh_enable();
  1146. return rc;
  1147. }
  1148. EXPORT_SYMBOL(iucv_message_send);
  1149. /**
  1150. * iucv_message_send2way
  1151. * @path: address of iucv path structure
  1152. * @msg: address of iucv msg structure
  1153. * @flags: how the message is sent and the reply is received
  1154. * (IUCV_IPRMDATA, IUCV_IPBUFLST, IUCV_IPPRTY, IUCV_ANSLST)
  1155. * @srccls: source class of message
  1156. * @buffer: address of send buffer or address of struct iucv_array
  1157. * @size: length of send buffer
  1158. * @ansbuf: address of answer buffer or address of struct iucv_array
  1159. * @asize: size of reply buffer
  1160. *
  1161. * This function transmits data to another application. Data to be
  1162. * transmitted is in a buffer. The receiver of the send is expected to
  1163. * reply to the message and a buffer is provided into which IUCV moves
  1164. * the reply to this message.
  1165. *
  1166. * Returns the result from the CP IUCV call.
  1167. */
  1168. int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
  1169. u8 flags, u32 srccls, void *buffer, size_t size,
  1170. void *answer, size_t asize, size_t *residual)
  1171. {
  1172. union iucv_param *parm;
  1173. int rc;
  1174. local_bh_disable();
  1175. parm = iucv_param[smp_processor_id()];
  1176. memset(parm, 0, sizeof(union iucv_param));
  1177. if (flags & IUCV_IPRMDATA) {
  1178. parm->dpl.ippathid = path->pathid;
  1179. parm->dpl.ipflags1 = path->flags; /* priority message */
  1180. parm->dpl.iptrgcls = msg->class;
  1181. parm->dpl.ipsrccls = srccls;
  1182. parm->dpl.ipmsgtag = msg->tag;
  1183. parm->dpl.ipbfadr2 = (u32)(addr_t) answer;
  1184. parm->dpl.ipbfln2f = (u32) asize;
  1185. memcpy(parm->dpl.iprmmsg, buffer, 8);
  1186. } else {
  1187. parm->db.ippathid = path->pathid;
  1188. parm->db.ipflags1 = path->flags; /* priority message */
  1189. parm->db.iptrgcls = msg->class;
  1190. parm->db.ipsrccls = srccls;
  1191. parm->db.ipmsgtag = msg->tag;
  1192. parm->db.ipbfadr1 = (u32)(addr_t) buffer;
  1193. parm->db.ipbfln1f = (u32) size;
  1194. parm->db.ipbfadr2 = (u32)(addr_t) answer;
  1195. parm->db.ipbfln2f = (u32) asize;
  1196. }
  1197. rc = iucv_call_b2f0(IUCV_SEND, parm);
  1198. if (!rc)
  1199. msg->id = parm->db.ipmsgid;
  1200. local_bh_enable();
  1201. return rc;
  1202. }
  1203. EXPORT_SYMBOL(iucv_message_send2way);
  1204. /**
  1205. * iucv_path_pending
  1206. * @data: Pointer to external interrupt buffer
  1207. *
  1208. * Process connection pending work item. Called from tasklet while holding
  1209. * iucv_table_lock.
  1210. */
  1211. struct iucv_path_pending {
  1212. u16 ippathid;
  1213. u8 ipflags1;
  1214. u8 iptype;
  1215. u16 ipmsglim;
  1216. u16 res1;
  1217. u8 ipvmid[8];
  1218. u8 ipuser[16];
  1219. u32 res3;
  1220. u8 ippollfg;
  1221. u8 res4[3];
  1222. } __attribute__ ((packed));
  1223. static void iucv_path_pending(struct iucv_irq_data *data)
  1224. {
  1225. struct iucv_path_pending *ipp = (void *) data;
  1226. struct iucv_handler *handler;
  1227. struct iucv_path *path;
  1228. char *error;
  1229. BUG_ON(iucv_path_table[ipp->ippathid]);
  1230. /* New pathid, handler found. Create a new path struct. */
  1231. error = iucv_error_no_memory;
  1232. path = iucv_path_alloc(ipp->ipmsglim, ipp->ipflags1, GFP_ATOMIC);
  1233. if (!path)
  1234. goto out_sever;
  1235. path->pathid = ipp->ippathid;
  1236. iucv_path_table[path->pathid] = path;
  1237. EBCASC(ipp->ipvmid, 8);
  1238. /* Call registered handler until one is found that wants the path. */
  1239. list_for_each_entry(handler, &iucv_handler_list, list) {
  1240. if (!handler->path_pending)
  1241. continue;
  1242. /*
  1243. * Add path to handler to allow a call to iucv_path_sever
  1244. * inside the path_pending function. If the handler returns
  1245. * an error remove the path from the handler again.
  1246. */
  1247. list_add(&path->list, &handler->paths);
  1248. path->handler = handler;
  1249. if (!handler->path_pending(path, ipp->ipvmid, ipp->ipuser))
  1250. return;
  1251. list_del(&path->list);
  1252. path->handler = NULL;
  1253. }
  1254. /* No handler wanted the path. */
  1255. iucv_path_table[path->pathid] = NULL;
  1256. iucv_path_free(path);
  1257. error = iucv_error_no_listener;
  1258. out_sever:
  1259. iucv_sever_pathid(ipp->ippathid, error);
  1260. }
  1261. /**
  1262. * iucv_path_complete
  1263. * @data: Pointer to external interrupt buffer
  1264. *
  1265. * Process connection complete work item. Called from tasklet while holding
  1266. * iucv_table_lock.
  1267. */
  1268. struct iucv_path_complete {
  1269. u16 ippathid;
  1270. u8 ipflags1;
  1271. u8 iptype;
  1272. u16 ipmsglim;
  1273. u16 res1;
  1274. u8 res2[8];
  1275. u8 ipuser[16];
  1276. u32 res3;
  1277. u8 ippollfg;
  1278. u8 res4[3];
  1279. } __attribute__ ((packed));
  1280. static void iucv_path_complete(struct iucv_irq_data *data)
  1281. {
  1282. struct iucv_path_complete *ipc = (void *) data;
  1283. struct iucv_path *path = iucv_path_table[ipc->ippathid];
  1284. if (path)
  1285. path->flags = ipc->ipflags1;
  1286. if (path && path->handler && path->handler->path_complete)
  1287. path->handler->path_complete(path, ipc->ipuser);
  1288. }
  1289. /**
  1290. * iucv_path_severed
  1291. * @data: Pointer to external interrupt buffer
  1292. *
  1293. * Process connection severed work item. Called from tasklet while holding
  1294. * iucv_table_lock.
  1295. */
  1296. struct iucv_path_severed {
  1297. u16 ippathid;
  1298. u8 res1;
  1299. u8 iptype;
  1300. u32 res2;
  1301. u8 res3[8];
  1302. u8 ipuser[16];
  1303. u32 res4;
  1304. u8 ippollfg;
  1305. u8 res5[3];
  1306. } __attribute__ ((packed));
  1307. static void iucv_path_severed(struct iucv_irq_data *data)
  1308. {
  1309. struct iucv_path_severed *ips = (void *) data;
  1310. struct iucv_path *path = iucv_path_table[ips->ippathid];
  1311. if (!path || !path->handler) /* Already severed */
  1312. return;
  1313. if (path->handler->path_severed)
  1314. path->handler->path_severed(path, ips->ipuser);
  1315. else {
  1316. iucv_sever_pathid(path->pathid, NULL);
  1317. iucv_path_table[path->pathid] = NULL;
  1318. list_del(&path->list);
  1319. iucv_path_free(path);
  1320. }
  1321. }
  1322. /**
  1323. * iucv_path_quiesced
  1324. * @data: Pointer to external interrupt buffer
  1325. *
  1326. * Process connection quiesced work item. Called from tasklet while holding
  1327. * iucv_table_lock.
  1328. */
  1329. struct iucv_path_quiesced {
  1330. u16 ippathid;
  1331. u8 res1;
  1332. u8 iptype;
  1333. u32 res2;
  1334. u8 res3[8];
  1335. u8 ipuser[16];
  1336. u32 res4;
  1337. u8 ippollfg;
  1338. u8 res5[3];
  1339. } __attribute__ ((packed));
  1340. static void iucv_path_quiesced(struct iucv_irq_data *data)
  1341. {
  1342. struct iucv_path_quiesced *ipq = (void *) data;
  1343. struct iucv_path *path = iucv_path_table[ipq->ippathid];
  1344. if (path && path->handler && path->handler->path_quiesced)
  1345. path->handler->path_quiesced(path, ipq->ipuser);
  1346. }
  1347. /**
  1348. * iucv_path_resumed
  1349. * @data: Pointer to external interrupt buffer
  1350. *
  1351. * Process connection resumed work item. Called from tasklet while holding
  1352. * iucv_table_lock.
  1353. */
  1354. struct iucv_path_resumed {
  1355. u16 ippathid;
  1356. u8 res1;
  1357. u8 iptype;
  1358. u32 res2;
  1359. u8 res3[8];
  1360. u8 ipuser[16];
  1361. u32 res4;
  1362. u8 ippollfg;
  1363. u8 res5[3];
  1364. } __attribute__ ((packed));
  1365. static void iucv_path_resumed(struct iucv_irq_data *data)
  1366. {
  1367. struct iucv_path_resumed *ipr = (void *) data;
  1368. struct iucv_path *path = iucv_path_table[ipr->ippathid];
  1369. if (path && path->handler && path->handler->path_resumed)
  1370. path->handler->path_resumed(path, ipr->ipuser);
  1371. }
  1372. /**
  1373. * iucv_message_complete
  1374. * @data: Pointer to external interrupt buffer
  1375. *
  1376. * Process message complete work item. Called from tasklet while holding
  1377. * iucv_table_lock.
  1378. */
  1379. struct iucv_message_complete {
  1380. u16 ippathid;
  1381. u8 ipflags1;
  1382. u8 iptype;
  1383. u32 ipmsgid;
  1384. u32 ipaudit;
  1385. u8 iprmmsg[8];
  1386. u32 ipsrccls;
  1387. u32 ipmsgtag;
  1388. u32 res;
  1389. u32 ipbfln2f;
  1390. u8 ippollfg;
  1391. u8 res2[3];
  1392. } __attribute__ ((packed));
  1393. static void iucv_message_complete(struct iucv_irq_data *data)
  1394. {
  1395. struct iucv_message_complete *imc = (void *) data;
  1396. struct iucv_path *path = iucv_path_table[imc->ippathid];
  1397. struct iucv_message msg;
  1398. if (path && path->handler && path->handler->message_complete) {
  1399. msg.flags = imc->ipflags1;
  1400. msg.id = imc->ipmsgid;
  1401. msg.audit = imc->ipaudit;
  1402. memcpy(msg.rmmsg, imc->iprmmsg, 8);
  1403. msg.class = imc->ipsrccls;
  1404. msg.tag = imc->ipmsgtag;
  1405. msg.length = imc->ipbfln2f;
  1406. path->handler->message_complete(path, &msg);
  1407. }
  1408. }
  1409. /**
  1410. * iucv_message_pending
  1411. * @data: Pointer to external interrupt buffer
  1412. *
  1413. * Process message pending work item. Called from tasklet while holding
  1414. * iucv_table_lock.
  1415. */
  1416. struct iucv_message_pending {
  1417. u16 ippathid;
  1418. u8 ipflags1;
  1419. u8 iptype;
  1420. u32 ipmsgid;
  1421. u32 iptrgcls;
  1422. union {
  1423. u32 iprmmsg1_u32;
  1424. u8 iprmmsg1[4];
  1425. } ln1msg1;
  1426. union {
  1427. u32 ipbfln1f;
  1428. u8 iprmmsg2[4];
  1429. } ln1msg2;
  1430. u32 res1[3];
  1431. u32 ipbfln2f;
  1432. u8 ippollfg;
  1433. u8 res2[3];
  1434. } __attribute__ ((packed));
  1435. static void iucv_message_pending(struct iucv_irq_data *data)
  1436. {
  1437. struct iucv_message_pending *imp = (void *) data;
  1438. struct iucv_path *path = iucv_path_table[imp->ippathid];
  1439. struct iucv_message msg;
  1440. if (path && path->handler && path->handler->message_pending) {
  1441. msg.flags = imp->ipflags1;
  1442. msg.id = imp->ipmsgid;
  1443. msg.class = imp->iptrgcls;
  1444. if (imp->ipflags1 & IUCV_IPRMDATA) {
  1445. memcpy(msg.rmmsg, imp->ln1msg1.iprmmsg1, 8);
  1446. msg.length = 8;
  1447. } else
  1448. msg.length = imp->ln1msg2.ipbfln1f;
  1449. msg.reply_size = imp->ipbfln2f;
  1450. path->handler->message_pending(path, &msg);
  1451. }
  1452. }
  1453. /**
  1454. * iucv_tasklet_fn:
  1455. *
  1456. * This tasklet loops over the queue of irq buffers created by
  1457. * iucv_external_interrupt, calls the appropriate action handler
  1458. * and then frees the buffer.
  1459. */
  1460. static void iucv_tasklet_fn(unsigned long ignored)
  1461. {
  1462. typedef void iucv_irq_fn(struct iucv_irq_data *);
  1463. static iucv_irq_fn *irq_fn[] = {
  1464. [0x02] = iucv_path_complete,
  1465. [0x03] = iucv_path_severed,
  1466. [0x04] = iucv_path_quiesced,
  1467. [0x05] = iucv_path_resumed,
  1468. [0x06] = iucv_message_complete,
  1469. [0x07] = iucv_message_complete,
  1470. [0x08] = iucv_message_pending,
  1471. [0x09] = iucv_message_pending,
  1472. };
  1473. LIST_HEAD(task_queue);
  1474. struct iucv_irq_list *p, *n;
  1475. /* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
  1476. if (!spin_trylock(&iucv_table_lock)) {
  1477. tasklet_schedule(&iucv_tasklet);
  1478. return;
  1479. }
  1480. iucv_active_cpu = smp_processor_id();
  1481. spin_lock_irq(&iucv_queue_lock);
  1482. list_splice_init(&iucv_task_queue, &task_queue);
  1483. spin_unlock_irq(&iucv_queue_lock);
  1484. list_for_each_entry_safe(p, n, &task_queue, list) {
  1485. list_del_init(&p->list);
  1486. irq_fn[p->data.iptype](&p->data);
  1487. kfree(p);
  1488. }
  1489. iucv_active_cpu = -1;
  1490. spin_unlock(&iucv_table_lock);
  1491. }
  1492. /**
  1493. * iucv_work_fn:
  1494. *
  1495. * This work function loops over the queue of path pending irq blocks
  1496. * created by iucv_external_interrupt, calls the appropriate action
  1497. * handler and then frees the buffer.
  1498. */
  1499. static void iucv_work_fn(struct work_struct *work)
  1500. {
  1501. typedef void iucv_irq_fn(struct iucv_irq_data *);
  1502. LIST_HEAD(work_queue);
  1503. struct iucv_irq_list *p, *n;
  1504. /* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
  1505. spin_lock_bh(&iucv_table_lock);
  1506. iucv_active_cpu = smp_processor_id();
  1507. spin_lock_irq(&iucv_queue_lock);
  1508. list_splice_init(&iucv_work_queue, &work_queue);
  1509. spin_unlock_irq(&iucv_queue_lock);
  1510. iucv_cleanup_queue();
  1511. list_for_each_entry_safe(p, n, &work_queue, list) {
  1512. list_del_init(&p->list);
  1513. iucv_path_pending(&p->data);
  1514. kfree(p);
  1515. }
  1516. iucv_active_cpu = -1;
  1517. spin_unlock_bh(&iucv_table_lock);
  1518. }
  1519. /**
  1520. * iucv_external_interrupt
  1521. * @code: irq code
  1522. *
  1523. * Handles external interrupts coming in from CP.
  1524. * Places the interrupt buffer on a queue and schedules iucv_tasklet_fn().
  1525. */
  1526. static void iucv_external_interrupt(u16 code)
  1527. {
  1528. struct iucv_irq_data *p;
  1529. struct iucv_irq_list *work;
  1530. p = iucv_irq_data[smp_processor_id()];
  1531. if (p->ippathid >= iucv_max_pathid) {
  1532. WARN_ON(p->ippathid >= iucv_max_pathid);
  1533. iucv_sever_pathid(p->ippathid, iucv_error_no_listener);
  1534. return;
  1535. }
  1536. BUG_ON(p->iptype < 0x01 || p->iptype > 0x09);
  1537. work = kmalloc(sizeof(struct iucv_irq_list), GFP_ATOMIC);
  1538. if (!work) {
  1539. pr_warning("iucv_external_interrupt: out of memory\n");
  1540. return;
  1541. }
  1542. memcpy(&work->data, p, sizeof(work->data));
  1543. spin_lock(&iucv_queue_lock);
  1544. if (p->iptype == 0x01) {
  1545. /* Path pending interrupt. */
  1546. list_add_tail(&work->list, &iucv_work_queue);
  1547. schedule_work(&iucv_work);
  1548. } else {
  1549. /* The other interrupts. */
  1550. list_add_tail(&work->list, &iucv_task_queue);
  1551. tasklet_schedule(&iucv_tasklet);
  1552. }
  1553. spin_unlock(&iucv_queue_lock);
  1554. }
  1555. /**
  1556. * iucv_init
  1557. *
  1558. * Allocates and initializes various data structures.
  1559. */
  1560. static int __init iucv_init(void)
  1561. {
  1562. int rc;
  1563. int cpu;
  1564. if (!MACHINE_IS_VM) {
  1565. rc = -EPROTONOSUPPORT;
  1566. goto out;
  1567. }
  1568. rc = iucv_query_maxconn();
  1569. if (rc)
  1570. goto out;
  1571. rc = register_external_interrupt(0x4000, iucv_external_interrupt);
  1572. if (rc)
  1573. goto out;
  1574. iucv_root = root_device_register("iucv");
  1575. if (IS_ERR(iucv_root)) {
  1576. rc = PTR_ERR(iucv_root);
  1577. goto out_int;
  1578. }
  1579. for_each_online_cpu(cpu) {
  1580. /* Note: GFP_DMA used to get memory below 2G */
  1581. iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
  1582. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  1583. if (!iucv_irq_data[cpu]) {
  1584. rc = -ENOMEM;
  1585. goto out_free;
  1586. }
  1587. /* Allocate parameter blocks. */
  1588. iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
  1589. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  1590. if (!iucv_param[cpu]) {
  1591. rc = -ENOMEM;
  1592. goto out_free;
  1593. }
  1594. iucv_param_irq[cpu] = kmalloc_node(sizeof(union iucv_param),
  1595. GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
  1596. if (!iucv_param_irq[cpu]) {
  1597. rc = -ENOMEM;
  1598. goto out_free;
  1599. }
  1600. }
  1601. rc = register_hotcpu_notifier(&iucv_cpu_notifier);
  1602. if (rc)
  1603. goto out_free;
  1604. ASCEBC(iucv_error_no_listener, 16);
  1605. ASCEBC(iucv_error_no_memory, 16);
  1606. ASCEBC(iucv_error_pathid, 16);
  1607. iucv_available = 1;
  1608. rc = bus_register(&iucv_bus);
  1609. if (rc)
  1610. goto out_cpu;
  1611. return 0;
  1612. out_cpu:
  1613. unregister_hotcpu_notifier(&iucv_cpu_notifier);
  1614. out_free:
  1615. for_each_possible_cpu(cpu) {
  1616. kfree(iucv_param_irq[cpu]);
  1617. iucv_param_irq[cpu] = NULL;
  1618. kfree(iucv_param[cpu]);
  1619. iucv_param[cpu] = NULL;
  1620. kfree(iucv_irq_data[cpu]);
  1621. iucv_irq_data[cpu] = NULL;
  1622. }
  1623. root_device_unregister(iucv_root);
  1624. out_int:
  1625. unregister_external_interrupt(0x4000, iucv_external_interrupt);
  1626. out:
  1627. return rc;
  1628. }
  1629. /**
  1630. * iucv_exit
  1631. *
  1632. * Frees everything allocated from iucv_init.
  1633. */
  1634. static void __exit iucv_exit(void)
  1635. {
  1636. struct iucv_irq_list *p, *n;
  1637. int cpu;
  1638. spin_lock_irq(&iucv_queue_lock);
  1639. list_for_each_entry_safe(p, n, &iucv_task_queue, list)
  1640. kfree(p);
  1641. list_for_each_entry_safe(p, n, &iucv_work_queue, list)
  1642. kfree(p);
  1643. spin_unlock_irq(&iucv_queue_lock);
  1644. unregister_hotcpu_notifier(&iucv_cpu_notifier);
  1645. for_each_possible_cpu(cpu) {
  1646. kfree(iucv_param_irq[cpu]);
  1647. iucv_param_irq[cpu] = NULL;
  1648. kfree(iucv_param[cpu]);
  1649. iucv_param[cpu] = NULL;
  1650. kfree(iucv_irq_data[cpu]);
  1651. iucv_irq_data[cpu] = NULL;
  1652. }
  1653. root_device_unregister(iucv_root);
  1654. bus_unregister(&iucv_bus);
  1655. unregister_external_interrupt(0x4000, iucv_external_interrupt);
  1656. }
  1657. subsys_initcall(iucv_init);
  1658. module_exit(iucv_exit);
  1659. MODULE_AUTHOR("(C) 2001 IBM Corp. by Fritz Elfert (felfert@millenux.com)");
  1660. MODULE_DESCRIPTION("Linux for S/390 IUCV lowlevel driver");
  1661. MODULE_LICENSE("GPL");