zcore.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /*
  2. * zcore module to export memory content and register sets for creating system
  3. * dumps on SCSI disks (zfcpdump). The "zcore/mem" debugfs file shows the same
  4. * dump format as s390 standalone dumps.
  5. *
  6. * For more information please refer to Documentation/s390/zfcpdump.txt
  7. *
  8. * Copyright IBM Corp. 2003,2007
  9. * Author(s): Michael Holzheu
  10. */
  11. #include <linux/init.h>
  12. #include <linux/miscdevice.h>
  13. #include <linux/utsname.h>
  14. #include <linux/debugfs.h>
  15. #include <asm/ipl.h>
  16. #include <asm/sclp.h>
  17. #include <asm/setup.h>
  18. #include <asm/sigp.h>
  19. #include <asm/uaccess.h>
  20. #include <asm/debug.h>
  21. #include <asm/processor.h>
  22. #include <asm/irqflags.h>
  23. #include "sclp.h"
  24. #define TRACE(x...) debug_sprintf_event(zcore_dbf, 1, x)
  25. #define MSG(x...) printk( KERN_ALERT x )
  26. #define ERROR_MSG(x...) printk ( KERN_ALERT "DUMP: " x )
  27. #define TO_USER 0
  28. #define TO_KERNEL 1
  29. enum arch_id {
  30. ARCH_S390 = 0,
  31. ARCH_S390X = 1,
  32. };
  33. /* dump system info */
  34. struct sys_info {
  35. enum arch_id arch;
  36. unsigned long sa_base;
  37. u32 sa_size;
  38. int cpu_map[NR_CPUS];
  39. unsigned long mem_size;
  40. union save_area lc_mask;
  41. };
  42. static struct sys_info sys_info;
  43. static struct debug_info *zcore_dbf;
  44. static int hsa_available;
  45. static struct dentry *zcore_dir;
  46. static struct dentry *zcore_file;
  47. /*
  48. * Copy memory from HSA to kernel or user memory (not reentrant):
  49. *
  50. * @dest: Kernel or user buffer where memory should be copied to
  51. * @src: Start address within HSA where data should be copied
  52. * @count: Size of buffer, which should be copied
  53. * @mode: Either TO_KERNEL or TO_USER
  54. */
  55. static int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode)
  56. {
  57. int offs, blk_num;
  58. static char buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
  59. if (count == 0)
  60. return 0;
  61. /* copy first block */
  62. offs = 0;
  63. if ((src % PAGE_SIZE) != 0) {
  64. blk_num = src / PAGE_SIZE + 2;
  65. if (sclp_sdias_copy(buf, blk_num, 1)) {
  66. TRACE("sclp_sdias_copy() failed\n");
  67. return -EIO;
  68. }
  69. offs = min((PAGE_SIZE - (src % PAGE_SIZE)), count);
  70. if (mode == TO_USER) {
  71. if (copy_to_user((__force __user void*) dest,
  72. buf + (src % PAGE_SIZE), offs))
  73. return -EFAULT;
  74. } else
  75. memcpy(dest, buf + (src % PAGE_SIZE), offs);
  76. }
  77. if (offs == count)
  78. goto out;
  79. /* copy middle */
  80. for (; (offs + PAGE_SIZE) <= count; offs += PAGE_SIZE) {
  81. blk_num = (src + offs) / PAGE_SIZE + 2;
  82. if (sclp_sdias_copy(buf, blk_num, 1)) {
  83. TRACE("sclp_sdias_copy() failed\n");
  84. return -EIO;
  85. }
  86. if (mode == TO_USER) {
  87. if (copy_to_user((__force __user void*) dest + offs,
  88. buf, PAGE_SIZE))
  89. return -EFAULT;
  90. } else
  91. memcpy(dest + offs, buf, PAGE_SIZE);
  92. }
  93. if (offs == count)
  94. goto out;
  95. /* copy last block */
  96. blk_num = (src + offs) / PAGE_SIZE + 2;
  97. if (sclp_sdias_copy(buf, blk_num, 1)) {
  98. TRACE("sclp_sdias_copy() failed\n");
  99. return -EIO;
  100. }
  101. if (mode == TO_USER) {
  102. if (copy_to_user((__force __user void*) dest + offs, buf,
  103. PAGE_SIZE))
  104. return -EFAULT;
  105. } else
  106. memcpy(dest + offs, buf, count - offs);
  107. out:
  108. return 0;
  109. }
  110. static int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count)
  111. {
  112. return memcpy_hsa((void __force *) dest, src, count, TO_USER);
  113. }
  114. static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)
  115. {
  116. return memcpy_hsa(dest, src, count, TO_KERNEL);
  117. }
  118. static int memcpy_real(void *dest, unsigned long src, size_t count)
  119. {
  120. unsigned long flags;
  121. int rc = -EFAULT;
  122. register unsigned long _dest asm("2") = (unsigned long) dest;
  123. register unsigned long _len1 asm("3") = (unsigned long) count;
  124. register unsigned long _src asm("4") = src;
  125. register unsigned long _len2 asm("5") = (unsigned long) count;
  126. if (count == 0)
  127. return 0;
  128. flags = __raw_local_irq_stnsm(0xf8UL); /* switch to real mode */
  129. asm volatile (
  130. "0: mvcle %1,%2,0x0\n"
  131. "1: jo 0b\n"
  132. " lhi %0,0x0\n"
  133. "2:\n"
  134. EX_TABLE(1b,2b)
  135. : "+d" (rc), "+d" (_dest), "+d" (_src), "+d" (_len1),
  136. "+d" (_len2), "=m" (*((long*)dest))
  137. : "m" (*((long*)src))
  138. : "cc", "memory");
  139. __raw_local_irq_ssm(flags);
  140. return rc;
  141. }
  142. static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
  143. {
  144. static char buf[4096];
  145. int offs = 0, size;
  146. while (offs < count) {
  147. size = min(sizeof(buf), count - offs);
  148. if (memcpy_real(buf, src + offs, size))
  149. return -EFAULT;
  150. if (copy_to_user(dest + offs, buf, size))
  151. return -EFAULT;
  152. offs += size;
  153. }
  154. return 0;
  155. }
  156. #ifdef __s390x__
  157. /*
  158. * Convert s390x (64 bit) cpu info to s390 (32 bit) cpu info
  159. */
  160. static void __init s390x_to_s390_regs(union save_area *out, union save_area *in,
  161. int cpu)
  162. {
  163. int i;
  164. for (i = 0; i < 16; i++) {
  165. out->s390.gp_regs[i] = in->s390x.gp_regs[i] & 0x00000000ffffffff;
  166. out->s390.acc_regs[i] = in->s390x.acc_regs[i];
  167. out->s390.ctrl_regs[i] =
  168. in->s390x.ctrl_regs[i] & 0x00000000ffffffff;
  169. }
  170. /* locore for 31 bit has only space for fpregs 0,2,4,6 */
  171. out->s390.fp_regs[0] = in->s390x.fp_regs[0];
  172. out->s390.fp_regs[1] = in->s390x.fp_regs[2];
  173. out->s390.fp_regs[2] = in->s390x.fp_regs[4];
  174. out->s390.fp_regs[3] = in->s390x.fp_regs[6];
  175. memcpy(&(out->s390.psw[0]), &(in->s390x.psw[0]), 4);
  176. out->s390.psw[1] |= 0x8; /* set bit 12 */
  177. memcpy(&(out->s390.psw[4]),&(in->s390x.psw[12]), 4);
  178. out->s390.psw[4] |= 0x80; /* set (31bit) addressing bit */
  179. out->s390.pref_reg = in->s390x.pref_reg;
  180. out->s390.timer = in->s390x.timer;
  181. out->s390.clk_cmp = in->s390x.clk_cmp;
  182. }
  183. static void __init s390x_to_s390_save_areas(void)
  184. {
  185. int i = 1;
  186. static union save_area tmp;
  187. while (zfcpdump_save_areas[i]) {
  188. s390x_to_s390_regs(&tmp, zfcpdump_save_areas[i], i);
  189. memcpy(zfcpdump_save_areas[i], &tmp, sizeof(tmp));
  190. i++;
  191. }
  192. }
  193. #endif /* __s390x__ */
  194. static int __init init_cpu_info(enum arch_id arch)
  195. {
  196. union save_area *sa;
  197. /* get info for boot cpu from lowcore, stored in the HSA */
  198. sa = kmalloc(sizeof(*sa), GFP_KERNEL);
  199. if (!sa) {
  200. ERROR_MSG("kmalloc failed: %s: %i\n",__FUNCTION__, __LINE__);
  201. return -ENOMEM;
  202. }
  203. if (memcpy_hsa_kernel(sa, sys_info.sa_base, sys_info.sa_size) < 0) {
  204. ERROR_MSG("could not copy from HSA\n");
  205. kfree(sa);
  206. return -EIO;
  207. }
  208. zfcpdump_save_areas[0] = sa;
  209. #ifdef __s390x__
  210. /* convert s390x regs to s390, if we are dumping an s390 Linux */
  211. if (arch == ARCH_S390)
  212. s390x_to_s390_save_areas();
  213. #endif
  214. return 0;
  215. }
  216. static DEFINE_MUTEX(zcore_mutex);
  217. #define DUMP_VERSION 0x3
  218. #define DUMP_MAGIC 0xa8190173618f23fdULL
  219. #define DUMP_ARCH_S390X 2
  220. #define DUMP_ARCH_S390 1
  221. #define HEADER_SIZE 4096
  222. /* dump header dumped according to s390 crash dump format */
  223. struct zcore_header {
  224. u64 magic;
  225. u32 version;
  226. u32 header_size;
  227. u32 dump_level;
  228. u32 page_size;
  229. u64 mem_size;
  230. u64 mem_start;
  231. u64 mem_end;
  232. u32 num_pages;
  233. u32 pad1;
  234. u64 tod;
  235. cpuid_t cpu_id;
  236. u32 arch_id;
  237. u32 volnr;
  238. u32 build_arch;
  239. u64 rmem_size;
  240. char pad2[4016];
  241. } __attribute__((packed,__aligned__(16)));
  242. static struct zcore_header zcore_header = {
  243. .magic = DUMP_MAGIC,
  244. .version = DUMP_VERSION,
  245. .header_size = 4096,
  246. .dump_level = 0,
  247. .page_size = PAGE_SIZE,
  248. .mem_start = 0,
  249. #ifdef __s390x__
  250. .build_arch = DUMP_ARCH_S390X,
  251. #else
  252. .build_arch = DUMP_ARCH_S390,
  253. #endif
  254. };
  255. /*
  256. * Copy lowcore info to buffer. Use map in order to copy only register parts.
  257. *
  258. * @buf: User buffer
  259. * @sa: Pointer to save area
  260. * @sa_off: Offset in save area to copy
  261. * @len: Number of bytes to copy
  262. */
  263. static int copy_lc(void __user *buf, void *sa, int sa_off, int len)
  264. {
  265. int i;
  266. char *lc_mask = (char*)&sys_info.lc_mask;
  267. for (i = 0; i < len; i++) {
  268. if (!lc_mask[i + sa_off])
  269. continue;
  270. if (copy_to_user(buf + i, sa + sa_off + i, 1))
  271. return -EFAULT;
  272. }
  273. return 0;
  274. }
  275. /*
  276. * Copy lowcores info to memory, if necessary
  277. *
  278. * @buf: User buffer
  279. * @addr: Start address of buffer in dump memory
  280. * @count: Size of buffer
  281. */
  282. static int zcore_add_lc(char __user *buf, unsigned long start, size_t count)
  283. {
  284. unsigned long end;
  285. int i = 0;
  286. if (count == 0)
  287. return 0;
  288. end = start + count;
  289. while (zfcpdump_save_areas[i]) {
  290. unsigned long cp_start, cp_end; /* copy range */
  291. unsigned long sa_start, sa_end; /* save area range */
  292. unsigned long prefix;
  293. unsigned long sa_off, len, buf_off;
  294. if (sys_info.arch == ARCH_S390)
  295. prefix = zfcpdump_save_areas[i]->s390.pref_reg;
  296. else
  297. prefix = zfcpdump_save_areas[i]->s390x.pref_reg;
  298. sa_start = prefix + sys_info.sa_base;
  299. sa_end = prefix + sys_info.sa_base + sys_info.sa_size;
  300. if ((end < sa_start) || (start > sa_end))
  301. goto next;
  302. cp_start = max(start, sa_start);
  303. cp_end = min(end, sa_end);
  304. buf_off = cp_start - start;
  305. sa_off = cp_start - sa_start;
  306. len = cp_end - cp_start;
  307. TRACE("copy_lc for: %lx\n", start);
  308. if (copy_lc(buf + buf_off, zfcpdump_save_areas[i], sa_off, len))
  309. return -EFAULT;
  310. next:
  311. i++;
  312. }
  313. return 0;
  314. }
  315. /*
  316. * Read routine for zcore character device
  317. * First 4K are dump header
  318. * Next 32MB are HSA Memory
  319. * Rest is read from absolute Memory
  320. */
  321. static ssize_t zcore_read(struct file *file, char __user *buf, size_t count,
  322. loff_t *ppos)
  323. {
  324. unsigned long mem_start; /* Start address in memory */
  325. size_t mem_offs; /* Offset in dump memory */
  326. size_t hdr_count; /* Size of header part of output buffer */
  327. size_t size;
  328. int rc;
  329. mutex_lock(&zcore_mutex);
  330. if (*ppos > (sys_info.mem_size + HEADER_SIZE)) {
  331. rc = -EINVAL;
  332. goto fail;
  333. }
  334. count = min(count, (size_t) (sys_info.mem_size + HEADER_SIZE - *ppos));
  335. /* Copy dump header */
  336. if (*ppos < HEADER_SIZE) {
  337. size = min(count, (size_t) (HEADER_SIZE - *ppos));
  338. if (copy_to_user(buf, &zcore_header + *ppos, size)) {
  339. rc = -EFAULT;
  340. goto fail;
  341. }
  342. hdr_count = size;
  343. mem_start = 0;
  344. } else {
  345. hdr_count = 0;
  346. mem_start = *ppos - HEADER_SIZE;
  347. }
  348. mem_offs = 0;
  349. /* Copy from HSA data */
  350. if (*ppos < (ZFCPDUMP_HSA_SIZE + HEADER_SIZE)) {
  351. size = min((count - hdr_count), (size_t) (ZFCPDUMP_HSA_SIZE
  352. - mem_start));
  353. rc = memcpy_hsa_user(buf + hdr_count, mem_start, size);
  354. if (rc)
  355. goto fail;
  356. mem_offs += size;
  357. }
  358. /* Copy from real mem */
  359. size = count - mem_offs - hdr_count;
  360. rc = memcpy_real_user(buf + hdr_count + mem_offs, mem_start + mem_offs,
  361. size);
  362. if (rc)
  363. goto fail;
  364. /*
  365. * Since s390 dump analysis tools like lcrash or crash
  366. * expect register sets in the prefix pages of the cpus,
  367. * we copy them into the read buffer, if necessary.
  368. * buf + hdr_count: Start of memory part of output buffer
  369. * mem_start: Start memory address to copy from
  370. * count - hdr_count: Size of memory area to copy
  371. */
  372. if (zcore_add_lc(buf + hdr_count, mem_start, count - hdr_count)) {
  373. rc = -EFAULT;
  374. goto fail;
  375. }
  376. *ppos += count;
  377. fail:
  378. mutex_unlock(&zcore_mutex);
  379. return (rc < 0) ? rc : count;
  380. }
  381. static int zcore_open(struct inode *inode, struct file *filp)
  382. {
  383. if (!hsa_available)
  384. return -ENODATA;
  385. else
  386. return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
  387. }
  388. static int zcore_release(struct inode *inode, struct file *filep)
  389. {
  390. diag308(DIAG308_REL_HSA, NULL);
  391. hsa_available = 0;
  392. return 0;
  393. }
  394. static loff_t zcore_lseek(struct file *file, loff_t offset, int orig)
  395. {
  396. loff_t rc;
  397. mutex_lock(&zcore_mutex);
  398. switch (orig) {
  399. case 0:
  400. file->f_pos = offset;
  401. rc = file->f_pos;
  402. break;
  403. case 1:
  404. file->f_pos += offset;
  405. rc = file->f_pos;
  406. break;
  407. default:
  408. rc = -EINVAL;
  409. }
  410. mutex_unlock(&zcore_mutex);
  411. return rc;
  412. }
  413. static struct file_operations zcore_fops = {
  414. .owner = THIS_MODULE,
  415. .llseek = zcore_lseek,
  416. .read = zcore_read,
  417. .open = zcore_open,
  418. .release = zcore_release,
  419. };
  420. static void __init set_s390_lc_mask(union save_area *map)
  421. {
  422. memset(&map->s390.ext_save, 0xff, sizeof(map->s390.ext_save));
  423. memset(&map->s390.timer, 0xff, sizeof(map->s390.timer));
  424. memset(&map->s390.clk_cmp, 0xff, sizeof(map->s390.clk_cmp));
  425. memset(&map->s390.psw, 0xff, sizeof(map->s390.psw));
  426. memset(&map->s390.pref_reg, 0xff, sizeof(map->s390.pref_reg));
  427. memset(&map->s390.acc_regs, 0xff, sizeof(map->s390.acc_regs));
  428. memset(&map->s390.fp_regs, 0xff, sizeof(map->s390.fp_regs));
  429. memset(&map->s390.gp_regs, 0xff, sizeof(map->s390.gp_regs));
  430. memset(&map->s390.ctrl_regs, 0xff, sizeof(map->s390.ctrl_regs));
  431. }
  432. static void __init set_s390x_lc_mask(union save_area *map)
  433. {
  434. memset(&map->s390x.fp_regs, 0xff, sizeof(map->s390x.fp_regs));
  435. memset(&map->s390x.gp_regs, 0xff, sizeof(map->s390x.gp_regs));
  436. memset(&map->s390x.psw, 0xff, sizeof(map->s390x.psw));
  437. memset(&map->s390x.pref_reg, 0xff, sizeof(map->s390x.pref_reg));
  438. memset(&map->s390x.fp_ctrl_reg, 0xff, sizeof(map->s390x.fp_ctrl_reg));
  439. memset(&map->s390x.tod_reg, 0xff, sizeof(map->s390x.tod_reg));
  440. memset(&map->s390x.timer, 0xff, sizeof(map->s390x.timer));
  441. memset(&map->s390x.clk_cmp, 0xff, sizeof(map->s390x.clk_cmp));
  442. memset(&map->s390x.acc_regs, 0xff, sizeof(map->s390x.acc_regs));
  443. memset(&map->s390x.ctrl_regs, 0xff, sizeof(map->s390x.ctrl_regs));
  444. }
  445. /*
  446. * Initialize dump globals for a given architecture
  447. */
  448. static int __init sys_info_init(enum arch_id arch)
  449. {
  450. switch (arch) {
  451. case ARCH_S390X:
  452. MSG("DETECTED 'S390X (64 bit) OS'\n");
  453. sys_info.sa_base = SAVE_AREA_BASE_S390X;
  454. sys_info.sa_size = sizeof(struct save_area_s390x);
  455. set_s390x_lc_mask(&sys_info.lc_mask);
  456. break;
  457. case ARCH_S390:
  458. MSG("DETECTED 'S390 (32 bit) OS'\n");
  459. sys_info.sa_base = SAVE_AREA_BASE_S390;
  460. sys_info.sa_size = sizeof(struct save_area_s390);
  461. set_s390_lc_mask(&sys_info.lc_mask);
  462. break;
  463. default:
  464. ERROR_MSG("unknown architecture 0x%x.\n",arch);
  465. return -EINVAL;
  466. }
  467. sys_info.arch = arch;
  468. if (init_cpu_info(arch)) {
  469. ERROR_MSG("get cpu info failed\n");
  470. return -ENOMEM;
  471. }
  472. sys_info.mem_size = real_memory_size;
  473. return 0;
  474. }
  475. static int __init check_sdias(void)
  476. {
  477. int rc, act_hsa_size;
  478. rc = sclp_sdias_blk_count();
  479. if (rc < 0) {
  480. ERROR_MSG("Could not determine HSA size\n");
  481. return rc;
  482. }
  483. act_hsa_size = (rc - 1) * PAGE_SIZE;
  484. if (act_hsa_size < ZFCPDUMP_HSA_SIZE) {
  485. ERROR_MSG("HSA size too small: %i\n", act_hsa_size);
  486. return -EINVAL;
  487. }
  488. return 0;
  489. }
  490. static void __init zcore_header_init(int arch, struct zcore_header *hdr)
  491. {
  492. if (arch == ARCH_S390X)
  493. hdr->arch_id = DUMP_ARCH_S390X;
  494. else
  495. hdr->arch_id = DUMP_ARCH_S390;
  496. hdr->mem_size = sys_info.mem_size;
  497. hdr->rmem_size = sys_info.mem_size;
  498. hdr->mem_end = sys_info.mem_size;
  499. hdr->num_pages = sys_info.mem_size / PAGE_SIZE;
  500. hdr->tod = get_clock();
  501. get_cpu_id(&hdr->cpu_id);
  502. }
  503. static int __init zcore_init(void)
  504. {
  505. unsigned char arch;
  506. int rc;
  507. if (ipl_info.type != IPL_TYPE_FCP_DUMP)
  508. return -ENODATA;
  509. zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long));
  510. debug_register_view(zcore_dbf, &debug_sprintf_view);
  511. debug_set_level(zcore_dbf, 6);
  512. TRACE("devno: %x\n", ipl_info.data.fcp.dev_id.devno);
  513. TRACE("wwpn: %llx\n", (unsigned long long) ipl_info.data.fcp.wwpn);
  514. TRACE("lun: %llx\n", (unsigned long long) ipl_info.data.fcp.lun);
  515. rc = sclp_sdias_init();
  516. if (rc)
  517. goto fail;
  518. rc = check_sdias();
  519. if (rc) {
  520. ERROR_MSG("Dump initialization failed\n");
  521. goto fail;
  522. }
  523. rc = memcpy_hsa_kernel(&arch, __LC_AR_MODE_ID, 1);
  524. if (rc) {
  525. ERROR_MSG("sdial memcpy for arch id failed\n");
  526. goto fail;
  527. }
  528. #ifndef __s390x__
  529. if (arch == ARCH_S390X) {
  530. ERROR_MSG("32 bit dumper can't dump 64 bit system!\n");
  531. rc = -EINVAL;
  532. goto fail;
  533. }
  534. #endif
  535. rc = sys_info_init(arch);
  536. if (rc) {
  537. ERROR_MSG("arch init failed\n");
  538. goto fail;
  539. }
  540. zcore_header_init(arch, &zcore_header);
  541. zcore_dir = debugfs_create_dir("zcore" , NULL);
  542. if (!zcore_dir) {
  543. rc = -ENOMEM;
  544. goto fail;
  545. }
  546. zcore_file = debugfs_create_file("mem", S_IRUSR, zcore_dir, NULL,
  547. &zcore_fops);
  548. if (!zcore_file) {
  549. debugfs_remove(zcore_dir);
  550. rc = -ENOMEM;
  551. goto fail;
  552. }
  553. hsa_available = 1;
  554. return 0;
  555. fail:
  556. diag308(DIAG308_REL_HSA, NULL);
  557. return rc;
  558. }
  559. static void __exit zcore_exit(void)
  560. {
  561. debug_unregister(zcore_dbf);
  562. sclp_sdias_exit();
  563. diag308(DIAG308_REL_HSA, NULL);
  564. }
  565. MODULE_AUTHOR("Copyright IBM Corp. 2003,2007");
  566. MODULE_DESCRIPTION("zcore module for zfcpdump support");
  567. MODULE_LICENSE("GPL");
  568. subsys_initcall(zcore_init);
  569. module_exit(zcore_exit);