diff options
| author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2002-10-03 21:50:15 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-10-03 21:50:15 -0700 |
| commit | 2abb6c501e1a98b671c6992c223f65afe187b065 (patch) | |
| tree | 1e4fc43860b4b9d3506980c9126b8c2cf7a850a8 | |
| parent | 09212816ad75542db6f3b5a9f6e857dc433b46b8 (diff) | |
[PATCH] s390 update (23/27): channel paths.
Check if defined chpids are available. Some code simplification.
| -rw-r--r-- | drivers/s390/cio/chsc.c | 126 | ||||
| -rw-r--r-- | drivers/s390/cio/chsc.h | 2 | ||||
| -rw-r--r-- | drivers/s390/cio/cio.c | 5 | ||||
| -rw-r--r-- | drivers/s390/cio/s390io.c | 37 |
4 files changed, 74 insertions, 96 deletions
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index e9b8ff703c6e..63924ea90429 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/chsc.c * S/390 common I/O routines -- channel subsystem call - * $Revision: 1.9 $ + * $Revision: 1.12 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -52,6 +52,49 @@ chsc_chpid_logical (int irq, int chp) return test_bit (ioinfo[irq]->schib.pmcw.chpid[chp], &chpids_logical); } +static inline void +chsc_clear_chpid(int irq, int chp) +{ + clear_bit(ioinfo[irq]->schib.pmcw.chpid[chp], &chpids); +} + +void +chsc_validate_chpids(int irq) +{ + int mask, chp; + + if (ioinfo[irq]->opm) { + for (chp=0;chp<=7;chp++) { + mask = 0x80 >> chp; + if (ioinfo[irq]->opm & mask) { + if (!chsc_chpid_logical(irq,chp)) + /* disable using this path */ + ioinfo[irq]->opm &= ~mask; + } else { + /* This chpid is not + * available to us */ + chsc_clear_chpid(irq,chp); + } + } + + } + +} + +void +switch_off_chpids(int irq, __u8 mask) +{ + int i; + pmcw_t *pmcw = &ioinfo[irq]->schib.pmcw; + + for (i=0;i<8;i++) + if ((0x80>>i) & mask + & pmcw->pim + & pmcw->pam + & pmcw->pom) + clear_bit(pmcw->chpid[i], &chpids); +} + /* FIXME: this is _always_ called for every subchannel. shouldn't we * process more than one at a time?*/ static int @@ -213,11 +256,9 @@ s390_do_chpid_processing( __u8 chpid) { int irq; int j; - int mask; char dbf_txt[15]; int ccode; int was_oper; - int chp = 0; int mask2; sprintf(dbf_txt, "chpr%x", chpid); @@ -266,21 +307,7 @@ s390_do_chpid_processing( __u8 chpid) ioinfo[irq]->schib.pmcw.pam & ioinfo[irq]->schib.pmcw.pom; - if (ioinfo[irq]->opm) { - for (chp=0;chp<=7;chp++) { - mask2 = 0x80 >> chp; - if (ioinfo[irq]->opm & mask2) { - if (!test_bit - (ioinfo[irq]-> - schib.pmcw.chpid[chp], - &chpids_logical)) { - /* disable using this path */ - ioinfo[irq]->opm - &= ~mask2; - } - } - } - } + chsc_validate_chpids(irq); if (!ioinfo[irq]->opm) { /* @@ -307,20 +334,7 @@ s390_do_chpid_processing( __u8 chpid) nopfunc(irq, DEVSTAT_DEVICE_GONE); } - } else if (ioinfo[irq]->ui.flags.ready) { - /* - * Re-do path verification for the chpid in question - * FIXME: is this neccessary? - */ - mask = 0x80 >> j; - - if (!s390_DevicePathVerification(irq,mask)) { - CHSC_DEBUG (KERN_DEBUG, CRW, 2, - "DevicePathVerification " - "successful for Subchannel %x, " - "chpid %x\n", irq, chpid); - } - } + } s390irq_spin_unlock(irq); break; @@ -432,18 +446,7 @@ s390_process_res_acc_chpid (u8 chpid) ioinfo[irq]->schib.pmcw.pam & ioinfo[irq]->schib.pmcw.pom; - if (ioinfo[irq]->opm) { - for (chp=0;chp<=7;chp++) { - mask = 0x80 >> chp; - if ((ioinfo[irq]->opm & mask) && - !test_bit (ioinfo[irq]->schib.pmcw.chpid[chp], - &chpids_logical)) { - - /* disable using this path */ - ioinfo[irq]->opm &= ~mask; - } - } - } + chsc_validate_chpids(irq); if ((ioinfo[irq]->ui.flags.ready) && (chpid & ioinfo[irq]->opm)) s390_DevicePathVerification(irq, chpid); @@ -456,8 +459,7 @@ s390_process_res_acc_linkaddr ( __u8 chpid, __u16 fla, u32 fla_mask) char dbf_txt[15]; int irq = 0; int ccode; - int chp; - int mask, mask2; + int mask2; int ret; int j; @@ -517,18 +519,7 @@ s390_process_res_acc_linkaddr ( __u8 chpid, __u16 fla, u32 fla_mask) ioinfo[irq]->schib.pmcw.pam & ioinfo[irq]->schib.pmcw.pom; - if (ioinfo[irq]->opm) { - for (chp=0;chp<=7;chp++) { - mask = 0x80 >> chp; - if ((ioinfo[irq]->opm & mask) - && (!test_bit (ioinfo[irq]-> - schib.pmcw.chpid[chp], - &chpids_logical))) { - /* disable using this path */ - ioinfo[irq]->opm &= ~mask; - } - } - } + chsc_validate_chpids(irq); if (ioinfo[irq]->ui.flags.ready) s390_DevicePathVerification(irq, chpid); @@ -782,11 +773,20 @@ cio_chpids_read (char *page, char **start, off_t off, } while (chp < NR_CHPIDS && len + entry_size < count) { - if ((test_bit( chp, &chpids)) && test_bit(chp, &chpids_logical)) - len += sprintf(page+len, "0x%02X online\n", chp); - else if (test_bit(chp, &chpids_known)) - len += sprintf(page+len, "0x%02X logically offline\n", - chp); + if (test_bit(chp, &chpids_known)) { + + if (!test_bit(chp, &chpids)) + len += sprintf(page+len, + "0x%02X n/a\n", chp); + + else if (test_bit(chp, &chpids_logical)) + len += sprintf(page+len, + "0x%02X online\n", chp); + else + len += sprintf(page+len, + "0x%02X logically offline\n", + chp); + } chp++; } diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index f879e634f814..093145e370f5 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h @@ -3,4 +3,6 @@ extern void s390_process_css( void ); extern int chsc_chpid_logical (int irq, int chp); +extern void chsc_validate_chpids(int irq); +extern void switch_off_chpids(int irq, __u8 mask); #endif diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 6782286df8cb..1ff9bda8c1de 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/cio.c * S/390 common I/O routines -- low level i/o calls - * $Revision: 1.25 $ + * $Revision: 1.26 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -342,6 +342,7 @@ s390_start_IO_handle_notoper(int irq, if (valid_lpm) { ioinfo[irq]->opm &= ~lpm; + switch_off_chpids(irq, lpm); } else { ioinfo[irq]->opm = 0; @@ -1386,7 +1387,7 @@ s390_process_IRQ_notoper(unsigned int irq) ioinfo[irq]->devstat.intparm = 0; - if (!ioinfo[irq]->ui.flags.s_pend) + if (!(ioinfo[irq]->ui.flags.s_pend || ioinfo[irq]->ui.flags.repnone)) ioinfo[irq]->irq_desc.handler (irq, udp, NULL); return 1; diff --git a/drivers/s390/cio/s390io.c b/drivers/s390/cio/s390io.c index 163a16512ac9..62115ec8b98c 100644 --- a/drivers/s390/cio/s390io.c +++ b/drivers/s390/cio/s390io.c @@ -991,9 +991,6 @@ s390_validate_subchannel (int irq, int enable) int ccode2; /* condition code for other I/O routines */ schib_t *p_schib; int ret; - int chp = 0; - int mask; - char dbf_txt[15]; sprintf (dbf_txt, "valsch%x", irq); @@ -1115,17 +1112,7 @@ s390_validate_subchannel (int irq, int enable) ioinfo[irq]->opm = ioinfo[irq]->schib.pmcw.pim & ioinfo[irq]->schib.pmcw.pam & ioinfo[irq]->schib.pmcw.pom; - if (ioinfo[irq]->opm) { - for (chp=0;chp<=7;chp++) { - mask = 0x80 >> chp; - if (ioinfo[irq]->opm & mask) { - if (!chsc_chpid_logical (irq, chp)) { - /* disable using this path */ - ioinfo[irq]->opm &= ~mask; - } - } - } - } + chsc_validate_chpids(irq); CIO_DEBUG_IFMSG(KERN_INFO, 0, "Detected device %04X " @@ -1690,8 +1677,6 @@ s390_DevicePathVerification (int irq, __u8 usermask) int ccode; __u8 pathmask; __u8 domask; - int chp; - int mask; int old_opm = 0; int ret = 0; @@ -1772,18 +1757,8 @@ s390_DevicePathVerification (int irq, __u8 usermask) ioinfo[irq]->opm = ioinfo[irq]->schib.pmcw.pim & ioinfo[irq]->schib.pmcw.pam & ioinfo[irq]->schib.pmcw.pom; - if (ioinfo[irq]->opm) { - for (chp=0;chp<=7;chp++) { - mask = 0x80 >> chp; - if (ioinfo[irq]->opm & mask) { - if (!chsc_chpid_logical (irq, chp)) { - /* disable using this path */ - ioinfo[irq]->opm &= ~mask; - } - } - } - } - + chsc_validate_chpids(irq); + if ((ioinfo[irq]->opm == 0) && (old_opm)) { not_oper_handler_func_t nopfunc=ioinfo[irq]->nopfunc; int was_oper = ioinfo[irq]->ui.flags.ready; @@ -1815,7 +1790,7 @@ s390_DevicePathVerification (int irq, __u8 usermask) } if ( ioinfo[irq]->ui.flags.pgid_supp == 0 ) - return( 0); /* just exit ... */ + return 0; /* just exit ... */ if (usermask) { dev_path = usermask; @@ -2229,8 +2204,8 @@ s390_SensePGID (int irq, __u8 lpm, pgid_t * pgid) * Sense Path Group ID command * further retries wouldn't help ... */ - if (pdevstat->ii.sense. - data[0] & SNS0_CMD_REJECT) { + if (pdevstat->ii.sense.data[0] & + (SNS0_CMD_REJECT | SNS0_INTERVENTION_REQ)) { retry = 0; irq_ret = -EOPNOTSUPP; } else { |
