iucv.c 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567
  1. /*
  2. * $Id: iucv.c,v 1.45 2005/04/26 22:59:06 braunu Exp $
  3. *
  4. * IUCV network driver
  5. *
  6. * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
  7. * Author(s):
  8. * Original source:
  9. * Alan Altmark (Alan_Altmark@us.ibm.com) Sept. 2000
  10. * Xenia Tkatschow (xenia@us.ibm.com)
  11. * 2Gb awareness and general cleanup:
  12. * Fritz Elfert (elfert@de.ibm.com, felfert@millenux.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. * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.45 $
  33. *
  34. */
  35. /* #define DEBUG */
  36. #include <linux/module.h>
  37. #include <linux/moduleparam.h>
  38. #include <linux/config.h>
  39. #include <linux/spinlock.h>
  40. #include <linux/kernel.h>
  41. #include <linux/slab.h>
  42. #include <linux/init.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/list.h>
  45. #include <linux/errno.h>
  46. #include <linux/err.h>
  47. #include <linux/device.h>
  48. #include <asm/atomic.h>
  49. #include "iucv.h"
  50. #include <asm/io.h>
  51. #include <asm/s390_ext.h>
  52. #include <asm/ebcdic.h>
  53. #include <asm/smp.h>
  54. #include <asm/ccwdev.h> //for root device stuff
  55. /* FLAGS:
  56. * All flags are defined in the field IPFLAGS1 of each function
  57. * and can be found in CP Programming Services.
  58. * IPSRCCLS - Indicates you have specified a source class
  59. * IPFGMCL - Indicates you have specified a target class
  60. * IPFGPID - Indicates you have specified a pathid
  61. * IPFGMID - Indicates you have specified a message ID
  62. * IPANSLST - Indicates that you are using an address list for
  63. * reply data
  64. * IPBUFLST - Indicates that you are using an address list for
  65. * message data
  66. */
  67. #define IPSRCCLS 0x01
  68. #define IPFGMCL 0x01
  69. #define IPFGPID 0x02
  70. #define IPFGMID 0x04
  71. #define IPANSLST 0x08
  72. #define IPBUFLST 0x40
  73. static int
  74. iucv_bus_match (struct device *dev, struct device_driver *drv)
  75. {
  76. return 0;
  77. }
  78. struct bus_type iucv_bus = {
  79. .name = "iucv",
  80. .match = iucv_bus_match,
  81. };
  82. struct device *iucv_root;
  83. /* General IUCV interrupt structure */
  84. typedef struct {
  85. __u16 ippathid;
  86. __u8 res1;
  87. __u8 iptype;
  88. __u32 res2;
  89. __u8 ipvmid[8];
  90. __u8 res3[24];
  91. } iucv_GeneralInterrupt;
  92. static iucv_GeneralInterrupt *iucv_external_int_buffer = NULL;
  93. /* Spin Lock declaration */
  94. static DEFINE_SPINLOCK(iucv_lock);
  95. static int messagesDisabled = 0;
  96. /***************INTERRUPT HANDLING ***************/
  97. typedef struct {
  98. struct list_head queue;
  99. iucv_GeneralInterrupt data;
  100. } iucv_irqdata;
  101. static struct list_head iucv_irq_queue;
  102. static DEFINE_SPINLOCK(iucv_irq_queue_lock);
  103. /*
  104. *Internal function prototypes
  105. */
  106. static void iucv_tasklet_handler(unsigned long);
  107. static void iucv_irq_handler(struct pt_regs *, __u16);
  108. static DECLARE_TASKLET(iucv_tasklet,iucv_tasklet_handler,0);
  109. /************ FUNCTION ID'S ****************************/
  110. #define ACCEPT 10
  111. #define CONNECT 11
  112. #define DECLARE_BUFFER 12
  113. #define PURGE 9
  114. #define QUERY 0
  115. #define QUIESCE 13
  116. #define RECEIVE 5
  117. #define REJECT 8
  118. #define REPLY 6
  119. #define RESUME 14
  120. #define RETRIEVE_BUFFER 2
  121. #define SEND 4
  122. #define SETMASK 16
  123. #define SEVER 15
  124. /**
  125. * Structure: handler
  126. * members: list - list management.
  127. * structure: id
  128. * userid - 8 char array of machine identification
  129. * user_data - 16 char array for user identification
  130. * mask - 24 char array used to compare the 2 previous
  131. * interrupt_table - vector of interrupt functions.
  132. * pgm_data - ulong, application data that is passed
  133. * to the interrupt handlers
  134. */
  135. typedef struct handler_t {
  136. struct list_head list;
  137. struct {
  138. __u8 userid[8];
  139. __u8 user_data[16];
  140. __u8 mask[24];
  141. } id;
  142. iucv_interrupt_ops_t *interrupt_table;
  143. void *pgm_data;
  144. } handler;
  145. /**
  146. * iucv_handler_table: List of registered handlers.
  147. */
  148. static struct list_head iucv_handler_table;
  149. /**
  150. * iucv_pathid_table: an array of *handler pointing into
  151. * iucv_handler_table for fast indexing by pathid;
  152. */
  153. static handler **iucv_pathid_table;
  154. static unsigned long max_connections;
  155. /**
  156. * iucv_cpuid: contains the logical cpu number of the cpu which
  157. * has declared the iucv buffer by issuing DECLARE_BUFFER.
  158. * If no cpu has done the initialization iucv_cpuid contains -1.
  159. */
  160. static int iucv_cpuid = -1;
  161. /**
  162. * register_flag: is 0 when external interrupt has not been registered
  163. */
  164. static int register_flag;
  165. /****************FIVE 40-BYTE PARAMETER STRUCTURES******************/
  166. /* Data struct 1: iparml_control
  167. * Used for iucv_accept
  168. * iucv_connect
  169. * iucv_quiesce
  170. * iucv_resume
  171. * iucv_sever
  172. * iucv_retrieve_buffer
  173. * Data struct 2: iparml_dpl (data in parameter list)
  174. * Used for iucv_send_prmmsg
  175. * iucv_send2way_prmmsg
  176. * iucv_send2way_prmmsg_array
  177. * iucv_reply_prmmsg
  178. * Data struct 3: iparml_db (data in a buffer)
  179. * Used for iucv_receive
  180. * iucv_receive_array
  181. * iucv_reject
  182. * iucv_reply
  183. * iucv_reply_array
  184. * iucv_send
  185. * iucv_send_array
  186. * iucv_send2way
  187. * iucv_send2way_array
  188. * iucv_declare_buffer
  189. * Data struct 4: iparml_purge
  190. * Used for iucv_purge
  191. * iucv_query
  192. * Data struct 5: iparml_set_mask
  193. * Used for iucv_set_mask
  194. */
  195. typedef struct {
  196. __u16 ippathid;
  197. __u8 ipflags1;
  198. __u8 iprcode;
  199. __u16 ipmsglim;
  200. __u16 res1;
  201. __u8 ipvmid[8];
  202. __u8 ipuser[16];
  203. __u8 iptarget[8];
  204. } iparml_control;
  205. typedef struct {
  206. __u16 ippathid;
  207. __u8 ipflags1;
  208. __u8 iprcode;
  209. __u32 ipmsgid;
  210. __u32 iptrgcls;
  211. __u8 iprmmsg[8];
  212. __u32 ipsrccls;
  213. __u32 ipmsgtag;
  214. __u32 ipbfadr2;
  215. __u32 ipbfln2f;
  216. __u32 res;
  217. } iparml_dpl;
  218. typedef struct {
  219. __u16 ippathid;
  220. __u8 ipflags1;
  221. __u8 iprcode;
  222. __u32 ipmsgid;
  223. __u32 iptrgcls;
  224. __u32 ipbfadr1;
  225. __u32 ipbfln1f;
  226. __u32 ipsrccls;
  227. __u32 ipmsgtag;
  228. __u32 ipbfadr2;
  229. __u32 ipbfln2f;
  230. __u32 res;
  231. } iparml_db;
  232. typedef struct {
  233. __u16 ippathid;
  234. __u8 ipflags1;
  235. __u8 iprcode;
  236. __u32 ipmsgid;
  237. __u8 ipaudit[3];
  238. __u8 res1[5];
  239. __u32 res2;
  240. __u32 ipsrccls;
  241. __u32 ipmsgtag;
  242. __u32 res3[3];
  243. } iparml_purge;
  244. typedef struct {
  245. __u8 ipmask;
  246. __u8 res1[2];
  247. __u8 iprcode;
  248. __u32 res2[9];
  249. } iparml_set_mask;
  250. typedef struct {
  251. union {
  252. iparml_control p_ctrl;
  253. iparml_dpl p_dpl;
  254. iparml_db p_db;
  255. iparml_purge p_purge;
  256. iparml_set_mask p_set_mask;
  257. } param;
  258. atomic_t in_use;
  259. __u32 res;
  260. } __attribute__ ((aligned(8))) iucv_param;
  261. #define PARAM_POOL_SIZE (PAGE_SIZE / sizeof(iucv_param))
  262. static iucv_param * iucv_param_pool;
  263. MODULE_AUTHOR("(C) 2001 IBM Corp. by Fritz Elfert (felfert@millenux.com)");
  264. MODULE_DESCRIPTION("Linux for S/390 IUCV lowlevel driver");
  265. MODULE_LICENSE("GPL");
  266. /*
  267. * Debugging stuff
  268. *******************************************************************************/
  269. #ifdef DEBUG
  270. static int debuglevel = 0;
  271. module_param(debuglevel, int, 0);
  272. MODULE_PARM_DESC(debuglevel,
  273. "Specifies the debug level (0=off ... 3=all)");
  274. static void
  275. iucv_dumpit(char *title, void *buf, int len)
  276. {
  277. int i;
  278. __u8 *p = (__u8 *)buf;
  279. if (debuglevel < 3)
  280. return;
  281. printk(KERN_DEBUG "%s\n", title);
  282. printk(" ");
  283. for (i = 0; i < len; i++) {
  284. if (!(i % 16) && i != 0)
  285. printk ("\n ");
  286. else if (!(i % 4) && i != 0)
  287. printk(" ");
  288. printk("%02X", *p++);
  289. }
  290. if (len % 16)
  291. printk ("\n");
  292. return;
  293. }
  294. #define iucv_debug(lvl, fmt, args...) \
  295. do { \
  296. if (debuglevel >= lvl) \
  297. printk(KERN_DEBUG "%s: " fmt "\n", __FUNCTION__ , ## args); \
  298. } while (0)
  299. #else
  300. #define iucv_debug(lvl, fmt, args...)
  301. #define iucv_dumpit(title, buf, len)
  302. #endif
  303. /*
  304. * Internal functions
  305. *******************************************************************************/
  306. /**
  307. * print start banner
  308. */
  309. static void
  310. iucv_banner(void)
  311. {
  312. char vbuf[] = "$Revision: 1.45 $";
  313. char *version = vbuf;
  314. if ((version = strchr(version, ':'))) {
  315. char *p = strchr(version + 1, '$');
  316. if (p)
  317. *p = '\0';
  318. } else
  319. version = " ??? ";
  320. printk(KERN_INFO
  321. "IUCV lowlevel driver Version%s initialized\n", version);
  322. }
  323. /**
  324. * iucv_init - Initialization
  325. *
  326. * Allocates and initializes various data structures.
  327. */
  328. static int
  329. iucv_init(void)
  330. {
  331. int ret;
  332. if (iucv_external_int_buffer)
  333. return 0;
  334. if (!MACHINE_IS_VM) {
  335. printk(KERN_ERR "IUCV: IUCV connection needs VM as base\n");
  336. return -EPROTONOSUPPORT;
  337. }
  338. ret = bus_register(&iucv_bus);
  339. if (ret) {
  340. printk(KERN_ERR "IUCV: failed to register bus.\n");
  341. return ret;
  342. }
  343. iucv_root = s390_root_dev_register("iucv");
  344. if (IS_ERR(iucv_root)) {
  345. printk(KERN_ERR "IUCV: failed to register iucv root.\n");
  346. bus_unregister(&iucv_bus);
  347. return PTR_ERR(iucv_root);
  348. }
  349. /* Note: GFP_DMA used used to get memory below 2G */
  350. iucv_external_int_buffer = kmalloc(sizeof(iucv_GeneralInterrupt),
  351. GFP_KERNEL|GFP_DMA);
  352. if (!iucv_external_int_buffer) {
  353. printk(KERN_WARNING
  354. "%s: Could not allocate external interrupt buffer\n",
  355. __FUNCTION__);
  356. s390_root_dev_unregister(iucv_root);
  357. bus_unregister(&iucv_bus);
  358. return -ENOMEM;
  359. }
  360. memset(iucv_external_int_buffer, 0, sizeof(iucv_GeneralInterrupt));
  361. /* Initialize parameter pool */
  362. iucv_param_pool = kmalloc(sizeof(iucv_param) * PARAM_POOL_SIZE,
  363. GFP_KERNEL|GFP_DMA);
  364. if (!iucv_param_pool) {
  365. printk(KERN_WARNING "%s: Could not allocate param pool\n",
  366. __FUNCTION__);
  367. kfree(iucv_external_int_buffer);
  368. iucv_external_int_buffer = NULL;
  369. s390_root_dev_unregister(iucv_root);
  370. bus_unregister(&iucv_bus);
  371. return -ENOMEM;
  372. }
  373. memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE);
  374. /* Initialize irq queue */
  375. INIT_LIST_HEAD(&iucv_irq_queue);
  376. /* Initialize handler table */
  377. INIT_LIST_HEAD(&iucv_handler_table);
  378. iucv_banner();
  379. return 0;
  380. }
  381. /**
  382. * iucv_exit - De-Initialization
  383. *
  384. * Frees everything allocated from iucv_init.
  385. */
  386. static int iucv_retrieve_buffer (void);
  387. static void
  388. iucv_exit(void)
  389. {
  390. iucv_retrieve_buffer();
  391. if (iucv_external_int_buffer) {
  392. kfree(iucv_external_int_buffer);
  393. iucv_external_int_buffer = NULL;
  394. }
  395. if (iucv_param_pool) {
  396. kfree(iucv_param_pool);
  397. iucv_param_pool = NULL;
  398. }
  399. s390_root_dev_unregister(iucv_root);
  400. bus_unregister(&iucv_bus);
  401. printk(KERN_INFO "IUCV lowlevel driver unloaded\n");
  402. }
  403. /**
  404. * grab_param: - Get a parameter buffer from the pre-allocated pool.
  405. *
  406. * This function searches for an unused element in the pre-allocated pool
  407. * of parameter buffers. If one is found, it marks it "in use" and returns
  408. * a pointer to it. The calling function is responsible for releasing it
  409. * when it has finished its usage.
  410. *
  411. * Returns: A pointer to iucv_param.
  412. */
  413. static __inline__ iucv_param *
  414. grab_param(void)
  415. {
  416. iucv_param *ptr;
  417. static int hint = 0;
  418. ptr = iucv_param_pool + hint;
  419. do {
  420. ptr++;
  421. if (ptr >= iucv_param_pool + PARAM_POOL_SIZE)
  422. ptr = iucv_param_pool;
  423. } while (atomic_compare_and_swap(0, 1, &ptr->in_use));
  424. hint = ptr - iucv_param_pool;
  425. memset(&ptr->param, 0, sizeof(ptr->param));
  426. return ptr;
  427. }
  428. /**
  429. * release_param - Release a parameter buffer.
  430. * @p: A pointer to a struct iucv_param, previously obtained by calling
  431. * grab_param().
  432. *
  433. * This function marks the specified parameter buffer "unused".
  434. */
  435. static __inline__ void
  436. release_param(void *p)
  437. {
  438. atomic_set(&((iucv_param *)p)->in_use, 0);
  439. }
  440. /**
  441. * iucv_add_handler: - Add a new handler
  442. * @new_handler: handle that is being entered into chain.
  443. *
  444. * Places new handle on iucv_handler_table, if identical handler is not
  445. * found.
  446. *
  447. * Returns: 0 on success, !0 on failure (handler already in chain).
  448. */
  449. static int
  450. iucv_add_handler (handler *new)
  451. {
  452. ulong flags;
  453. iucv_debug(1, "entering");
  454. iucv_dumpit("handler:", new, sizeof(handler));
  455. spin_lock_irqsave (&iucv_lock, flags);
  456. if (!list_empty(&iucv_handler_table)) {
  457. struct list_head *lh;
  458. /**
  459. * Search list for handler with identical id. If one
  460. * is found, the new handler is _not_ added.
  461. */
  462. list_for_each(lh, &iucv_handler_table) {
  463. handler *h = list_entry(lh, handler, list);
  464. if (!memcmp(&new->id, &h->id, sizeof(h->id))) {
  465. iucv_debug(1, "ret 1");
  466. spin_unlock_irqrestore (&iucv_lock, flags);
  467. return 1;
  468. }
  469. }
  470. }
  471. /**
  472. * If we get here, no handler was found.
  473. */
  474. INIT_LIST_HEAD(&new->list);
  475. list_add(&new->list, &iucv_handler_table);
  476. spin_unlock_irqrestore (&iucv_lock, flags);
  477. iucv_debug(1, "exiting");
  478. return 0;
  479. }
  480. /**
  481. * b2f0:
  482. * @code: identifier of IUCV call to CP.
  483. * @parm: pointer to 40 byte iparml area passed to CP
  484. *
  485. * Calls CP to execute IUCV commands.
  486. *
  487. * Returns: return code from CP's IUCV call
  488. */
  489. static __inline__ ulong
  490. b2f0(__u32 code, void *parm)
  491. {
  492. iucv_dumpit("iparml before b2f0 call:", parm, sizeof(iucv_param));
  493. asm volatile (
  494. "LRA 1,0(%1)\n\t"
  495. "LR 0,%0\n\t"
  496. ".long 0xb2f01000"
  497. :
  498. : "d" (code), "a" (parm)
  499. : "0", "1"
  500. );
  501. iucv_dumpit("iparml after b2f0 call:", parm, sizeof(iucv_param));
  502. return (unsigned long)*((__u8 *)(parm + 3));
  503. }
  504. /*
  505. * Name: iucv_add_pathid
  506. * Purpose: Adds a path id to the system.
  507. * Input: pathid - pathid that is going to be entered into system
  508. * handle - address of handler that the pathid will be associated
  509. * with.
  510. * pgm_data - token passed in by application.
  511. * Output: 0: successful addition of pathid
  512. * - EINVAL - pathid entry is being used by another application
  513. * - ENOMEM - storage allocation for a new pathid table failed
  514. */
  515. static int
  516. __iucv_add_pathid(__u16 pathid, handler *handler)
  517. {
  518. iucv_debug(1, "entering");
  519. iucv_debug(1, "handler is pointing to %p", handler);
  520. if (pathid > (max_connections - 1))
  521. return -EINVAL;
  522. if (iucv_pathid_table[pathid]) {
  523. iucv_debug(1, "pathid entry is %p", iucv_pathid_table[pathid]);
  524. printk(KERN_WARNING
  525. "%s: Pathid being used, error.\n", __FUNCTION__);
  526. return -EINVAL;
  527. }
  528. iucv_pathid_table[pathid] = handler;
  529. iucv_debug(1, "exiting");
  530. return 0;
  531. } /* end of add_pathid function */
  532. static int
  533. iucv_add_pathid(__u16 pathid, handler *handler)
  534. {
  535. ulong flags;
  536. int rc;
  537. spin_lock_irqsave (&iucv_lock, flags);
  538. rc = __iucv_add_pathid(pathid, handler);
  539. spin_unlock_irqrestore (&iucv_lock, flags);
  540. return rc;
  541. }
  542. static void
  543. iucv_remove_pathid(__u16 pathid)
  544. {
  545. ulong flags;
  546. if (pathid > (max_connections - 1))
  547. return;
  548. spin_lock_irqsave (&iucv_lock, flags);
  549. iucv_pathid_table[pathid] = NULL;
  550. spin_unlock_irqrestore (&iucv_lock, flags);
  551. }
  552. /**
  553. * iucv_declare_buffer_cpuid
  554. * Register at VM for subsequent IUCV operations. This is executed
  555. * on the reserved CPU iucv_cpuid. Called from iucv_declare_buffer().
  556. */
  557. static void
  558. iucv_declare_buffer_cpuid (void *result)
  559. {
  560. iparml_db *parm;
  561. parm = (iparml_db *)grab_param();
  562. parm->ipbfadr1 = virt_to_phys(iucv_external_int_buffer);
  563. if ((*((ulong *)result) = b2f0(DECLARE_BUFFER, parm)) == 1)
  564. *((ulong *)result) = parm->iprcode;
  565. release_param(parm);
  566. }
  567. /**
  568. * iucv_retrieve_buffer_cpuid:
  569. * Unregister IUCV usage at VM. This is always executed on the same
  570. * cpu that registered the buffer to VM.
  571. * Called from iucv_retrieve_buffer().
  572. */
  573. static void
  574. iucv_retrieve_buffer_cpuid (void *cpu)
  575. {
  576. iparml_control *parm;
  577. parm = (iparml_control *)grab_param();
  578. b2f0(RETRIEVE_BUFFER, parm);
  579. release_param(parm);
  580. }
  581. /**
  582. * Name: iucv_declare_buffer
  583. * Purpose: Specifies the guests real address of an external
  584. * interrupt.
  585. * Input: void
  586. * Output: iprcode - return code from b2f0 call
  587. */
  588. static int
  589. iucv_declare_buffer (void)
  590. {
  591. unsigned long flags;
  592. ulong b2f0_result;
  593. iucv_debug(1, "entering");
  594. b2f0_result = -ENODEV;
  595. spin_lock_irqsave (&iucv_lock, flags);
  596. if (iucv_cpuid == -1) {
  597. /* Reserve any cpu for use by iucv. */
  598. iucv_cpuid = smp_get_cpu(CPU_MASK_ALL);
  599. spin_unlock_irqrestore (&iucv_lock, flags);
  600. smp_call_function_on(iucv_declare_buffer_cpuid,
  601. &b2f0_result, 0, 1, iucv_cpuid);
  602. if (b2f0_result) {
  603. smp_put_cpu(iucv_cpuid);
  604. iucv_cpuid = -1;
  605. }
  606. iucv_debug(1, "Address of EIB = %p", iucv_external_int_buffer);
  607. } else {
  608. spin_unlock_irqrestore (&iucv_lock, flags);
  609. b2f0_result = 0;
  610. }
  611. iucv_debug(1, "exiting");
  612. return b2f0_result;
  613. }
  614. /**
  615. * iucv_retrieve_buffer:
  616. *
  617. * Terminates all use of IUCV.
  618. * Returns: return code from CP
  619. */
  620. static int
  621. iucv_retrieve_buffer (void)
  622. {
  623. iucv_debug(1, "entering");
  624. if (iucv_cpuid != -1) {
  625. smp_call_function_on(iucv_retrieve_buffer_cpuid,
  626. 0, 0, 1, iucv_cpuid);
  627. /* Release the cpu reserved by iucv_declare_buffer. */
  628. smp_put_cpu(iucv_cpuid);
  629. iucv_cpuid = -1;
  630. }
  631. iucv_debug(1, "exiting");
  632. return 0;
  633. }
  634. /**
  635. * iucv_remove_handler:
  636. * @users_handler: handler to be removed
  637. *
  638. * Remove handler when application unregisters.
  639. */
  640. static void
  641. iucv_remove_handler(handler *handler)
  642. {
  643. unsigned long flags;
  644. if ((!iucv_pathid_table) || (!handler))
  645. return;
  646. iucv_debug(1, "entering");
  647. spin_lock_irqsave (&iucv_lock, flags);
  648. list_del(&handler->list);
  649. if (list_empty(&iucv_handler_table)) {
  650. if (register_flag) {
  651. unregister_external_interrupt(0x4000, iucv_irq_handler);
  652. register_flag = 0;
  653. }
  654. }
  655. spin_unlock_irqrestore (&iucv_lock, flags);
  656. iucv_debug(1, "exiting");
  657. return;
  658. }
  659. /**
  660. * iucv_register_program:
  661. * @pgmname: user identification
  662. * @userid: machine identification
  663. * @pgmmask: Indicates which bits in the pgmname and userid combined will be
  664. * used to determine who is given control.
  665. * @ops: Address of interrupt handler table.
  666. * @pgm_data: Application data to be passed to interrupt handlers.
  667. *
  668. * Registers an application with IUCV.
  669. * Returns:
  670. * The address of handler, or NULL on failure.
  671. * NOTE on pgmmask:
  672. * If pgmname, userid and pgmmask are provided, pgmmask is entered into the
  673. * handler as is.
  674. * If pgmmask is NULL, the internal mask is set to all 0xff's
  675. * When userid is NULL, the first 8 bytes of the internal mask are forced
  676. * to 0x00.
  677. * If pgmmask and userid are NULL, the first 8 bytes of the internal mask
  678. * are forced to 0x00 and the last 16 bytes to 0xff.
  679. */
  680. iucv_handle_t
  681. iucv_register_program (__u8 pgmname[16],
  682. __u8 userid[8],
  683. __u8 pgmmask[24],
  684. iucv_interrupt_ops_t * ops, void *pgm_data)
  685. {
  686. ulong rc = 0; /* return code from function calls */
  687. handler *new_handler;
  688. iucv_debug(1, "entering");
  689. if (ops == NULL) {
  690. /* interrupt table is not defined */
  691. printk(KERN_WARNING "%s: Interrupt table is not defined, "
  692. "exiting\n", __FUNCTION__);
  693. return NULL;
  694. }
  695. if (!pgmname) {
  696. printk(KERN_WARNING "%s: pgmname not provided\n", __FUNCTION__);
  697. return NULL;
  698. }
  699. /* Allocate handler entry */
  700. new_handler = (handler *)kmalloc(sizeof(handler), GFP_ATOMIC);
  701. if (new_handler == NULL) {
  702. printk(KERN_WARNING "%s: storage allocation for new handler "
  703. "failed.\n", __FUNCTION__);
  704. return NULL;
  705. }
  706. if (!iucv_pathid_table) {
  707. if (iucv_init()) {
  708. kfree(new_handler);
  709. return NULL;
  710. }
  711. max_connections = iucv_query_maxconn();
  712. iucv_pathid_table = kmalloc(max_connections * sizeof(handler *),
  713. GFP_ATOMIC);
  714. if (iucv_pathid_table == NULL) {
  715. printk(KERN_WARNING "%s: iucv_pathid_table storage "
  716. "allocation failed\n", __FUNCTION__);
  717. kfree(new_handler);
  718. return NULL;
  719. }
  720. memset (iucv_pathid_table, 0, max_connections * sizeof(handler *));
  721. }
  722. memset(new_handler, 0, sizeof (handler));
  723. memcpy(new_handler->id.user_data, pgmname,
  724. sizeof (new_handler->id.user_data));
  725. if (userid) {
  726. memcpy (new_handler->id.userid, userid,
  727. sizeof (new_handler->id.userid));
  728. ASCEBC (new_handler->id.userid,
  729. sizeof (new_handler->id.userid));
  730. EBC_TOUPPER (new_handler->id.userid,
  731. sizeof (new_handler->id.userid));
  732. if (pgmmask) {
  733. memcpy (new_handler->id.mask, pgmmask,
  734. sizeof (new_handler->id.mask));
  735. } else {
  736. memset (new_handler->id.mask, 0xFF,
  737. sizeof (new_handler->id.mask));
  738. }
  739. } else {
  740. if (pgmmask) {
  741. memcpy (new_handler->id.mask, pgmmask,
  742. sizeof (new_handler->id.mask));
  743. } else {
  744. memset (new_handler->id.mask, 0xFF,
  745. sizeof (new_handler->id.mask));
  746. }
  747. memset (new_handler->id.userid, 0x00,
  748. sizeof (new_handler->id.userid));
  749. }
  750. /* fill in the rest of handler */
  751. new_handler->pgm_data = pgm_data;
  752. new_handler->interrupt_table = ops;
  753. /*
  754. * Check if someone else is registered with same pgmname, userid
  755. * and mask. If someone is already registered with same pgmname,
  756. * userid and mask, registration will fail and NULL will be returned
  757. * to the application.
  758. * If identical handler not found, then handler is added to list.
  759. */
  760. rc = iucv_add_handler(new_handler);
  761. if (rc) {
  762. printk(KERN_WARNING "%s: Someone already registered with same "
  763. "pgmname, userid, pgmmask\n", __FUNCTION__);
  764. kfree (new_handler);
  765. return NULL;
  766. }
  767. rc = iucv_declare_buffer();
  768. if (rc) {
  769. char *err = "Unknown";
  770. iucv_remove_handler(new_handler);
  771. kfree(new_handler);
  772. switch(rc) {
  773. case 0x03:
  774. err = "Directory error";
  775. break;
  776. case 0x0a:
  777. err = "Invalid length";
  778. break;
  779. case 0x13:
  780. err = "Buffer already exists";
  781. break;
  782. case 0x3e:
  783. err = "Buffer overlap";
  784. break;
  785. case 0x5c:
  786. err = "Paging or storage error";
  787. break;
  788. }
  789. printk(KERN_WARNING "%s: iucv_declare_buffer "
  790. "returned error 0x%02lx (%s)\n", __FUNCTION__, rc, err);
  791. return NULL;
  792. }
  793. if (!register_flag) {
  794. /* request the 0x4000 external interrupt */
  795. rc = register_external_interrupt (0x4000, iucv_irq_handler);
  796. if (rc) {
  797. iucv_remove_handler(new_handler);
  798. kfree (new_handler);
  799. printk(KERN_WARNING "%s: "
  800. "register_external_interrupt returned %ld\n",
  801. __FUNCTION__, rc);
  802. return NULL;
  803. }
  804. register_flag = 1;
  805. }
  806. iucv_debug(1, "exiting");
  807. return new_handler;
  808. } /* end of register function */
  809. /**
  810. * iucv_unregister_program:
  811. * @handle: address of handler
  812. *
  813. * Unregister application with IUCV.
  814. * Returns:
  815. * 0 on success, -EINVAL, if specified handle is invalid.
  816. */
  817. int
  818. iucv_unregister_program (iucv_handle_t handle)
  819. {
  820. handler *h = NULL;
  821. struct list_head *lh;
  822. int i;
  823. ulong flags;
  824. iucv_debug(1, "entering");
  825. iucv_debug(1, "address of handler is %p", h);
  826. /* Checking if handle is valid */
  827. spin_lock_irqsave (&iucv_lock, flags);
  828. list_for_each(lh, &iucv_handler_table) {
  829. if ((handler *)handle == list_entry(lh, handler, list)) {
  830. h = (handler *)handle;
  831. break;
  832. }
  833. }
  834. if (!h) {
  835. spin_unlock_irqrestore (&iucv_lock, flags);
  836. if (handle)
  837. printk(KERN_WARNING
  838. "%s: Handler not found in iucv_handler_table.\n",
  839. __FUNCTION__);
  840. else
  841. printk(KERN_WARNING
  842. "%s: NULL handle passed by application.\n",
  843. __FUNCTION__);
  844. return -EINVAL;
  845. }
  846. /**
  847. * First, walk thru iucv_pathid_table and sever any pathid which is
  848. * still pointing to the handler to be removed.
  849. */
  850. for (i = 0; i < max_connections; i++)
  851. if (iucv_pathid_table[i] == h) {
  852. spin_unlock_irqrestore (&iucv_lock, flags);
  853. iucv_sever(i, h->id.user_data);
  854. spin_lock_irqsave(&iucv_lock, flags);
  855. }
  856. spin_unlock_irqrestore (&iucv_lock, flags);
  857. iucv_remove_handler(h);
  858. kfree(h);
  859. iucv_debug(1, "exiting");
  860. return 0;
  861. }
  862. /**
  863. * iucv_accept:
  864. * @pathid: Path identification number
  865. * @msglim_reqstd: The number of outstanding messages requested.
  866. * @user_data: Data specified by the iucv_connect function.
  867. * @flags1: Contains options for this path.
  868. * - IPPRTY (0x20) Specifies if you want to send priority message.
  869. * - IPRMDATA (0x80) Specifies whether your program can handle a message
  870. * in the parameter list.
  871. * - IPQUSCE (0x40) Specifies whether you want to quiesce the path being
  872. * established.
  873. * @handle: Address of handler.
  874. * @pgm_data: Application data passed to interrupt handlers.
  875. * @flags1_out: Pointer to an int. If not NULL, on return the options for
  876. * the path are stored at the given location:
  877. * - IPPRTY (0x20) Indicates you may send a priority message.
  878. * @msglim: Pointer to an __u16. If not NULL, on return the maximum
  879. * number of outstanding messages is stored at the given
  880. * location.
  881. *
  882. * This function is issued after the user receives a Connection Pending external
  883. * interrupt and now wishes to complete the IUCV communication path.
  884. * Returns:
  885. * return code from CP
  886. */
  887. int
  888. iucv_accept(__u16 pathid, __u16 msglim_reqstd,
  889. __u8 user_data[16], int flags1,
  890. iucv_handle_t handle, void *pgm_data,
  891. int *flags1_out, __u16 * msglim)
  892. {
  893. ulong b2f0_result = 0;
  894. ulong flags;
  895. struct list_head *lh;
  896. handler *h = NULL;
  897. iparml_control *parm;
  898. iucv_debug(1, "entering");
  899. iucv_debug(1, "pathid = %d", pathid);
  900. /* Checking if handle is valid */
  901. spin_lock_irqsave (&iucv_lock, flags);
  902. list_for_each(lh, &iucv_handler_table) {
  903. if ((handler *)handle == list_entry(lh, handler, list)) {
  904. h = (handler *)handle;
  905. break;
  906. }
  907. }
  908. spin_unlock_irqrestore (&iucv_lock, flags);
  909. if (!h) {
  910. if (handle)
  911. printk(KERN_WARNING
  912. "%s: Handler not found in iucv_handler_table.\n",
  913. __FUNCTION__);
  914. else
  915. printk(KERN_WARNING
  916. "%s: NULL handle passed by application.\n",
  917. __FUNCTION__);
  918. return -EINVAL;
  919. }
  920. parm = (iparml_control *)grab_param();
  921. parm->ippathid = pathid;
  922. parm->ipmsglim = msglim_reqstd;
  923. if (user_data)
  924. memcpy(parm->ipuser, user_data, sizeof(parm->ipuser));
  925. parm->ipflags1 = (__u8)flags1;
  926. b2f0_result = b2f0(ACCEPT, parm);
  927. if (!b2f0_result) {
  928. if (msglim)
  929. *msglim = parm->ipmsglim;
  930. if (pgm_data)
  931. h->pgm_data = pgm_data;
  932. if (flags1_out)
  933. *flags1_out = (parm->ipflags1 & IPPRTY) ? IPPRTY : 0;
  934. }
  935. release_param(parm);
  936. iucv_debug(1, "exiting");
  937. return b2f0_result;
  938. }
  939. /**
  940. * iucv_connect:
  941. * @pathid: Path identification number
  942. * @msglim_reqstd: Number of outstanding messages requested
  943. * @user_data: 16-byte user data
  944. * @userid: 8-byte of user identification
  945. * @system_name: 8-byte identifying the system name
  946. * @flags1: Specifies options for this path:
  947. * - IPPRTY (0x20) Specifies if you want to send priority message.
  948. * - IPRMDATA (0x80) Specifies whether your program can handle a message
  949. * in the parameter list.
  950. * - IPQUSCE (0x40) Specifies whether you want to quiesce the path being
  951. * established.
  952. * - IPLOCAL (0x01) Allows an application to force the partner to be on the
  953. * local system. If local is specified then target class
  954. * cannot be specified.
  955. * @flags1_out: Pointer to an int. If not NULL, on return the options for
  956. * the path are stored at the given location:
  957. * - IPPRTY (0x20) Indicates you may send a priority message.
  958. * @msglim: Pointer to an __u16. If not NULL, on return the maximum
  959. * number of outstanding messages is stored at the given
  960. * location.
  961. * @handle: Address of handler.
  962. * @pgm_data: Application data to be passed to interrupt handlers.
  963. *
  964. * This function establishes an IUCV path. Although the connect may complete
  965. * successfully, you are not able to use the path until you receive an IUCV
  966. * Connection Complete external interrupt.
  967. * Returns: return code from CP, or one of the following
  968. * - ENOMEM
  969. * - return code from iucv_declare_buffer
  970. * - EINVAL - invalid handle passed by application
  971. * - EINVAL - pathid address is NULL
  972. * - ENOMEM - pathid table storage allocation failed
  973. * - return code from internal function add_pathid
  974. */
  975. int
  976. iucv_connect (__u16 *pathid, __u16 msglim_reqstd,
  977. __u8 user_data[16], __u8 userid[8],
  978. __u8 system_name[8], int flags1,
  979. int *flags1_out, __u16 * msglim,
  980. iucv_handle_t handle, void *pgm_data)
  981. {
  982. iparml_control *parm;
  983. iparml_control local_parm;
  984. struct list_head *lh;
  985. ulong b2f0_result = 0;
  986. ulong flags;
  987. int add_pathid_result = 0;
  988. handler *h = NULL;
  989. __u8 no_memory[16] = "NO MEMORY";
  990. iucv_debug(1, "entering");
  991. /* Checking if handle is valid */
  992. spin_lock_irqsave (&iucv_lock, flags);
  993. list_for_each(lh, &iucv_handler_table) {
  994. if ((handler *)handle == list_entry(lh, handler, list)) {
  995. h = (handler *)handle;
  996. break;
  997. }
  998. }
  999. spin_unlock_irqrestore (&iucv_lock, flags);
  1000. if (!h) {
  1001. if (handle)
  1002. printk(KERN_WARNING
  1003. "%s: Handler not found in iucv_handler_table.\n",
  1004. __FUNCTION__);
  1005. else
  1006. printk(KERN_WARNING
  1007. "%s: NULL handle passed by application.\n",
  1008. __FUNCTION__);
  1009. return -EINVAL;
  1010. }
  1011. if (pathid == NULL) {
  1012. printk(KERN_WARNING "%s: NULL pathid pointer\n",
  1013. __FUNCTION__);
  1014. return -EINVAL;
  1015. }
  1016. parm = (iparml_control *)grab_param();
  1017. parm->ipmsglim = msglim_reqstd;
  1018. if (user_data)
  1019. memcpy(parm->ipuser, user_data, sizeof(parm->ipuser));
  1020. if (userid) {
  1021. memcpy(parm->ipvmid, userid, sizeof(parm->ipvmid));
  1022. ASCEBC(parm->ipvmid, sizeof(parm->ipvmid));
  1023. EBC_TOUPPER(parm->ipvmid, sizeof(parm->ipvmid));
  1024. }
  1025. if (system_name) {
  1026. memcpy(parm->iptarget, system_name, sizeof(parm->iptarget));
  1027. ASCEBC(parm->iptarget, sizeof(parm->iptarget));
  1028. EBC_TOUPPER(parm->iptarget, sizeof(parm->iptarget));
  1029. }
  1030. /* In order to establish an IUCV connection, the procedure is:
  1031. *
  1032. * b2f0(CONNECT)
  1033. * take the ippathid from the b2f0 call
  1034. * register the handler to the ippathid
  1035. *
  1036. * Unfortunately, the ConnectionEstablished message gets sent after the
  1037. * b2f0(CONNECT) call but before the register is handled.
  1038. *
  1039. * In order for this race condition to be eliminated, the IUCV Control
  1040. * Interrupts must be disabled for the above procedure.
  1041. *
  1042. * David Kennedy <dkennedy@linuxcare.com>
  1043. */
  1044. /* Enable everything but IUCV Control messages */
  1045. iucv_setmask(~(AllInterrupts));
  1046. messagesDisabled = 1;
  1047. spin_lock_irqsave (&iucv_lock, flags);
  1048. parm->ipflags1 = (__u8)flags1;
  1049. b2f0_result = b2f0(CONNECT, parm);
  1050. memcpy(&local_parm, parm, sizeof(local_parm));
  1051. release_param(parm);
  1052. parm = &local_parm;
  1053. if (!b2f0_result)
  1054. add_pathid_result = __iucv_add_pathid(parm->ippathid, h);
  1055. spin_unlock_irqrestore (&iucv_lock, flags);
  1056. if (b2f0_result) {
  1057. iucv_setmask(~0);
  1058. messagesDisabled = 0;
  1059. return b2f0_result;
  1060. }
  1061. *pathid = parm->ippathid;
  1062. /* Enable everything again */
  1063. iucv_setmask(IUCVControlInterruptsFlag);
  1064. if (msglim)
  1065. *msglim = parm->ipmsglim;
  1066. if (flags1_out)
  1067. *flags1_out = (parm->ipflags1 & IPPRTY) ? IPPRTY : 0;
  1068. if (add_pathid_result) {
  1069. iucv_sever(*pathid, no_memory);
  1070. printk(KERN_WARNING "%s: add_pathid failed with rc ="
  1071. " %d\n", __FUNCTION__, add_pathid_result);
  1072. return(add_pathid_result);
  1073. }
  1074. iucv_debug(1, "exiting");
  1075. return b2f0_result;
  1076. }
  1077. /**
  1078. * iucv_purge:
  1079. * @pathid: Path identification number
  1080. * @msgid: Message ID of message to purge.
  1081. * @srccls: Message class of the message to purge.
  1082. * @audit: Pointer to an __u32. If not NULL, on return, information about
  1083. * asynchronous errors that may have affected the normal completion
  1084. * of this message ist stored at the given location.
  1085. *
  1086. * Cancels a message you have sent.
  1087. * Returns: return code from CP
  1088. */
  1089. int
  1090. iucv_purge (__u16 pathid, __u32 msgid, __u32 srccls, __u32 *audit)
  1091. {
  1092. iparml_purge *parm;
  1093. ulong b2f0_result = 0;
  1094. iucv_debug(1, "entering");
  1095. iucv_debug(1, "pathid = %d", pathid);
  1096. parm = (iparml_purge *)grab_param();
  1097. parm->ipmsgid = msgid;
  1098. parm->ippathid = pathid;
  1099. parm->ipsrccls = srccls;
  1100. parm->ipflags1 |= (IPSRCCLS | IPFGMID | IPFGPID);
  1101. b2f0_result = b2f0(PURGE, parm);
  1102. if (!b2f0_result && audit) {
  1103. memcpy(audit, parm->ipaudit, sizeof(parm->ipaudit));
  1104. /* parm->ipaudit has only 3 bytes */
  1105. *audit >>= 8;
  1106. }
  1107. release_param(parm);
  1108. iucv_debug(1, "b2f0_result = %ld", b2f0_result);
  1109. iucv_debug(1, "exiting");
  1110. return b2f0_result;
  1111. }
  1112. /**
  1113. * iucv_query_generic:
  1114. * @want_maxconn: Flag, describing which value is to be returned.
  1115. *
  1116. * Helper function for iucv_query_maxconn() and iucv_query_bufsize().
  1117. *
  1118. * Returns: The buffersize, if want_maxconn is 0; the maximum number of
  1119. * connections, if want_maxconn is 1 or an error-code < 0 on failure.
  1120. */
  1121. static int
  1122. iucv_query_generic(int want_maxconn)
  1123. {
  1124. iparml_purge *parm = (iparml_purge *)grab_param();
  1125. int bufsize, maxconn;
  1126. int ccode;
  1127. /**
  1128. * Call b2f0 and store R0 (max buffer size),
  1129. * R1 (max connections) and CC.
  1130. */
  1131. asm volatile (
  1132. "LRA 1,0(%4)\n\t"
  1133. "LR 0,%3\n\t"
  1134. ".long 0xb2f01000\n\t"
  1135. "IPM %0\n\t"
  1136. "SRL %0,28\n\t"
  1137. "ST 0,%1\n\t"
  1138. "ST 1,%2\n\t"
  1139. : "=d" (ccode), "=m" (bufsize), "=m" (maxconn)
  1140. : "d" (QUERY), "a" (parm)
  1141. : "0", "1", "cc"
  1142. );
  1143. release_param(parm);
  1144. if (ccode)
  1145. return -EPERM;
  1146. if (want_maxconn)
  1147. return maxconn;
  1148. return bufsize;
  1149. }
  1150. /**
  1151. * iucv_query_maxconn:
  1152. *
  1153. * Determines the maximum number of connections thay may be established.
  1154. *
  1155. * Returns: Maximum number of connections that can be.
  1156. */
  1157. ulong
  1158. iucv_query_maxconn(void)
  1159. {
  1160. return iucv_query_generic(1);
  1161. }
  1162. /**
  1163. * iucv_query_bufsize:
  1164. *
  1165. * Determines the size of the external interrupt buffer.
  1166. *
  1167. * Returns: Size of external interrupt buffer.
  1168. */
  1169. ulong
  1170. iucv_query_bufsize (void)
  1171. {
  1172. return iucv_query_generic(0);
  1173. }
  1174. /**
  1175. * iucv_quiesce:
  1176. * @pathid: Path identification number
  1177. * @user_data: 16-byte user data
  1178. *
  1179. * Temporarily suspends incoming messages on an IUCV path.
  1180. * You can later reactivate the path by invoking the iucv_resume function.
  1181. * Returns: return code from CP
  1182. */
  1183. int
  1184. iucv_quiesce (__u16 pathid, __u8 user_data[16])
  1185. {
  1186. iparml_control *parm;
  1187. ulong b2f0_result = 0;
  1188. iucv_debug(1, "entering");
  1189. iucv_debug(1, "pathid = %d", pathid);
  1190. parm = (iparml_control *)grab_param();
  1191. memcpy(parm->ipuser, user_data, sizeof(parm->ipuser));
  1192. parm->ippathid = pathid;
  1193. b2f0_result = b2f0(QUIESCE, parm);
  1194. release_param(parm);
  1195. iucv_debug(1, "b2f0_result = %ld", b2f0_result);
  1196. iucv_debug(1, "exiting");
  1197. return b2f0_result;
  1198. }
  1199. /**
  1200. * iucv_receive:
  1201. * @pathid: Path identification number.
  1202. * @buffer: Address of buffer to receive. Must be below 2G.
  1203. * @buflen: Length of buffer to receive.
  1204. * @msgid: Specifies the message ID.
  1205. * @trgcls: Specifies target class.
  1206. * @flags1_out: Receives options for path on return.
  1207. * - IPNORPY (0x10) Specifies whether a reply is required
  1208. * - IPPRTY (0x20) Specifies if you want to send priority message
  1209. * - IPRMDATA (0x80) Specifies the data is contained in the parameter list
  1210. * @residual_buffer: Receives the address of buffer updated by the number
  1211. * of bytes you have received on return.
  1212. * @residual_length: On return, receives one of the following values:
  1213. * - 0 If the receive buffer is the same length as
  1214. * the message.
  1215. * - Remaining bytes in buffer If the receive buffer is longer than the
  1216. * message.
  1217. * - Remaining bytes in message If the receive buffer is shorter than the
  1218. * message.
  1219. *
  1220. * This function receives messages that are being sent to you over established
  1221. * paths.
  1222. * Returns: return code from CP IUCV call; If the receive buffer is shorter
  1223. * than the message, always 5
  1224. * -EINVAL - buffer address is pointing to NULL
  1225. */
  1226. int
  1227. iucv_receive (__u16 pathid, __u32 msgid, __u32 trgcls,
  1228. void *buffer, ulong buflen,
  1229. int *flags1_out, ulong * residual_buffer, ulong * residual_length)
  1230. {
  1231. iparml_db *parm;
  1232. ulong b2f0_result;
  1233. int moved = 0; /* number of bytes moved from parmlist to buffer */
  1234. iucv_debug(2, "entering");
  1235. if (!buffer)
  1236. return -EINVAL;
  1237. parm = (iparml_db *)grab_param();
  1238. parm->ipbfadr1 = (__u32) (addr_t) buffer;
  1239. parm->ipbfln1f = (__u32) ((ulong) buflen);
  1240. parm->ipmsgid = msgid;
  1241. parm->ippathid = pathid;
  1242. parm->iptrgcls = trgcls;
  1243. parm->ipflags1 = (IPFGPID | IPFGMID | IPFGMCL);
  1244. b2f0_result = b2f0(RECEIVE, parm);
  1245. if (!b2f0_result || b2f0_result == 5) {
  1246. if (flags1_out) {
  1247. iucv_debug(2, "*flags1_out = %d", *flags1_out);
  1248. *flags1_out = (parm->ipflags1 & (~0x07));
  1249. iucv_debug(2, "*flags1_out = %d", *flags1_out);
  1250. }
  1251. if (!(parm->ipflags1 & IPRMDATA)) { /*msg not in parmlist */
  1252. if (residual_length)
  1253. *residual_length = parm->ipbfln1f;
  1254. if (residual_buffer)
  1255. *residual_buffer = parm->ipbfadr1;
  1256. } else {
  1257. moved = min_t (unsigned long, buflen, 8);
  1258. memcpy ((char *) buffer,
  1259. (char *) &parm->ipbfadr1, moved);
  1260. if (buflen < 8)
  1261. b2f0_result = 5;
  1262. if (residual_length)
  1263. *residual_length = abs (buflen - 8);
  1264. if (residual_buffer)
  1265. *residual_buffer = (ulong) (buffer + moved);
  1266. }
  1267. }
  1268. release_param(parm);
  1269. iucv_debug(2, "exiting");
  1270. return b2f0_result;
  1271. }
  1272. /*
  1273. * Name: iucv_receive_array
  1274. * Purpose: This function receives messages that are being sent to you
  1275. * over established paths.
  1276. * Input: pathid - path identification number
  1277. * buffer - address of array of buffers
  1278. * buflen - total length of buffers
  1279. * msgid - specifies the message ID.
  1280. * trgcls - specifies target class
  1281. * Output:
  1282. * flags1_out: Options for path.
  1283. * IPNORPY - 0x10 specifies whether a reply is required
  1284. * IPPRTY - 0x20 specifies if you want to send priority message
  1285. * IPRMDATA - 0x80 specifies the data is contained in the parameter list
  1286. * residual_buffer - address points to the current list entry IUCV
  1287. * is working on.
  1288. * residual_length -
  1289. * Contains one of the following values, if the receive buffer is:
  1290. * The same length as the message, this field is zero.
  1291. * Longer than the message, this field contains the number of
  1292. * bytes remaining in the buffer.
  1293. * Shorter than the message, this field contains the residual
  1294. * count (that is, the number of bytes remaining in the
  1295. * message that does not fit into the buffer. In this case
  1296. * b2f0_result = 5.
  1297. * Return: b2f0_result - return code from CP
  1298. * (-EINVAL) - buffer address is NULL
  1299. */
  1300. int
  1301. iucv_receive_array (__u16 pathid,
  1302. __u32 msgid, __u32 trgcls,
  1303. iucv_array_t * buffer, ulong buflen,
  1304. int *flags1_out,
  1305. ulong * residual_buffer, ulong * residual_length)
  1306. {
  1307. iparml_db *parm;
  1308. ulong b2f0_result;
  1309. int i = 0, moved = 0, need_to_move = 8, dyn_len;
  1310. iucv_debug(2, "entering");
  1311. if (!buffer)
  1312. return -EINVAL;
  1313. parm = (iparml_db *)grab_param();
  1314. parm->ipbfadr1 = (__u32) ((ulong) buffer);
  1315. parm->ipbfln1f = (__u32) buflen;
  1316. parm->ipmsgid = msgid;
  1317. parm->ippathid = pathid;
  1318. parm->iptrgcls = trgcls;
  1319. parm->ipflags1 = (IPBUFLST | IPFGPID | IPFGMID | IPFGMCL);
  1320. b2f0_result = b2f0(RECEIVE, parm);
  1321. if (!b2f0_result || b2f0_result == 5) {
  1322. if (flags1_out) {
  1323. iucv_debug(2, "*flags1_out = %d", *flags1_out);
  1324. *flags1_out = (parm->ipflags1 & (~0x07));
  1325. iucv_debug(2, "*flags1_out = %d", *flags1_out);
  1326. }
  1327. if (!(parm->ipflags1 & IPRMDATA)) { /*msg not in parmlist */
  1328. if (residual_length)
  1329. *residual_length = parm->ipbfln1f;
  1330. if (residual_buffer)
  1331. *residual_buffer = parm->ipbfadr1;
  1332. } else {
  1333. /* copy msg from parmlist to users array. */
  1334. while ((moved < 8) && (moved < buflen)) {
  1335. dyn_len =
  1336. min_t (unsigned int,
  1337. (buffer + i)->length, need_to_move);
  1338. memcpy ((char *)((ulong)((buffer + i)->address)),
  1339. ((char *) &parm->ipbfadr1) + moved,
  1340. dyn_len);
  1341. moved += dyn_len;
  1342. need_to_move -= dyn_len;
  1343. (buffer + i)->address =
  1344. (__u32)
  1345. ((ulong)(__u8 *) ((ulong)(buffer + i)->address)
  1346. + dyn_len);
  1347. (buffer + i)->length -= dyn_len;
  1348. i++;
  1349. }
  1350. if (need_to_move) /* buflen < 8 bytes */
  1351. b2f0_result = 5;
  1352. if (residual_length)
  1353. *residual_length = abs (buflen - 8);
  1354. if (residual_buffer) {
  1355. if (!moved)
  1356. *residual_buffer = (ulong) buffer;
  1357. else
  1358. *residual_buffer =
  1359. (ulong) (buffer + (i - 1));
  1360. }
  1361. }
  1362. }
  1363. release_param(parm);
  1364. iucv_debug(2, "exiting");
  1365. return b2f0_result;
  1366. }
  1367. /**
  1368. * iucv_reject:
  1369. * @pathid: Path identification number.
  1370. * @msgid: Message ID of the message to reject.
  1371. * @trgcls: Target class of the message to reject.
  1372. * Returns: return code from CP
  1373. *
  1374. * Refuses a specified message. Between the time you are notified of a
  1375. * message and the time that you complete the message, the message may
  1376. * be rejected.
  1377. */
  1378. int
  1379. iucv_reject (__u16 pathid, __u32 msgid, __u32 trgcls)
  1380. {
  1381. iparml_db *parm;
  1382. ulong b2f0_result = 0;
  1383. iucv_debug(1, "entering");
  1384. iucv_debug(1, "pathid = %d", pathid);
  1385. parm = (iparml_db *)grab_param();
  1386. parm->ippathid = pathid;
  1387. parm->ipmsgid = msgid;
  1388. parm->iptrgcls = trgcls;
  1389. parm->ipflags1 = (IPFGMCL | IPFGMID | IPFGPID);
  1390. b2f0_result = b2f0(REJECT, parm);
  1391. release_param(parm);
  1392. iucv_debug(1, "b2f0_result = %ld", b2f0_result);
  1393. iucv_debug(1, "exiting");
  1394. return b2f0_result;
  1395. }
  1396. /*
  1397. * Name: iucv_reply
  1398. * Purpose: This function responds to the two-way messages that you
  1399. * receive. You must identify completely the message to
  1400. * which you wish to reply. ie, pathid, msgid, and trgcls.
  1401. * Input: pathid - path identification number
  1402. * msgid - specifies the message ID.
  1403. * trgcls - specifies target class
  1404. * flags1 - option for path
  1405. * IPPRTY- 0x20 - specifies if you want to send priority message
  1406. * buffer - address of reply buffer
  1407. * buflen - length of reply buffer
  1408. * Output: ipbfadr2 - Address of buffer updated by the number
  1409. * of bytes you have moved.
  1410. * ipbfln2f - Contains one of the following values:
  1411. * If the answer buffer is the same length as the reply, this field
  1412. * contains zero.
  1413. * If the answer buffer is longer than the reply, this field contains
  1414. * the number of bytes remaining in the buffer.
  1415. * If the answer buffer is shorter than the reply, this field contains
  1416. * a residual count (that is, the number of bytes remianing in the
  1417. * reply that does not fit into the buffer. In this
  1418. * case b2f0_result = 5.
  1419. * Return: b2f0_result - return code from CP
  1420. * (-EINVAL) - buffer address is NULL
  1421. */
  1422. int
  1423. iucv_reply (__u16 pathid,
  1424. __u32 msgid, __u32 trgcls,
  1425. int flags1,
  1426. void *buffer, ulong buflen, ulong * ipbfadr2, ulong * ipbfln2f)
  1427. {
  1428. iparml_db *parm;
  1429. ulong b2f0_result;
  1430. iucv_debug(2, "entering");
  1431. if (!buffer)
  1432. return -EINVAL;
  1433. parm = (iparml_db *)grab_param();
  1434. parm->ipbfadr2 = (__u32) ((ulong) buffer);
  1435. parm->ipbfln2f = (__u32) buflen; /* length of message */
  1436. parm->ippathid = pathid;
  1437. parm->ipmsgid = msgid;
  1438. parm->iptrgcls = trgcls;
  1439. parm->ipflags1 = (__u8) flags1; /* priority message */
  1440. b2f0_result = b2f0(REPLY, parm);
  1441. if ((!b2f0_result) || (b2f0_result == 5)) {
  1442. if (ipbfadr2)
  1443. *ipbfadr2 = parm->ipbfadr2;
  1444. if (ipbfln2f)
  1445. *ipbfln2f = parm->ipbfln2f;
  1446. }
  1447. release_param(parm);
  1448. iucv_debug(2, "exiting");
  1449. return b2f0_result;
  1450. }
  1451. /*
  1452. * Name: iucv_reply_array
  1453. * Purpose: This function responds to the two-way messages that you
  1454. * receive. You must identify completely the message to
  1455. * which you wish to reply. ie, pathid, msgid, and trgcls.
  1456. * The array identifies a list of addresses and lengths of
  1457. * discontiguous buffers that contains the reply data.
  1458. * Input: pathid - path identification number
  1459. * msgid - specifies the message ID.
  1460. * trgcls - specifies target class
  1461. * flags1 - option for path
  1462. * IPPRTY- specifies if you want to send priority message
  1463. * buffer - address of array of reply buffers
  1464. * buflen - total length of reply buffers
  1465. * Output: ipbfadr2 - Address of buffer which IUCV is currently working on.
  1466. * ipbfln2f - Contains one of the following values:
  1467. * If the answer buffer is the same length as the reply, this field
  1468. * contains zero.
  1469. * If the answer buffer is longer than the reply, this field contains
  1470. * the number of bytes remaining in the buffer.
  1471. * If the answer buffer is shorter than the reply, this field contains
  1472. * a residual count (that is, the number of bytes remianing in the
  1473. * reply that does not fit into the buffer. In this
  1474. * case b2f0_result = 5.
  1475. * Return: b2f0_result - return code from CP
  1476. * (-EINVAL) - buffer address is NULL
  1477. */
  1478. int
  1479. iucv_reply_array (__u16 pathid,
  1480. __u32 msgid, __u32 trgcls,
  1481. int flags1,
  1482. iucv_array_t * buffer,
  1483. ulong buflen, ulong * ipbfadr2, ulong * ipbfln2f)
  1484. {
  1485. iparml_db *parm;
  1486. ulong b2f0_result;
  1487. iucv_debug(2, "entering");
  1488. if (!buffer)
  1489. return -EINVAL;
  1490. parm = (iparml_db *)grab_param();
  1491. parm->ipbfadr2 = (__u32) ((ulong) buffer);
  1492. parm->ipbfln2f = buflen; /* length of message */
  1493. parm->ippathid = pathid;
  1494. parm->ipmsgid = msgid;
  1495. parm->iptrgcls = trgcls;
  1496. parm->ipflags1 = (IPANSLST | flags1);
  1497. b2f0_result = b2f0(REPLY, parm);
  1498. if ((!b2f0_result) || (b2f0_result == 5)) {
  1499. if (ipbfadr2)
  1500. *ipbfadr2 = parm->ipbfadr2;
  1501. if (ipbfln2f)
  1502. *ipbfln2f = parm->ipbfln2f;
  1503. }
  1504. release_param(parm);
  1505. iucv_debug(2, "exiting");
  1506. return b2f0_result;
  1507. }
  1508. /*
  1509. * Name: iucv_reply_prmmsg
  1510. * Purpose: This function responds to the two-way messages that you
  1511. * receive. You must identify completely the message to
  1512. * which you wish to reply. ie, pathid, msgid, and trgcls.
  1513. * Prmmsg signifies the data is moved into the
  1514. * parameter list.
  1515. * Input: pathid - path identification number
  1516. * msgid - specifies the message ID.
  1517. * trgcls - specifies target class
  1518. * flags1 - option for path
  1519. * IPPRTY- specifies if you want to send priority message
  1520. * prmmsg - 8-bytes of data to be placed into the parameter
  1521. * list.
  1522. * Output: NA
  1523. * Return: b2f0_result - return code from CP
  1524. */
  1525. int
  1526. iucv_reply_prmmsg (__u16 pathid,
  1527. __u32 msgid, __u32 trgcls, int flags1, __u8 prmmsg[8])
  1528. {
  1529. iparml_dpl *parm;
  1530. ulong b2f0_result;
  1531. iucv_debug(2, "entering");
  1532. parm = (iparml_dpl *)grab_param();
  1533. parm->ippathid = pathid;
  1534. parm->ipmsgid = msgid;
  1535. parm->iptrgcls = trgcls;
  1536. memcpy(parm->iprmmsg, prmmsg, sizeof (parm->iprmmsg));
  1537. parm->ipflags1 = (IPRMDATA | flags1);
  1538. b2f0_result = b2f0(REPLY, parm);
  1539. release_param(parm);
  1540. iucv_debug(2, "exiting");
  1541. return b2f0_result;
  1542. }
  1543. /**
  1544. * iucv_resume:
  1545. * @pathid: Path identification number
  1546. * @user_data: 16-byte of user data
  1547. *
  1548. * This function restores communication over a quiesced path.
  1549. * Returns: return code from CP
  1550. */
  1551. int
  1552. iucv_resume (__u16 pathid, __u8 user_data[16])
  1553. {
  1554. iparml_control *parm;
  1555. ulong b2f0_result = 0;
  1556. iucv_debug(1, "entering");
  1557. iucv_debug(1, "pathid = %d", pathid);
  1558. parm = (iparml_control *)grab_param();
  1559. memcpy (parm->ipuser, user_data, sizeof (*user_data));
  1560. parm->ippathid = pathid;
  1561. b2f0_result = b2f0(RESUME, parm);
  1562. release_param(parm);
  1563. iucv_debug(1, "exiting");
  1564. return b2f0_result;
  1565. }
  1566. /*
  1567. * Name: iucv_send
  1568. * Purpose: sends messages
  1569. * Input: pathid - ushort, pathid
  1570. * msgid - ulong *, id of message returned to caller
  1571. * trgcls - ulong, target message class
  1572. * srccls - ulong, source message class
  1573. * msgtag - ulong, message tag
  1574. * flags1 - Contains options for this path.
  1575. * IPPRTY - Ox20 - specifies if you want to send a priority message.
  1576. * buffer - pointer to buffer
  1577. * buflen - ulong, length of buffer
  1578. * Output: b2f0_result - return code from b2f0 call
  1579. * msgid - returns message id
  1580. */
  1581. int
  1582. iucv_send (__u16 pathid, __u32 * msgid,
  1583. __u32 trgcls, __u32 srccls,
  1584. __u32 msgtag, int flags1, void *buffer, ulong buflen)
  1585. {
  1586. iparml_db *parm;
  1587. ulong b2f0_result;
  1588. iucv_debug(2, "entering");
  1589. if (!buffer)
  1590. return -EINVAL;
  1591. parm = (iparml_db *)grab_param();
  1592. parm->ipbfadr1 = (__u32) ((ulong) buffer);
  1593. parm->ippathid = pathid;
  1594. parm->iptrgcls = trgcls;
  1595. parm->ipbfln1f = (__u32) buflen; /* length of message */
  1596. parm->ipsrccls = srccls;
  1597. parm->ipmsgtag = msgtag;
  1598. parm->ipflags1 = (IPNORPY | flags1); /* one way priority message */
  1599. b2f0_result = b2f0(SEND, parm);
  1600. if ((!b2f0_result) && (msgid))
  1601. *msgid = parm->ipmsgid;
  1602. release_param(parm);
  1603. iucv_debug(2, "exiting");
  1604. return b2f0_result;
  1605. }
  1606. /*
  1607. * Name: iucv_send_array
  1608. * Purpose: This function transmits data to another application.
  1609. * The contents of buffer is the address of the array of
  1610. * addresses and lengths of discontiguous buffers that hold
  1611. * the message text. This is a one-way message and the
  1612. * receiver will not reply to the message.
  1613. * Input: pathid - path identification number
  1614. * trgcls - specifies target class
  1615. * srccls - specifies the source message class
  1616. * msgtag - specifies a tag to be associated witht the message
  1617. * flags1 - option for path
  1618. * IPPRTY- specifies if you want to send priority message
  1619. * buffer - address of array of send buffers
  1620. * buflen - total length of send buffers
  1621. * Output: msgid - specifies the message ID.
  1622. * Return: b2f0_result - return code from CP
  1623. * (-EINVAL) - buffer address is NULL
  1624. */
  1625. int
  1626. iucv_send_array (__u16 pathid,
  1627. __u32 * msgid,
  1628. __u32 trgcls,
  1629. __u32 srccls,
  1630. __u32 msgtag, int flags1, iucv_array_t * buffer, ulong buflen)
  1631. {
  1632. iparml_db *parm;
  1633. ulong b2f0_result;
  1634. iucv_debug(2, "entering");
  1635. if (!buffer)
  1636. return -EINVAL;
  1637. parm = (iparml_db *)grab_param();
  1638. parm->ippathid = pathid;
  1639. parm->iptrgcls = trgcls;
  1640. parm->ipbfadr1 = (__u32) ((ulong) buffer);
  1641. parm->ipbfln1f = (__u32) buflen; /* length of message */
  1642. parm->ipsrccls = srccls;
  1643. parm->ipmsgtag = msgtag;
  1644. parm->ipflags1 = (IPNORPY | IPBUFLST | flags1);
  1645. b2f0_result = b2f0(SEND, parm);
  1646. if ((!b2f0_result) && (msgid))
  1647. *msgid = parm->ipmsgid;
  1648. release_param(parm);
  1649. iucv_debug(2, "exiting");
  1650. return b2f0_result;
  1651. }
  1652. /*
  1653. * Name: iucv_send_prmmsg
  1654. * Purpose: This function transmits data to another application.
  1655. * Prmmsg specifies that the 8-bytes of data are to be moved
  1656. * into the parameter list. This is a one-way message and the
  1657. * receiver will not reply to the message.
  1658. * Input: pathid - path identification number
  1659. * trgcls - specifies target class
  1660. * srccls - specifies the source message class
  1661. * msgtag - specifies a tag to be associated with the message
  1662. * flags1 - option for path
  1663. * IPPRTY- specifies if you want to send priority message
  1664. * prmmsg - 8-bytes of data to be placed into parameter list
  1665. * Output: msgid - specifies the message ID.
  1666. * Return: b2f0_result - return code from CP
  1667. */
  1668. int
  1669. iucv_send_prmmsg (__u16 pathid,
  1670. __u32 * msgid,
  1671. __u32 trgcls,
  1672. __u32 srccls, __u32 msgtag, int flags1, __u8 prmmsg[8])
  1673. {
  1674. iparml_dpl *parm;
  1675. ulong b2f0_result;
  1676. iucv_debug(2, "entering");
  1677. parm = (iparml_dpl *)grab_param();
  1678. parm->ippathid = pathid;
  1679. parm->iptrgcls = trgcls;
  1680. parm->ipsrccls = srccls;
  1681. parm->ipmsgtag = msgtag;
  1682. parm->ipflags1 = (IPRMDATA | IPNORPY | flags1);
  1683. memcpy(parm->iprmmsg, prmmsg, sizeof(parm->iprmmsg));
  1684. b2f0_result = b2f0(SEND, parm);
  1685. if ((!b2f0_result) && (msgid))
  1686. *msgid = parm->ipmsgid;
  1687. release_param(parm);
  1688. iucv_debug(2, "exiting");
  1689. return b2f0_result;
  1690. }
  1691. /*
  1692. * Name: iucv_send2way
  1693. * Purpose: This function transmits data to another application.
  1694. * Data to be transmitted is in a buffer. The receiver
  1695. * of the send is expected to reply to the message and
  1696. * a buffer is provided into which IUCV moves the reply
  1697. * to this message.
  1698. * Input: pathid - path identification number
  1699. * trgcls - specifies target class
  1700. * srccls - specifies the source message class
  1701. * msgtag - specifies a tag associated with the message
  1702. * flags1 - option for path
  1703. * IPPRTY- specifies if you want to send priority message
  1704. * buffer - address of send buffer
  1705. * buflen - length of send buffer
  1706. * ansbuf - address of buffer to reply with
  1707. * anslen - length of buffer to reply with
  1708. * Output: msgid - specifies the message ID.
  1709. * Return: b2f0_result - return code from CP
  1710. * (-EINVAL) - buffer or ansbuf address is NULL
  1711. */
  1712. int
  1713. iucv_send2way (__u16 pathid,
  1714. __u32 * msgid,
  1715. __u32 trgcls,
  1716. __u32 srccls,
  1717. __u32 msgtag,
  1718. int flags1,
  1719. void *buffer, ulong buflen, void *ansbuf, ulong anslen)
  1720. {
  1721. iparml_db *parm;
  1722. ulong b2f0_result;
  1723. iucv_debug(2, "entering");
  1724. if (!buffer || !ansbuf)
  1725. return -EINVAL;
  1726. parm = (iparml_db *)grab_param();
  1727. parm->ippathid = pathid;
  1728. parm->iptrgcls = trgcls;
  1729. parm->ipbfadr1 = (__u32) ((ulong) buffer);
  1730. parm->ipbfln1f = (__u32) buflen; /* length of message */
  1731. parm->ipbfadr2 = (__u32) ((ulong) ansbuf);
  1732. parm->ipbfln2f = (__u32) anslen;
  1733. parm->ipsrccls = srccls;
  1734. parm->ipmsgtag = msgtag;
  1735. parm->ipflags1 = flags1; /* priority message */
  1736. b2f0_result = b2f0(SEND, parm);
  1737. if ((!b2f0_result) && (msgid))
  1738. *msgid = parm->ipmsgid;
  1739. release_param(parm);
  1740. iucv_debug(2, "exiting");
  1741. return b2f0_result;
  1742. }
  1743. /*
  1744. * Name: iucv_send2way_array
  1745. * Purpose: This function transmits data to another application.
  1746. * The contents of buffer is the address of the array of
  1747. * addresses and lengths of discontiguous buffers that hold
  1748. * the message text. The receiver of the send is expected to
  1749. * reply to the message and a buffer is provided into which
  1750. * IUCV moves the reply to this message.
  1751. * Input: pathid - path identification number
  1752. * trgcls - specifies target class
  1753. * srccls - specifies the source message class
  1754. * msgtag - spcifies a tag to be associated with the message
  1755. * flags1 - option for path
  1756. * IPPRTY- specifies if you want to send priority message
  1757. * buffer - address of array of send buffers
  1758. * buflen - total length of send buffers
  1759. * ansbuf - address of buffer to reply with
  1760. * anslen - length of buffer to reply with
  1761. * Output: msgid - specifies the message ID.
  1762. * Return: b2f0_result - return code from CP
  1763. * (-EINVAL) - buffer address is NULL
  1764. */
  1765. int
  1766. iucv_send2way_array (__u16 pathid,
  1767. __u32 * msgid,
  1768. __u32 trgcls,
  1769. __u32 srccls,
  1770. __u32 msgtag,
  1771. int flags1,
  1772. iucv_array_t * buffer,
  1773. ulong buflen, iucv_array_t * ansbuf, ulong anslen)
  1774. {
  1775. iparml_db *parm;
  1776. ulong b2f0_result;
  1777. iucv_debug(2, "entering");
  1778. if (!buffer || !ansbuf)
  1779. return -EINVAL;
  1780. parm = (iparml_db *)grab_param();
  1781. parm->ippathid = pathid;
  1782. parm->iptrgcls = trgcls;
  1783. parm->ipbfadr1 = (__u32) ((ulong) buffer);
  1784. parm->ipbfln1f = (__u32) buflen; /* length of message */
  1785. parm->ipbfadr2 = (__u32) ((ulong) ansbuf);
  1786. parm->ipbfln2f = (__u32) anslen;
  1787. parm->ipsrccls = srccls;
  1788. parm->ipmsgtag = msgtag;
  1789. parm->ipflags1 = (IPBUFLST | IPANSLST | flags1);
  1790. b2f0_result = b2f0(SEND, parm);
  1791. if ((!b2f0_result) && (msgid))
  1792. *msgid = parm->ipmsgid;
  1793. release_param(parm);
  1794. iucv_debug(2, "exiting");
  1795. return b2f0_result;
  1796. }
  1797. /*
  1798. * Name: iucv_send2way_prmmsg
  1799. * Purpose: This function transmits data to another application.
  1800. * Prmmsg specifies that the 8-bytes of data are to be moved
  1801. * into the parameter list. This is a two-way message and the
  1802. * receiver of the message is expected to reply. A buffer
  1803. * is provided into which IUCV moves the reply to this
  1804. * message.
  1805. * Input: pathid - path identification number
  1806. * trgcls - specifies target class
  1807. * srccls - specifies the source message class
  1808. * msgtag - specifies a tag to be associated with the message
  1809. * flags1 - option for path
  1810. * IPPRTY- specifies if you want to send priority message
  1811. * prmmsg - 8-bytes of data to be placed in parameter list
  1812. * ansbuf - address of buffer to reply with
  1813. * anslen - length of buffer to reply with
  1814. * Output: msgid - specifies the message ID.
  1815. * Return: b2f0_result - return code from CP
  1816. * (-EINVAL) - buffer address is NULL
  1817. */
  1818. int
  1819. iucv_send2way_prmmsg (__u16 pathid,
  1820. __u32 * msgid,
  1821. __u32 trgcls,
  1822. __u32 srccls,
  1823. __u32 msgtag,
  1824. ulong flags1, __u8 prmmsg[8], void *ansbuf, ulong anslen)
  1825. {
  1826. iparml_dpl *parm;
  1827. ulong b2f0_result;
  1828. iucv_debug(2, "entering");
  1829. if (!ansbuf)
  1830. return -EINVAL;
  1831. parm = (iparml_dpl *)grab_param();
  1832. parm->ippathid = pathid;
  1833. parm->iptrgcls = trgcls;
  1834. parm->ipsrccls = srccls;
  1835. parm->ipmsgtag = msgtag;
  1836. parm->ipbfadr2 = (__u32) ((ulong) ansbuf);
  1837. parm->ipbfln2f = (__u32) anslen;
  1838. parm->ipflags1 = (IPRMDATA | flags1); /* message in prmlist */
  1839. memcpy(parm->iprmmsg, prmmsg, sizeof(parm->iprmmsg));
  1840. b2f0_result = b2f0(SEND, parm);
  1841. if ((!b2f0_result) && (msgid))
  1842. *msgid = parm->ipmsgid;
  1843. release_param(parm);
  1844. iucv_debug(2, "exiting");
  1845. return b2f0_result;
  1846. }
  1847. /*
  1848. * Name: iucv_send2way_prmmsg_array
  1849. * Purpose: This function transmits data to another application.
  1850. * Prmmsg specifies that the 8-bytes of data are to be moved
  1851. * into the parameter list. This is a two-way message and the
  1852. * receiver of the message is expected to reply. A buffer
  1853. * is provided into which IUCV moves the reply to this
  1854. * message. The contents of ansbuf is the address of the
  1855. * array of addresses and lengths of discontiguous buffers
  1856. * that contain the reply.
  1857. * Input: pathid - path identification number
  1858. * trgcls - specifies target class
  1859. * srccls - specifies the source message class
  1860. * msgtag - specifies a tag to be associated with the message
  1861. * flags1 - option for path
  1862. * IPPRTY- specifies if you want to send priority message
  1863. * prmmsg - 8-bytes of data to be placed into the parameter list
  1864. * ansbuf - address of buffer to reply with
  1865. * anslen - length of buffer to reply with
  1866. * Output: msgid - specifies the message ID.
  1867. * Return: b2f0_result - return code from CP
  1868. * (-EINVAL) - ansbuf address is NULL
  1869. */
  1870. int
  1871. iucv_send2way_prmmsg_array (__u16 pathid,
  1872. __u32 * msgid,
  1873. __u32 trgcls,
  1874. __u32 srccls,
  1875. __u32 msgtag,
  1876. int flags1,
  1877. __u8 prmmsg[8],
  1878. iucv_array_t * ansbuf, ulong anslen)
  1879. {
  1880. iparml_dpl *parm;
  1881. ulong b2f0_result;
  1882. iucv_debug(2, "entering");
  1883. if (!ansbuf)
  1884. return -EINVAL;
  1885. parm = (iparml_dpl *)grab_param();
  1886. parm->ippathid = pathid;
  1887. parm->iptrgcls = trgcls;
  1888. parm->ipsrccls = srccls;
  1889. parm->ipmsgtag = msgtag;
  1890. parm->ipbfadr2 = (__u32) ((ulong) ansbuf);
  1891. parm->ipbfln2f = (__u32) anslen;
  1892. parm->ipflags1 = (IPRMDATA | IPANSLST | flags1);
  1893. memcpy(parm->iprmmsg, prmmsg, sizeof(parm->iprmmsg));
  1894. b2f0_result = b2f0(SEND, parm);
  1895. if ((!b2f0_result) && (msgid))
  1896. *msgid = parm->ipmsgid;
  1897. release_param(parm);
  1898. iucv_debug(2, "exiting");
  1899. return b2f0_result;
  1900. }
  1901. void
  1902. iucv_setmask_cpuid (void *result)
  1903. {
  1904. iparml_set_mask *parm;
  1905. iucv_debug(1, "entering");
  1906. parm = (iparml_set_mask *)grab_param();
  1907. parm->ipmask = *((__u8*)result);
  1908. *((ulong *)result) = b2f0(SETMASK, parm);
  1909. release_param(parm);
  1910. iucv_debug(1, "b2f0_result = %ld", *((ulong *)result));
  1911. iucv_debug(1, "exiting");
  1912. }
  1913. /*
  1914. * Name: iucv_setmask
  1915. * Purpose: This function enables or disables the following IUCV
  1916. * external interruptions: Nonpriority and priority message
  1917. * interrupts, nonpriority and priority reply interrupts.
  1918. * Input: SetMaskFlag - options for interrupts
  1919. * 0x80 - Nonpriority_MessagePendingInterruptsFlag
  1920. * 0x40 - Priority_MessagePendingInterruptsFlag
  1921. * 0x20 - Nonpriority_MessageCompletionInterruptsFlag
  1922. * 0x10 - Priority_MessageCompletionInterruptsFlag
  1923. * 0x08 - IUCVControlInterruptsFlag
  1924. * Output: NA
  1925. * Return: b2f0_result - return code from CP
  1926. */
  1927. int
  1928. iucv_setmask (int SetMaskFlag)
  1929. {
  1930. union {
  1931. ulong result;
  1932. __u8 param;
  1933. } u;
  1934. int cpu;
  1935. u.param = SetMaskFlag;
  1936. cpu = get_cpu();
  1937. smp_call_function_on(iucv_setmask_cpuid, &u, 0, 1, iucv_cpuid);
  1938. put_cpu();
  1939. return u.result;
  1940. }
  1941. /**
  1942. * iucv_sever:
  1943. * @pathid: Path identification number
  1944. * @user_data: 16-byte of user data
  1945. *
  1946. * This function terminates an iucv path.
  1947. * Returns: return code from CP
  1948. */
  1949. int
  1950. iucv_sever(__u16 pathid, __u8 user_data[16])
  1951. {
  1952. iparml_control *parm;
  1953. ulong b2f0_result = 0;
  1954. iucv_debug(1, "entering");
  1955. parm = (iparml_control *)grab_param();
  1956. memcpy(parm->ipuser, user_data, sizeof(parm->ipuser));
  1957. parm->ippathid = pathid;
  1958. b2f0_result = b2f0(SEVER, parm);
  1959. if (!b2f0_result)
  1960. iucv_remove_pathid(pathid);
  1961. release_param(parm);
  1962. iucv_debug(1, "exiting");
  1963. return b2f0_result;
  1964. }
  1965. /*
  1966. * Interrupt Handlers
  1967. *******************************************************************************/
  1968. /**
  1969. * iucv_irq_handler:
  1970. * @regs: Current registers
  1971. * @code: irq code
  1972. *
  1973. * Handles external interrupts coming in from CP.
  1974. * Places the interrupt buffer on a queue and schedules iucv_tasklet_handler().
  1975. */
  1976. static void
  1977. iucv_irq_handler(struct pt_regs *regs, __u16 code)
  1978. {
  1979. iucv_irqdata *irqdata;
  1980. irqdata = kmalloc(sizeof(iucv_irqdata), GFP_ATOMIC);
  1981. if (!irqdata) {
  1982. printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__);
  1983. return;
  1984. }
  1985. memcpy(&irqdata->data, iucv_external_int_buffer,
  1986. sizeof(iucv_GeneralInterrupt));
  1987. spin_lock(&iucv_irq_queue_lock);
  1988. list_add_tail(&irqdata->queue, &iucv_irq_queue);
  1989. spin_unlock(&iucv_irq_queue_lock);
  1990. tasklet_schedule(&iucv_tasklet);
  1991. }
  1992. /**
  1993. * iucv_do_int:
  1994. * @int_buf: Pointer to copy of external interrupt buffer
  1995. *
  1996. * The workhorse for handling interrupts queued by iucv_irq_handler().
  1997. * This function is called from the bottom half iucv_tasklet_handler().
  1998. */
  1999. static void
  2000. iucv_do_int(iucv_GeneralInterrupt * int_buf)
  2001. {
  2002. handler *h = NULL;
  2003. struct list_head *lh;
  2004. ulong flags;
  2005. iucv_interrupt_ops_t *interrupt = NULL; /* interrupt addresses */
  2006. __u8 temp_buff1[24], temp_buff2[24]; /* masked handler id. */
  2007. int rc = 0, j = 0;
  2008. __u8 no_listener[16] = "NO LISTENER";
  2009. iucv_debug(2, "entering, pathid %d, type %02X",
  2010. int_buf->ippathid, int_buf->iptype);
  2011. iucv_dumpit("External Interrupt Buffer:",
  2012. int_buf, sizeof(iucv_GeneralInterrupt));
  2013. ASCEBC (no_listener, 16);
  2014. if (int_buf->iptype != 01) {
  2015. if ((int_buf->ippathid) > (max_connections - 1)) {
  2016. printk(KERN_WARNING "%s: Got interrupt with pathid %d"
  2017. " > max_connections (%ld)\n", __FUNCTION__,
  2018. int_buf->ippathid, max_connections - 1);
  2019. } else {
  2020. h = iucv_pathid_table[int_buf->ippathid];
  2021. interrupt = h->interrupt_table;
  2022. iucv_dumpit("Handler:", h, sizeof(handler));
  2023. }
  2024. }
  2025. /* end of if statement */
  2026. switch (int_buf->iptype) {
  2027. case 0x01: /* connection pending */
  2028. if (messagesDisabled) {
  2029. iucv_setmask(~0);
  2030. messagesDisabled = 0;
  2031. }
  2032. spin_lock_irqsave(&iucv_lock, flags);
  2033. list_for_each(lh, &iucv_handler_table) {
  2034. h = list_entry(lh, handler, list);
  2035. memcpy(temp_buff1, &(int_buf->ipvmid), 24);
  2036. memcpy(temp_buff2, &(h->id.userid), 24);
  2037. for (j = 0; j < 24; j++) {
  2038. temp_buff1[j] &= (h->id.mask)[j];
  2039. temp_buff2[j] &= (h->id.mask)[j];
  2040. }
  2041. iucv_dumpit("temp_buff1:",
  2042. temp_buff1, sizeof(temp_buff1));
  2043. iucv_dumpit("temp_buff2",
  2044. temp_buff2, sizeof(temp_buff2));
  2045. if (!memcmp (temp_buff1, temp_buff2, 24)) {
  2046. iucv_debug(2,
  2047. "found a matching handler");
  2048. break;
  2049. } else
  2050. h = NULL;
  2051. }
  2052. spin_unlock_irqrestore (&iucv_lock, flags);
  2053. if (h) {
  2054. /* ADD PATH TO PATHID TABLE */
  2055. rc = iucv_add_pathid(int_buf->ippathid, h);
  2056. if (rc) {
  2057. iucv_sever (int_buf->ippathid,
  2058. no_listener);
  2059. iucv_debug(1,
  2060. "add_pathid failed, rc = %d",
  2061. rc);
  2062. } else {
  2063. interrupt = h->interrupt_table;
  2064. if (interrupt->ConnectionPending) {
  2065. EBCASC (int_buf->ipvmid, 8);
  2066. interrupt->ConnectionPending(
  2067. (iucv_ConnectionPending *)int_buf,
  2068. h->pgm_data);
  2069. } else
  2070. iucv_sever(int_buf->ippathid,
  2071. no_listener);
  2072. }
  2073. } else
  2074. iucv_sever(int_buf->ippathid, no_listener);
  2075. break;
  2076. case 0x02: /*connection complete */
  2077. if (messagesDisabled) {
  2078. iucv_setmask(~0);
  2079. messagesDisabled = 0;
  2080. }
  2081. if (h) {
  2082. if (interrupt->ConnectionComplete)
  2083. {
  2084. interrupt->ConnectionComplete(
  2085. (iucv_ConnectionComplete *)int_buf,
  2086. h->pgm_data);
  2087. }
  2088. else
  2089. iucv_debug(1,
  2090. "ConnectionComplete not called");
  2091. } else
  2092. iucv_sever(int_buf->ippathid, no_listener);
  2093. break;
  2094. case 0x03: /* connection severed */
  2095. if (messagesDisabled) {
  2096. iucv_setmask(~0);
  2097. messagesDisabled = 0;
  2098. }
  2099. if (h) {
  2100. if (interrupt->ConnectionSevered)
  2101. interrupt->ConnectionSevered(
  2102. (iucv_ConnectionSevered *)int_buf,
  2103. h->pgm_data);
  2104. else
  2105. iucv_sever (int_buf->ippathid, no_listener);
  2106. } else
  2107. iucv_sever(int_buf->ippathid, no_listener);
  2108. break;
  2109. case 0x04: /* connection quiesced */
  2110. if (messagesDisabled) {
  2111. iucv_setmask(~0);
  2112. messagesDisabled = 0;
  2113. }
  2114. if (h) {
  2115. if (interrupt->ConnectionQuiesced)
  2116. interrupt->ConnectionQuiesced(
  2117. (iucv_ConnectionQuiesced *)int_buf,
  2118. h->pgm_data);
  2119. else
  2120. iucv_debug(1,
  2121. "ConnectionQuiesced not called");
  2122. }
  2123. break;
  2124. case 0x05: /* connection resumed */
  2125. if (messagesDisabled) {
  2126. iucv_setmask(~0);
  2127. messagesDisabled = 0;
  2128. }
  2129. if (h) {
  2130. if (interrupt->ConnectionResumed)
  2131. interrupt->ConnectionResumed(
  2132. (iucv_ConnectionResumed *)int_buf,
  2133. h->pgm_data);
  2134. else
  2135. iucv_debug(1,
  2136. "ConnectionResumed not called");
  2137. }
  2138. break;
  2139. case 0x06: /* priority message complete */
  2140. case 0x07: /* nonpriority message complete */
  2141. if (h) {
  2142. if (interrupt->MessageComplete)
  2143. interrupt->MessageComplete(
  2144. (iucv_MessageComplete *)int_buf,
  2145. h->pgm_data);
  2146. else
  2147. iucv_debug(2,
  2148. "MessageComplete not called");
  2149. }
  2150. break;
  2151. case 0x08: /* priority message pending */
  2152. case 0x09: /* nonpriority message pending */
  2153. if (h) {
  2154. if (interrupt->MessagePending)
  2155. interrupt->MessagePending(
  2156. (iucv_MessagePending *) int_buf,
  2157. h->pgm_data);
  2158. else
  2159. iucv_debug(2,
  2160. "MessagePending not called");
  2161. }
  2162. break;
  2163. default: /* unknown iucv type */
  2164. printk(KERN_WARNING "%s: unknown iucv interrupt\n",
  2165. __FUNCTION__);
  2166. break;
  2167. } /* end switch */
  2168. iucv_debug(2, "exiting pathid %d, type %02X",
  2169. int_buf->ippathid, int_buf->iptype);
  2170. return;
  2171. }
  2172. /**
  2173. * iucv_tasklet_handler:
  2174. *
  2175. * This function loops over the queue of irq buffers and runs iucv_do_int()
  2176. * on every queue element.
  2177. */
  2178. static void
  2179. iucv_tasklet_handler(unsigned long ignored)
  2180. {
  2181. struct list_head head;
  2182. struct list_head *next;
  2183. ulong flags;
  2184. spin_lock_irqsave(&iucv_irq_queue_lock, flags);
  2185. list_add(&head, &iucv_irq_queue);
  2186. list_del_init(&iucv_irq_queue);
  2187. spin_unlock_irqrestore (&iucv_irq_queue_lock, flags);
  2188. next = head.next;
  2189. while (next != &head) {
  2190. iucv_irqdata *p = list_entry(next, iucv_irqdata, queue);
  2191. next = next->next;
  2192. iucv_do_int(&p->data);
  2193. kfree(p);
  2194. }
  2195. return;
  2196. }
  2197. subsys_initcall(iucv_init);
  2198. module_exit(iucv_exit);
  2199. /**
  2200. * Export all public stuff
  2201. */
  2202. EXPORT_SYMBOL (iucv_bus);
  2203. EXPORT_SYMBOL (iucv_root);
  2204. EXPORT_SYMBOL (iucv_accept);
  2205. EXPORT_SYMBOL (iucv_connect);
  2206. #if 0
  2207. EXPORT_SYMBOL (iucv_purge);
  2208. EXPORT_SYMBOL (iucv_query_maxconn);
  2209. EXPORT_SYMBOL (iucv_query_bufsize);
  2210. EXPORT_SYMBOL (iucv_quiesce);
  2211. #endif
  2212. EXPORT_SYMBOL (iucv_receive);
  2213. #if 0
  2214. EXPORT_SYMBOL (iucv_receive_array);
  2215. #endif
  2216. EXPORT_SYMBOL (iucv_reject);
  2217. #if 0
  2218. EXPORT_SYMBOL (iucv_reply);
  2219. EXPORT_SYMBOL (iucv_reply_array);
  2220. EXPORT_SYMBOL (iucv_resume);
  2221. #endif
  2222. EXPORT_SYMBOL (iucv_reply_prmmsg);
  2223. EXPORT_SYMBOL (iucv_send);
  2224. EXPORT_SYMBOL (iucv_send2way);
  2225. EXPORT_SYMBOL (iucv_send2way_array);
  2226. EXPORT_SYMBOL (iucv_send2way_prmmsg);
  2227. EXPORT_SYMBOL (iucv_send2way_prmmsg_array);
  2228. #if 0
  2229. EXPORT_SYMBOL (iucv_send_array);
  2230. EXPORT_SYMBOL (iucv_send_prmmsg);
  2231. EXPORT_SYMBOL (iucv_setmask);
  2232. #endif
  2233. EXPORT_SYMBOL (iucv_sever);
  2234. EXPORT_SYMBOL (iucv_register_program);
  2235. EXPORT_SYMBOL (iucv_unregister_program);