Commit 2abb6c50 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390 update (23/27): channel paths.

Check if defined chpids are available. Some code simplification.
parent 09212816
/*
* 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,19 +334,6 @@ 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);
......@@ -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",
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++;
}
......
......@@ -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
/*
* 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;
......
......@@ -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,17 +1757,7 @@ 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;
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment