Commit f86635fa authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Martin Schwidefsky

[S390] cio: Introduce struct chp_id.

Introduce data type for channel-path IDs.
Signed-off-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 6fc321fd
/*
* drivers/s390/cio/chpid.h
*
* Copyright IBM Corp. 2007
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/
#ifndef S390_CHP_ID_H
#define S390_CHP_ID_H S390_CHP_ID_H
#include <linux/string.h>
#include <asm/types.h>
#include "css.h"
struct chp_id {
u8 reserved1;
u8 cssid;
u8 reserved2;
u8 id;
} __attribute__((packed));
static inline void chp_id_init(struct chp_id *chpid)
{
memset(chpid, 0, sizeof(struct chp_id));
}
static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
{
return (a->id == b->id) && (a->cssid == b->cssid);
}
static inline void chp_id_next(struct chp_id *chpid)
{
if (chpid->id < __MAX_CHPID)
chpid->id++;
else {
chpid->id = 0;
chpid->cssid++;
}
}
static inline int chp_id_is_valid(struct chp_id *chpid)
{
return (chpid->cssid <= __MAX_CSSID);
}
#define chp_id_for_each(c) \
for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
#endif /* S390_CHP_ID_H */
This diff is collapsed.
#ifndef S390_CHSC_H #ifndef S390_CHSC_H
#define S390_CHSC_H #define S390_CHSC_H
#include <linux/types.h>
#include <linux/device.h>
#include "chpid.h"
#define CHSC_SEI_ACC_CHPID 1 #define CHSC_SEI_ACC_CHPID 1
#define CHSC_SEI_ACC_LINKADDR 2 #define CHSC_SEI_ACC_LINKADDR 2
#define CHSC_SEI_ACC_FULLLINKADDR 3 #define CHSC_SEI_ACC_FULLLINKADDR 3
...@@ -34,7 +38,7 @@ struct channel_path_desc { ...@@ -34,7 +38,7 @@ struct channel_path_desc {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct channel_path { struct channel_path {
int id; struct chp_id chpid;
int state; int state;
struct channel_path_desc desc; struct channel_path_desc desc;
/* Channel-measurement related stuff: */ /* Channel-measurement related stuff: */
...@@ -46,7 +50,7 @@ struct channel_path { ...@@ -46,7 +50,7 @@ struct channel_path {
extern void s390_process_css( void ); extern void s390_process_css( void );
extern void chsc_validate_chpids(struct subchannel *); extern void chsc_validate_chpids(struct subchannel *);
extern void chpid_is_actually_online(int); extern void chpid_is_actually_online(struct chp_id);
extern int css_get_ssd_info(struct subchannel *); extern int css_get_ssd_info(struct subchannel *);
extern int chsc_process_crw(void); extern int chsc_process_crw(void);
extern int chp_process_crw(int, int); extern int chp_process_crw(int, int);
......
...@@ -954,6 +954,7 @@ static void css_reset(void) ...@@ -954,6 +954,7 @@ static void css_reset(void)
{ {
int i, ret; int i, ret;
unsigned long long timeout; unsigned long long timeout;
struct chp_id chpid;
/* Reset subchannels. */ /* Reset subchannels. */
for_each_subchannel(__shutdown_subchannel_easy, NULL); for_each_subchannel(__shutdown_subchannel_easy, NULL);
...@@ -963,8 +964,10 @@ static void css_reset(void) ...@@ -963,8 +964,10 @@ static void css_reset(void)
__ctl_set_bit(14, 28); __ctl_set_bit(14, 28);
/* Temporarily reenable machine checks. */ /* Temporarily reenable machine checks. */
local_mcck_enable(); local_mcck_enable();
chp_id_init(&chpid);
for (i = 0; i <= __MAX_CHPID; i++) { for (i = 0; i <= __MAX_CHPID; i++) {
ret = rchp(i); chpid.id = i;
ret = rchp(chpid);
if ((ret == 0) || (ret == 2)) if ((ret == 0) || (ret == 2))
/* /*
* rchp either succeeded, or another rchp is already * rchp either succeeded, or another rchp is already
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "device.h" #include "device.h"
#include "chsc.h" #include "chsc.h"
#include "ioasm.h" #include "ioasm.h"
#include "chpid.h"
int int
device_is_online(struct subchannel *sch) device_is_online(struct subchannel *sch)
...@@ -210,14 +211,17 @@ static void ...@@ -210,14 +211,17 @@ static void
__recover_lost_chpids(struct subchannel *sch, int old_lpm) __recover_lost_chpids(struct subchannel *sch, int old_lpm)
{ {
int mask, i; int mask, i;
struct chp_id chpid;
chp_id_init(&chpid);
for (i = 0; i<8; i++) { for (i = 0; i<8; i++) {
mask = 0x80 >> i; mask = 0x80 >> i;
if (!(sch->lpm & mask)) if (!(sch->lpm & mask))
continue; continue;
if (old_lpm & mask) if (old_lpm & mask)
continue; continue;
chpid_is_actually_online(sch->schib.pmcw.chpid[i]); chpid.id = sch->schib.pmcw.chpid[i];
chpid_is_actually_online(chpid);
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define S390_CIO_IOASM_H #define S390_CIO_IOASM_H
#include "schid.h" #include "schid.h"
#include "chpid.h"
/* /*
* TPI info structure * TPI info structure
...@@ -189,9 +190,9 @@ static inline int chsc(void *chsc_area) ...@@ -189,9 +190,9 @@ static inline int chsc(void *chsc_area)
return cc; return cc;
} }
static inline int rchp(int chpid) static inline int rchp(struct chp_id chpid)
{ {
register unsigned int reg1 asm ("1") = chpid; register struct chp_id reg1 asm ("1") = chpid;
int ccode; int ccode;
asm volatile( asm volatile(
......
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