1/*************************************************************************** 2 * 3 * drivers/s390/char/tape3480.c 4 * tape device discipline for 3480 tapes. 5 * 6 * S390 and zSeries version 7 * Copyright (C) 2001 IBM Corporation 8 * Author(s): Carsten Otte <cotte@de.ibm.com> 9 * Tuan Ngo-Anh <ngoanh@de.ibm.com> 10 * 11 **************************************************************************** 12 */ 13 14#include "tapedefs.h" 15#include <linux/version.h> 16#include <asm/ccwcache.h> /* CCW allocations */ 17#include <asm/s390dyn.h> 18#include <asm/debug.h> 19#include <linux/compatmac.h> 20#include "tape.h" 21#include "tape34xx.h" 22#include "tape3480.h" 23 24tape_event_handler_t tape3480_event_handler_table[TS_SIZE][TE_SIZE] = 25{ 26 /* {START , DONE, FAILED, ERROR, OTHER } */ 27 {NULL, tape34xx_unused_done, NULL, NULL, NULL}, /* TS_UNUSED */ 28 {NULL, tape34xx_idle_done, NULL, NULL, NULL}, /* TS_IDLE */ 29 {NULL, NULL, NULL, NULL, NULL}, /* TS_DONE */ 30 {NULL, NULL, NULL, NULL, NULL}, /* TS_FAILED */ 31 {NULL, tape34xx_block_done, NULL, NULL, NULL}, /* TS_BLOCK_INIT */ 32 {NULL, tape34xx_bsb_init_done, NULL, NULL, NULL}, /* TS_BSB_INIT */ 33 {NULL, tape34xx_bsf_init_done, NULL, NULL, NULL}, /* TS_BSF_INIT */ 34 {NULL, tape34xx_dse_init_done, NULL, NULL, NULL}, /* TS_DSE_INIT */ 35 {NULL, NULL, NULL, NULL, NULL}, /* TS_EGA_INIT */ 36 {NULL, tape34xx_fsb_init_done, NULL, NULL, NULL}, /* TS_FSB_INIT */ 37 {NULL, tape34xx_fsf_init_done, NULL, NULL, NULL}, /* TS_FSF_INIT */ 38 {NULL, NULL, NULL, NULL, NULL}, /* TS_LDI_INIT */ 39 {NULL, tape34xx_lbl_init_done, NULL, NULL, NULL}, /* TS_LBL_INIT */ 40 {NULL, NULL, NULL, NULL, NULL}, /* TS_MSE_INIT */ 41 {NULL, tape34xx_nop_init_done, NULL, NULL, NULL}, /* TS_NOP_INIT */ 42 {NULL, tape34xx_rfo_init_done, NULL, NULL, NULL}, /* TS_RBA_INIT */ 43 {NULL, tape34xx_rbi_init_done, NULL, NULL, NULL}, /* TS_RBI_INIT */ 44 {NULL, NULL, NULL, NULL, NULL}, /* TS_RBU_INIT */ 45 {NULL, NULL, NULL, NULL, NULL}, /* TS_RBL_INIT */ 46 {NULL, NULL, NULL, NULL, NULL}, /* TS_RDC_INIT */ 47 {NULL, tape34xx_rfo_init_done, NULL, NULL, NULL}, /* TS_RFO_INIT */ 48 {NULL, NULL, NULL, NULL, NULL}, /* TS_RSD_INIT */ 49 {NULL, tape34xx_rew_init_done, NULL, NULL, NULL}, /* TS_REW_INIT */ 50 {NULL, tape34xx_rew_release_init_done, NULL, NULL, NULL}, /* TS_REW_RELEASE_IMIT */ 51 {NULL, tape34xx_run_init_done, NULL, NULL, NULL}, /* TS_RUN_INIT */ 52 {NULL, NULL, NULL, NULL, NULL}, /* TS_SEN_INIT */ 53 {NULL, NULL, NULL, NULL, NULL}, /* TS_SID_INIT */ 54 {NULL, NULL, NULL, NULL, NULL}, /* TS_SNP_INIT */ 55 {NULL, NULL, NULL, NULL, NULL}, /* TS_SPG_INIT */ 56 {NULL, NULL, NULL, NULL, NULL}, /* TS_SWI_INIT */ 57 {NULL, NULL, NULL, NULL, NULL}, /* TS_SMR_INIT */ 58 {NULL, NULL, NULL, NULL, NULL}, /* TS_SYN_INIT */ 59 {NULL, NULL, NULL, NULL, NULL}, /* TS_TIO_INIT */ 60 {NULL, NULL, NULL, NULL, NULL}, /* TS_UNA_INIT */ 61 {NULL, tape34xx_wri_init_done, NULL, NULL, NULL}, /* TS_WRI_INIT */ 62 {NULL, tape34xx_wtm_init_done, NULL, NULL, NULL}, /* TS_WTM_INIT */ 63 {NULL, NULL, NULL, NULL, NULL}}; /* TS_NOT_OPER */ 64 65devreg_t tape3480_devreg = { 66 ci: 67 {hc: 68 {ctype:0x3480}}, 69 flag:DEVREG_MATCH_CU_TYPE | DEVREG_TYPE_DEVCHARS, 70 oper_func:tape_oper_handler 71}; 72 73 74void 75tape3480_setup_assist (tape_info_t * ti) 76{ 77 tape3480_disc_data_t *data = NULL; 78#ifdef TAPE_DEBUG 79 debug_text_event (tape_debug_area,6,"3480 dsetu"); 80 debug_text_event (tape_debug_area,6,"dev:"); 81 debug_int_event (tape_debug_area,6,ti->blk_minor); 82#endif /* TAPE_DEBUG */ 83 while (data == NULL) 84 data = kmalloc (sizeof (tape3480_disc_data_t), GFP_KERNEL); 85 data->modeset_byte = 0x00; 86 ti->discdata = (void *) data; 87} 88 89 90void 91tape3480_shutdown (int autoprobe) { 92 if (autoprobe) 93 s390_device_unregister(&tape3480_devreg); 94} 95 96tape_discipline_t * 97tape3480_init (int autoprobe) 98{ 99 tape_discipline_t *disc; 100#ifdef TAPE_DEBUG 101 debug_text_event (tape_debug_area,3,"3480 init"); 102#endif /* TAPE_DEBUG */ 103 disc = kmalloc (sizeof (tape_discipline_t), GFP_KERNEL); 104 if (disc == NULL) { 105#ifdef TAPE_DEBUG 106 debug_text_exception (tape_debug_area,3,"disc:nomem"); 107#endif /* TAPE_DEBUG */ 108 return disc; 109 } 110 disc->cu_type = 0x3480; 111 disc->setup_assist = tape3480_setup_assist; 112 disc->error_recovery = tape34xx_error_recovery; 113 disc->write_block = tape34xx_write_block; 114 disc->free_write_block = tape34xx_free_write_block; 115 disc->read_block = tape34xx_read_block; 116 disc->free_read_block = tape34xx_free_read_block; 117 disc->mtfsf = tape34xx_mtfsf; 118 disc->mtbsf = tape34xx_mtbsf; 119 disc->mtfsr = tape34xx_mtfsr; 120 disc->mtbsr = tape34xx_mtbsr; 121 disc->mtweof = tape34xx_mtweof; 122 disc->mtrew = tape34xx_mtrew; 123 disc->mtoffl = tape34xx_mtoffl; 124 disc->mtnop = tape34xx_mtnop; 125 disc->mtbsfm = tape34xx_mtbsfm; 126 disc->mtfsfm = tape34xx_mtfsfm; 127 disc->mteom = tape34xx_mteom; 128 disc->mterase = tape34xx_mterase; 129 disc->mtsetdensity = tape34xx_mtsetdensity; 130 disc->mtseek = tape34xx_mtseek; 131 disc->mttell = tape34xx_mttell; 132 disc->mtsetdrvbuffer = tape34xx_mtsetdrvbuffer; 133 disc->mtlock = tape34xx_mtlock; 134 disc->mtunlock = tape34xx_mtunlock; 135 disc->mtload = tape34xx_mtload; 136 disc->mtunload = tape34xx_mtunload; 137 disc->mtcompression = tape34xx_mtcompression; 138 disc->mtsetpart = tape34xx_mtsetpart; 139 disc->mtmkpart = tape34xx_mtmkpart; 140 disc->mtiocget = tape34xx_mtiocget; 141 disc->mtiocpos = tape34xx_mtiocpos; 142 disc->shutdown = tape3480_shutdown; 143 disc->discipline_ioctl_overload = tape34xx_ioctl_overload; 144 disc->event_table = &tape3480_event_handler_table; 145 disc->default_handler = tape34xx_default_handler; 146 disc->bread = tape34xx_bread; 147 disc->free_bread = tape34xx_free_bread; 148 disc->tape = NULL; /* pointer for backreference */ 149 disc->next = NULL; 150 if (autoprobe) 151 s390_device_register(&tape3480_devreg); 152#ifdef TAPE_DEBUG 153 debug_text_event (tape_debug_area,3,"3480 regis"); 154#endif /* TAPE_DEBUG */ 155 return disc; 156} 157