s390 update (4/9): common i/o layer update.
Subsystems (2)
PATCH 1/1 s390 update (4/9): common i/o layer update.
* Fix for path no operational condition in cio_start.
* Fix handling of user interruption parameter.
* Add code to wait for devices in init_ccw_bus_type.
* Move qdio states out of main cio state machine.
diffstat:
cio/airq.c | 6 cio/airq.h | 4 cio/chsc.c | 106 +++++++++++----- cio/cio.c | 30 +--- cio/cio.h | 9 - cio/css.c | 8 - cio/css.h | 1 cio/device.c | 70 ++++++++++- cio/device.h | 9 - cio/device_fsm.c | 147 ++++++----------------- cio/device_id.c | 10 - cio/device_ops.c | 40 +++--- cio/device_pgid.c | 27 +++- cio/device_status.c | 2 cio/qdio.c | 328 ++++++++++++++++++++++++++-------------------------- cio/qdio.h | 38 ++---- s390mach.c | 14 +- 17 files changed, 450 insertions(+), 399 deletions(-)
drivers/s390/cio/airq.c +3 -3
@@ -2,7 +2,7 @@* drivers/s390/cio/airq.c * S/390 common I/O routines -- support for adapter interruptions * -* $Revision: 1.10 $ +* $Revision: 1.11 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation
@@ -87,14 +87,14 @@ }void -do_adapter_IO (__u32 intparm) +do_adapter_IO (void ) {CIO_TRACE_EVENT (4 ,"doaio" );spin_lock (&adapter_lock);if (adapter_handler) - (*adapter_handler) (intparm); + (*adapter_handler) ();spin_unlock (&adapter_lock);
drivers/s390/cio/airq.h +2 -2
@@ -1,10 +1,10 @@#ifndef S390_AINTERRUPT_H #define S390_AINTERRUPT_H -typedef int (*adapter_int_handler_t )(__u32 intparm); +typedef int (*adapter_int_handler_t )(void );extern int s390_register_adapter_interrupt (adapter_int_handler_t handler);extern int s390_unregister_adapter_interrupt (adapter_int_handler_t handler); -extern void do_adapter_IO (__u32 intparm); +extern void do_adapter_IO (void );#endif
drivers/s390/cio/chsc.c +70 -36
180 lines not on this page · raw message
drivers/s390/cio/cio.c +12 -18
@@ -1,7 +1,7 @@/* * drivers/s390/cio/cio.c * S/390 common I/O routines -- low level i/o calls -* $Revision: 1.91 $ +* $Revision: 1.94 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation
@@ -176,13 +176,16 @@CIO_TRACE_EVENT (0 , dbf_text);CIO_HEX_EVENT (0 , &sch->schib,sizeof (struct schib )); -return -ENODEV ; +if (sch->lpm ==0 ) +return -ENODEV ; +else +return -EACCES ; }int cio_start (struct subchannel *sch,/* subchannel structure */ struct ccw1 * cpa,/* logical channel prog addr */ -unsigned long intparm,/* interruption parameter */ +unsigned int intparm,/* interruption parameter */ __u8 lpm)/* logical path mask */ {char dbf_txt[15 ];
@@ -191,7 +194,7 @@sprintf (dbf_txt,"stIO%x" , sch->irq);CIO_TRACE_EVENT (4 , dbf_txt); - sch->orb.intparm = (__u32) (long) &sch->u_intparm; + sch->orb.intparm = intparm; sch->orb.fmt =1 ; sch->orb.pfch = sch->options.prefetch ==0 ;
@@ -219,7 +222,6 @@/* * initialize device status information */ - sch->u_intparm = intparm; sch->schib.scsw.actl |=SCSW_ACTL_START_PEND ;return 0 ;case 1 :/* status pending */
@@ -265,13 +267,10 @@ }/* -* Note: The "intparm" parameter is not used by the halt_IO() function -* itself, as no ORB is built for the HSCH instruction. However, -* it allows the device interrupt handler to associate the upcoming -* interrupt with the halt_IO() request. +* halt I/O operation */ int -cio_halt (struct subchannel *sch,unsigned long intparm) +cio_halt (struct subchannel *sch) {char dbf_txt[15 ];int ccode;
@@ -297,7 +296,6 @@switch (ccode) {case 0 : - sch->u_intparm = intparm; sch->schib.scsw.actl |=SCSW_ACTL_HALT_PEND ;return 0 ;case 1 :/* status pending */
@@ -309,13 +307,10 @@ }/* -* Note: The "intparm" parameter is not used by the clear_IO() function -* itself, as no ORB is built for the CSCH instruction. However, -* it allows the device interrupt handler to associate the upcoming -* interrupt with the clear_IO() request. +* Clear I/O operation */ int -cio_clear (struct subchannel *sch,unsigned long intparm) +cio_clear (struct subchannel *sch) {char dbf_txt[15 ];int ccode;
@@ -340,7 +335,6 @@switch (ccode) {case 0 : - sch->u_intparm = intparm; sch->schib.scsw.actl |=SCSW_ACTL_CLEAR_PEND ;return 0 ;default :/* device not operational */
@@ -620,7 +614,7 @@*/ if (tpi_info->adapter_IO ==1 && tpi_info->int_type ==IO_INTERRUPT_TYPE ) { -do_adapter_IO (tpi_info->intparm); +do_adapter_IO ();continue ; } sch = ioinfo[tpi_info->irq];
drivers/s390/cio/cio.h +3 -6
@@ -98,8 +98,6 @@__u8 vpm;/* verified path mask */ __u8 lpm;/* logical path mask */ -// TODO: intparm for second start i/o -unsigned long u_intparm;/* user interruption parameter */ struct schib schib;/* subchannel information block */ struct orb orb;/* operation request block */ struct ccw1 sense_ccw;/* static ccw for sense command */
@@ -116,11 +114,10 @@extern int cio_enable_subchannel (struct subchannel *,unsigned int );extern int cio_disable_subchannel (struct subchannel *);extern int cio_cancel (struct subchannel *); -extern int cio_clear (struct subchannel *,unsigned long ); -extern int cio_do_io (struct subchannel *,struct ccw1 *,unsigned long ,__u8 ); +extern int cio_clear (struct subchannel *);extern int cio_resume (struct subchannel *); -extern int cio_halt (struct subchannel *,unsigned long ); -extern int cio_start (struct subchannel *,struct ccw1 *,unsigned long ,__u8 ); +extern int cio_halt (struct subchannel *); +extern int cio_start (struct subchannel *,struct ccw1 *,unsigned int ,__u8 );extern int cio_cancel (struct subchannel *);extern int cio_set_options (struct subchannel *,int );extern int cio_get_options (struct subchannel *);
drivers/s390/cio/css.c +4 -4
@@ -1,7 +1,7 @@/* * drivers/s390/cio/css.c * driver for channel subsystem -* $Revision: 1.40 $ +* $Revision: 1.43 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation
@@ -41,7 +41,7 @@/* There already is a struct subchannel for this irq. */ return -EBUSY ; - sch =kmalloc (sizeof (*sch),GFP_DMA ); + sch =kmalloc (sizeof (*sch),GFP_KERNEL |GFP_DMA );if (sch ==NULL )return -ENOMEM ; ret =cio_validate_subchannel (sch, irq);
@@ -161,7 +161,7 @@ sch = ioinfo[irq];if (sch ==NULL ) { -schedule_work (&work); +queue_work (ccw_device_work, &work);return ; }if (!sch->dev.driver_data)
@@ -172,7 +172,7 @@ ccode =stsch (irq, &sch->schib);if (!ccode)if (devno != sch->schib.pmcw.dev) -schedule_work (&work); +queue_work (ccw_device_work, &work); }/*
drivers/s390/cio/css.h +1 -0
@@ -79,6 +79,7 @@ unsigned int esid:1; /* Ext. SenseID supported by HW */ unsigned int dosense:1; /* delayed SENSE required */ } __attribute__((packed)) flags; +unsigned long intparm;/* user interruption parameter */ struct qdio_irq *qdio_data;struct irb irb;/* device status */ struct senseid senseid;/* SenseID info */
drivers/s390/cio/device.c +66 -4
131 lines not on this page · raw message
drivers/s390/cio/device.h +4 -5
@@ -14,13 +14,10 @@DEV_STATE_W4SENSE ,DEV_STATE_DISBAND_PGID ,DEV_STATE_BOXED , -/* special states for qdio */ -DEV_STATE_QDIO_INIT , -DEV_STATE_QDIO_ACTIVE , -DEV_STATE_QDIO_CLEANUP ,/* states to wait for i/o completion before doing something */ DEV_STATE_ONLINE_VERIFY ,DEV_STATE_W4SENSE_VERIFY , +DEV_STATE_CLEAR_VERIFY ,/* last element! */ NR_DEV_STATES };
@@ -63,7 +60,9 @@ cdev->private->state == DEV_STATE_BOXED); } -void io_subchannel_register (void *data); +extern struct workqueue_struct *ccw_device_work; + +void io_subchannel_recog_done (struct ccw_device *cdev);int ccw_device_recognition (struct ccw_device *);int ccw_device_online (struct ccw_device *);
drivers/s390/cio/device_fsm.c +40 -107
231 lines not on this page · raw message
drivers/s390/cio/device_id.c +6 -4
@@ -198,11 +198,13 @@/* 0x00E2C9C4 == ebcdic "SID" */ ret =cio_start (sch, cdev->private->iccws,0x00E2C9C4 , cdev->private->imask); -/* ret is 0, -EBUSY or -ENODEV */ -if (ret != -EBUSY ) +/* ret is 0, -EBUSY, -EACCES or -ENODEV */ +if (ret == -EBUSY ) { +udelay (100 ); +continue ; + } +if (ret != -EACCES )return ret; -udelay (100 ); -continue ; } cdev->private->imask >>=1 ; cdev->private->iretry =5 ;
drivers/s390/cio/device_ops.c +19 -21
@@ -48,13 +48,14 @@if (!cdev)return -ENODEV ;if (cdev->private->state !=DEV_STATE_ONLINE && - cdev->private->state !=DEV_STATE_W4SENSE && - cdev->private->state !=DEV_STATE_QDIO_ACTIVE ) + cdev->private->state !=DEV_STATE_W4SENSE )return -EINVAL ; sch =to_subchannel (cdev->dev.parent);if (!sch)return -ENODEV ; - ret =cio_clear (sch, intparm); + ret =cio_clear (sch); +if (ret ==0 ) + cdev->private->intparm = intparm;return ret; }
@@ -68,8 +69,7 @@if (!cdev)return -ENODEV ;if (cdev->private->state !=DEV_STATE_ONLINE && - cdev->private->state !=DEV_STATE_W4SENSE && - cdev->private->state !=DEV_STATE_QDIO_INIT ) + cdev->private->state !=DEV_STATE_W4SENSE )return -EINVAL ; sch =to_subchannel (cdev->dev.parent);if (!sch)
@@ -77,7 +77,10 @@ ret =cio_set_options (sch, flags);if (ret)return ret; - ret =cio_start (sch, cpa, intparm, lpm); +/* 0xe4e2c5d9 == ebcdic "USER" */ + ret =cio_start (sch, cpa,0xe4e2c5d9 , lpm); +if (ret ==0 ) + cdev->private->intparm = intparm;return ret; }
@@ -95,7 +98,9 @@ sch =to_subchannel (cdev->dev.parent);if (!sch)return -ENODEV ; - ret =cio_halt (sch, intparm); + ret =cio_halt (sch); +if (ret ==0 ) + cdev->private->intparm = intparm;return ret; }
@@ -123,15 +128,6 @@ {struct subchannel *sch;unsigned int stctl; -void (*handler)(struct ccw_device *,unsigned long ,struct irb *); - -if (cdev->private->state ==DEV_STATE_QDIO_ACTIVE ) { -if (cdev->private->qdio_data) - handler = cdev->private->qdio_data->handler; -else - handler =NULL ; - }else - handler = cdev->handler; sch =to_subchannel (cdev->dev.parent);
@@ -154,8 +150,9 @@/* * Now we are ready to call the device driver interrupt handler. */ -if (handler) -handler (cdev, sch->u_intparm, &cdev->private->irb); +if (cdev->handler) + cdev->handler (cdev, cdev->private->intparm, + &cdev->private->irb);/* * Clear the old and now useless interrupt response block.
@@ -300,7 +297,7 @@if (!ciw || ciw->cmd ==0 )return -EOPNOTSUPP ; - rcd_buf =kmalloc (ciw->count,GFP_DMA ); + rcd_buf =kmalloc (ciw->count,GFP_KERNEL |GFP_DMA );if (!rcd_buf)return -ENOMEM ;memset (rcd_buf,0 , ciw->count);
@@ -363,13 +360,14 @@MODULE_LICENSE ("GPL" ); +EXPORT_SYMBOL (ccw_device_set_options);EXPORT_SYMBOL (ccw_device_clear);EXPORT_SYMBOL (ccw_device_halt);EXPORT_SYMBOL (ccw_device_resume);EXPORT_SYMBOL (ccw_device_start);EXPORT_SYMBOL (ccw_device_get_ciw);EXPORT_SYMBOL (ccw_device_get_path_mask); -EXPORT_SYMBOL (read_conf_data); -EXPORT_SYMBOL (read_dev_chars); +EXPORT_SYMBOL (read_conf_data); +EXPORT_SYMBOL (read_dev_chars);EXPORT_SYMBOL (_ccw_device_get_subchannel_number);EXPORT_SYMBOL (_ccw_device_get_device_number);
drivers/s390/cio/device_pgid.c +19 -8
@@ -51,14 +51,23 @@/* 0xe2d5c9c4 == ebcdic "SNID" */ ret =cio_start (sch, cdev->private->iccws,0xE2D5C9C4 , cdev->private->imask); -/* ret is 0, -EBUSY or -ENODEV */ -if (ret != -EBUSY ) +/* ret is 0, -EBUSY, -EACCES or -ENODEV */ +if (ret == -EBUSY ) { +CIO_MSG_EVENT (2 , +"SNID - device %04X, start_io() " +"reports rc : %d, retrying ...\n" , + sch->schib.pmcw.dev, ret); +udelay (100 ); +continue ; + } +if (ret != -EACCES )return ret; -CIO_MSG_EVENT (2 ,"SNID - device %04X, start_io() " -"reports rc : %d, retrying ...\n" , - sch->schib.pmcw.dev, ret); -udelay (100 ); -continue ; +CIO_MSG_EVENT (2 ,"SNID - Device %04X on Subchannel " +"%04X, lpm %02X, became 'not " +"operational'\n" , + sch->schib.pmcw.dev, sch->irq, + cdev->private->imask); + } cdev->private->imask >>=1 ; cdev->private->iretry =5 ;
@@ -231,7 +240,9 @@/* 0xE2D7C9C4 == ebcdic "SPID" */ ret =cio_start (sch, cdev->private->iccws,0xE2D7C9C4 , cdev->private->imask); -/* ret is 0, -EBUSY or -ENODEV */ +/* ret is 0, -EBUSY, -EACCES or -ENODEV */ +if (ret == -EACCES ) +break ;if (ret != -EBUSY )return ret;udelay (100 );
drivers/s390/cio/device_status.c +1 -1
@@ -309,7 +309,7 @@ sch->sense_ccw.flags =CCW_FLAG_SLI ;/* 0xe2C5D5E2 == "SENS" in ebcdic */ -return cio_start (sch, &sch->sense_ccw,0xE2C5D5E2 ,0 ); +return cio_start (sch, &sch->sense_ccw,0xE2C5D5E2 ,0xff ); }/*
drivers/s390/cio/qdio.c +170 -158
552 lines not on this page · raw message
drivers/s390/cio/qdio.h +18 -20
@@ -1,7 +1,7 @@#ifndef _CIO_QDIO_H#define _CIO_QDIO_H -#define VERSION_CIO_QDIO_H "$Revision: 1.11 $" +#define VERSION_CIO_QDIO_H "$Revision: 1.13 $"//#define QDIO_DBF_LIKE_HELL
@@ -48,25 +48,25 @@#define QDIO_STATS_CLASSES 2 #define QDIO_STATS_COUNT_NEEDED 2*/ -#define QDIO_ACTIVATE_DELAY 5/* according to brenton belmar and paul -gioquindo it can take up to 5ms before -queues are really active */ -#define QDIO_NO_USE_COUNT_TIME 10#define QDIO_NO_USE_COUNT_TIMEOUT 1000/* wait for 1 sec on each q before exiting without having use_count of the queue to 0 */ #define QDIO_ESTABLISH_TIMEOUT 1000 -#define QDIO_ACTIVATE_TIMEOUT 100 +#define QDIO_ACTIVATE_TIMEOUT 100 //FIXME: maybe downsize?#define QDIO_CLEANUP_CLEAR_TIMEOUT 20000#define QDIO_CLEANUP_HALT_TIMEOUT 10000 -#define QDIO_IRQ_STATE_FRESH 0/* must be 0 -> memset has set it to 0 */ -#define QDIO_IRQ_STATE_INACTIVE 1 -#define QDIO_IRQ_STATE_ESTABLISHED 2 -#define QDIO_IRQ_STATE_ACTIVE 3 -#define QDIO_IRQ_STATE_STOPPED 4 +enum qdio_irq_states { +QDIO_IRQ_STATE_INACTIVE , +QDIO_IRQ_STATE_ESTABLISHED , +QDIO_IRQ_STATE_ACTIVE , +QDIO_IRQ_STATE_STOPPED , +QDIO_IRQ_STATE_CLEANUP , +QDIO_IRQ_STATE_ERR , +NR_QDIO_IRQ_STATES , +};/* used as intparm in do_IO: */ #define QDIO_DOING_SENSEID 0
@@ -623,7 +623,7 @@struct tasklet_struct tasklet;#endif /* QDIO_USE_TIMERS_FOR_POLLING */ -unsigned int state; +enum qdio_irq_states state;/* used to store the error condition during a data transfer */ unsigned int qdio_error;
@@ -674,7 +674,7 @@unsigned int hydra_gives_outbound_pcis;unsigned int sync_done_on_outb_pcis; -unsigned int state; +enum qdio_irq_states state;struct semaphore setting_up_sema;unsigned int no_input_qs;
@@ -694,13 +694,11 @@struct qib qib; -/* Functions called via the generic cio layer */ -void (*cleanup_irq) (struct ccw_device *,unsigned long ,struct irb *); -void (*cleanup_timeout) (struct ccw_device *); -void (*establish_irq) (struct ccw_device *,unsigned long , -struct irb *); -void (*establish_timeout) (struct ccw_device *); - void (*handler) (struct ccw_device *, unsigned long, struct irb *); +/* Function called via the generic cio layer */ +void (*timeout) (struct ccw_device *); + +void (*original_int_handler) (struct ccw_device *, + unsigned long, struct irb *); };#endif
drivers/s390/s390mach.c +12 -2
@@ -21,7 +21,7 @@extern void css_process_crw (int );extern void chsc_process_crw (void ); -extern void chp_process_crw (int ); +extern void chp_process_crw (int ,int );static void s390_handle_damage (char *msg)
@@ -62,7 +62,17 @@break ;case CRW_RSC_CPATH :pr_debug ("source is channel path %02X\n" , crw.rsid); -chp_process_crw (crw.rsid); +switch (crw.erc) { +case CRW_ERC_IPARM :/* Path has come. */ +chp_process_crw (crw.rsid,1 ); +break ; +case CRW_ERC_PERRI :/* Path has gone. */ +chp_process_crw (crw.rsid,0 ); +break ; +default : +pr_debug ("Don't know how to handle erc=%x\n" , + crw.erc); + }break ;case CRW_RSC_CONFIG :pr_debug ("source is configuration-alert facility\n" );
drivers/s390/cio/chsc.c line 93
Quoted 2 lines · Martin Schwidefsky
drivers/s390/cio/chsc.c +2
-0+typeof (chsc_area_ssd.response_block) + *ssd_res = &chsc_area_ssd.response_block;
Yikes! Please use the actual type here instead of typeof()
drivers/s390/cio/cio.c line 182
Quoted 4 lines
drivers/s390/cio/cio.c +4
-0+if (sch->lpm ==0 ) +return -ENODEV ; +else +return -EACCES ;
I'd write this as return (sch->lpm ? -EACCES : -ENODEV), but maybe I'm just too picky..
drivers/s390/cio/css.c line 44
Quoted 2 lines
drivers/s390/cio/css.c +1
-1- sch =kmalloc (sizeof (*sch),GFP_DMA ); + sch =kmalloc (sizeof (*sch),GFP_KERNEL |GFP_DMA );
What about using GFP_KERNEL | __GFP_DMA instead? This makes it more clear that it's just a qualifier.
Quoted 9 lines · Christoph Hellwig
Yikes! Please use the actual type here instead of
typeof()drivers/s390/cio/cio.c line 182
Quoted 4 lines
drivers/s390/cio/cio.c +4
-0+if (sch->lpm ==0 ) +return -ENODEV ; +else +return -EACCES ;I'd write this as return (
sch->lpm?-EACCES:-ENODEV), but maybe I'm just too picky..
Ah, don't be shy. Real men write this as
return -(sch->lpm ? EACCES : ENODEV); :-) Henning
Signature · 5 lines
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [email protected] +49 9131 50 654 0 http://www.intermeta.de/ Java, perl, Solaris, Linux, xSP Consulting, Web Services freelance consultant -- Jakarta Turbine Development -- hero for hire