diff options
author | Moore, Eric <Eric.Moore@lsil.com> | 2006-02-02 19:20:01 -0500 |
---|---|---|
committer | <jejb@mulgrave.il.steeleye.com> | 2006-02-04 17:33:24 -0500 |
commit | ea5a7a82f9d2d8a81f8fa541c34a12b43d390f61 (patch) | |
tree | 3f8c20eb726abd6994f16d3938ff760fe25bafce /drivers/message/fusion/mptctl.c | |
parent | 946cbf040adb9db05bb895a4b629537fd2d03b0e (diff) |
[SCSI] fusion - mptctl -adding asyn event notification support
Adding aen support.
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r-- | drivers/message/fusion/mptctl.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index fe10cc0fe18e..9b64e07400da 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -136,6 +136,12 @@ static void mptctl_free_tm_flags(MPT_ADAPTER *ioc); | |||
136 | */ | 136 | */ |
137 | static int mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase); | 137 | static int mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase); |
138 | 138 | ||
139 | /* | ||
140 | * Event Handler function | ||
141 | */ | ||
142 | static int mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); | ||
143 | struct fasync_struct *async_queue=NULL; | ||
144 | |||
139 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 145 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
140 | /* | 146 | /* |
141 | * Scatter gather list (SGL) sizes and limits... | 147 | * Scatter gather list (SGL) sizes and limits... |
@@ -472,6 +478,69 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
472 | } | 478 | } |
473 | 479 | ||
474 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 480 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
481 | /* ASYNC Event Notification Support */ | ||
482 | static int | ||
483 | mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | ||
484 | { | ||
485 | u8 event; | ||
486 | |||
487 | event = le32_to_cpu(pEvReply->Event) & 0xFF; | ||
488 | |||
489 | dctlprintk(("%s() called\n", __FUNCTION__)); | ||
490 | if(async_queue == NULL) | ||
491 | return 1; | ||
492 | |||
493 | /* Raise SIGIO for persistent events. | ||
494 | * TODO - this define is not in MPI spec yet, | ||
495 | * but they plan to set it to 0x21 | ||
496 | */ | ||
497 | if (event == 0x21 ) { | ||
498 | ioc->aen_event_read_flag=1; | ||
499 | dctlprintk(("Raised SIGIO to application\n")); | ||
500 | devtprintk(("Raised SIGIO to application\n")); | ||
501 | kill_fasync(&async_queue, SIGIO, POLL_IN); | ||
502 | return 1; | ||
503 | } | ||
504 | |||
505 | /* This flag is set after SIGIO was raised, and | ||
506 | * remains set until the application has read | ||
507 | * the event log via ioctl=MPTEVENTREPORT | ||
508 | */ | ||
509 | if(ioc->aen_event_read_flag) | ||
510 | return 1; | ||
511 | |||
512 | /* Signal only for the events that are | ||
513 | * requested for by the application | ||
514 | */ | ||
515 | if (ioc->events && (ioc->eventTypes & ( 1 << event))) { | ||
516 | ioc->aen_event_read_flag=1; | ||
517 | dctlprintk(("Raised SIGIO to application\n")); | ||
518 | devtprintk(("Raised SIGIO to application\n")); | ||
519 | kill_fasync(&async_queue, SIGIO, POLL_IN); | ||
520 | } | ||
521 | return 1; | ||
522 | } | ||
523 | |||
524 | static int | ||
525 | mptctl_fasync(int fd, struct file *filep, int mode) | ||
526 | { | ||
527 | MPT_ADAPTER *ioc; | ||
528 | |||
529 | list_for_each_entry(ioc, &ioc_list, list) | ||
530 | ioc->aen_event_read_flag=0; | ||
531 | |||
532 | dctlprintk(("%s() called\n", __FUNCTION__)); | ||
533 | return fasync_helper(fd, filep, mode, &async_queue); | ||
534 | } | ||
535 | |||
536 | static int | ||
537 | mptctl_release(struct inode *inode, struct file *filep) | ||
538 | { | ||
539 | dctlprintk(("%s() called\n", __FUNCTION__)); | ||
540 | return fasync_helper(-1, filep, 0, &async_queue); | ||
541 | } | ||
542 | |||
543 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
475 | /* | 544 | /* |
476 | * MPT ioctl handler | 545 | * MPT ioctl handler |
477 | * cmd - specify the particular IOCTL command to be issued | 546 | * cmd - specify the particular IOCTL command to be issued |
@@ -1603,6 +1672,9 @@ mptctl_eventreport (unsigned long arg) | |||
1603 | if ((max < 1) || !ioc->events) | 1672 | if ((max < 1) || !ioc->events) |
1604 | return -ENODATA; | 1673 | return -ENODATA; |
1605 | 1674 | ||
1675 | /* reset this flag so SIGIO can restart */ | ||
1676 | ioc->aen_event_read_flag=0; | ||
1677 | |||
1606 | /* Copy the data from kernel memory to user memory | 1678 | /* Copy the data from kernel memory to user memory |
1607 | */ | 1679 | */ |
1608 | numBytes = max * sizeof(MPT_IOCTL_EVENTS); | 1680 | numBytes = max * sizeof(MPT_IOCTL_EVENTS); |
@@ -2649,6 +2721,8 @@ mptctl_hp_targetinfo(unsigned long arg) | |||
2649 | static struct file_operations mptctl_fops = { | 2721 | static struct file_operations mptctl_fops = { |
2650 | .owner = THIS_MODULE, | 2722 | .owner = THIS_MODULE, |
2651 | .llseek = no_llseek, | 2723 | .llseek = no_llseek, |
2724 | .release = mptctl_release, | ||
2725 | .fasync = mptctl_fasync, | ||
2652 | .unlocked_ioctl = mptctl_ioctl, | 2726 | .unlocked_ioctl = mptctl_ioctl, |
2653 | #ifdef CONFIG_COMPAT | 2727 | #ifdef CONFIG_COMPAT |
2654 | .compat_ioctl = compat_mpctl_ioctl, | 2728 | .compat_ioctl = compat_mpctl_ioctl, |
@@ -2893,6 +2967,11 @@ static int __init mptctl_init(void) | |||
2893 | /* FIXME! */ | 2967 | /* FIXME! */ |
2894 | } | 2968 | } |
2895 | 2969 | ||
2970 | if (mpt_event_register(mptctl_id, mptctl_event_process) == 0) { | ||
2971 | devtprintk((KERN_INFO MYNAM | ||
2972 | ": Registered for IOC event notifications\n")); | ||
2973 | } | ||
2974 | |||
2896 | return 0; | 2975 | return 0; |
2897 | 2976 | ||
2898 | out_fail: | 2977 | out_fail: |