iucv.c 67 KB

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