diff options
author | Dean Nelson <dcn@sgi.com> | 2008-07-30 01:34:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:49 -0400 |
commit | 7fb5e59d63deda89a8eefdbd5b3c8d622076afd4 (patch) | |
tree | 4c78f9e016dd0998e8539a1da358b4ba961db8e9 /drivers/misc/sgi-xp/xpc.h | |
parent | a47d5dac9d8481766382f8cf1483dd581df38b99 (diff) |
sgi-xp: separate chctl_flags from XPC's notify IRQ
Tie current IPI references to either XPC's notify IRQ or channel control
flags.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc.h')
-rw-r--r-- | drivers/misc/sgi-xp/xpc.h | 124 |
1 files changed, 75 insertions, 49 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h index b04cfbed9581..26a1725f68ad 100644 --- a/drivers/misc/sgi-xp/xpc.h +++ b/drivers/misc/sgi-xp/xpc.h | |||
@@ -186,9 +186,10 @@ struct xpc_vars_part_sn2 { | |||
186 | u64 openclose_args_pa; /* physical address of open and close args */ | 186 | u64 openclose_args_pa; /* physical address of open and close args */ |
187 | u64 GPs_pa; /* physical address of Get/Put values */ | 187 | u64 GPs_pa; /* physical address of Get/Put values */ |
188 | 188 | ||
189 | u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */ | 189 | u64 chctl_amo_pa; /* physical address of chctl flags' AMO_t */ |
190 | int IPI_nasid; /* nasid of where to send IPIs */ | 190 | |
191 | int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */ | 191 | int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ |
192 | int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ | ||
192 | 193 | ||
193 | u8 nchannels; /* #of defined channels supported */ | 194 | u8 nchannels; /* #of defined channels supported */ |
194 | 195 | ||
@@ -407,7 +408,7 @@ struct xpc_channel { | |||
407 | atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ | 408 | atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ |
408 | wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */ | 409 | wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */ |
409 | 410 | ||
410 | u8 delayed_IPI_flags; /* IPI flags received, but delayed */ | 411 | u8 delayed_chctl_flags; /* chctl flags received, but delayed */ |
411 | /* action until channel disconnected */ | 412 | /* action until channel disconnected */ |
412 | 413 | ||
413 | /* queue of msg senders who want to be notified when msg received */ | 414 | /* queue of msg senders who want to be notified when msg received */ |
@@ -470,6 +471,54 @@ struct xpc_channel { | |||
470 | #define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */ | 471 | #define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */ |
471 | 472 | ||
472 | /* | 473 | /* |
474 | * The channel control flags (chctl) union consists of a 64-bit variable which | ||
475 | * is divided up into eight bytes, ordered from right to left. Byte zero | ||
476 | * pertains to channel 0, byte one to channel 1, and so on. Each channel's byte | ||
477 | * can have one or more of the chctl flags set in it. | ||
478 | */ | ||
479 | |||
480 | union xpc_channel_ctl_flags { | ||
481 | u64 all_flags; | ||
482 | u8 flags[XPC_MAX_NCHANNELS]; | ||
483 | }; | ||
484 | |||
485 | /* chctl flags */ | ||
486 | #define XPC_CHCTL_CLOSEREQUEST 0x01 | ||
487 | #define XPC_CHCTL_CLOSEREPLY 0x02 | ||
488 | #define XPC_CHCTL_OPENREQUEST 0x04 | ||
489 | #define XPC_CHCTL_OPENREPLY 0x08 | ||
490 | #define XPC_CHCTL_MSGREQUEST 0x10 | ||
491 | |||
492 | #define XPC_OPENCLOSE_CHCTL_FLAGS \ | ||
493 | (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \ | ||
494 | XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY) | ||
495 | #define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST | ||
496 | |||
497 | static inline int | ||
498 | xpc_any_openclose_chctl_flags_set(union xpc_channel_ctl_flags *chctl) | ||
499 | { | ||
500 | int ch_number; | ||
501 | |||
502 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) { | ||
503 | if (chctl->flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS) | ||
504 | return 1; | ||
505 | } | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | static inline int | ||
510 | xpc_any_msg_chctl_flags_set(union xpc_channel_ctl_flags *chctl) | ||
511 | { | ||
512 | int ch_number; | ||
513 | |||
514 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) { | ||
515 | if (chctl->flags[ch_number] & XPC_MSG_CHCTL_FLAGS) | ||
516 | return 1; | ||
517 | } | ||
518 | return 0; | ||
519 | } | ||
520 | |||
521 | /* | ||
473 | * Manages channels on a partition basis. There is one of these structures | 522 | * Manages channels on a partition basis. There is one of these structures |
474 | * for each partition (a partition will never utilize the structure that | 523 | * for each partition (a partition will never utilize the structure that |
475 | * represents itself). | 524 | * represents itself). |
@@ -494,12 +543,12 @@ struct xpc_partition_sn2 { | |||
494 | 543 | ||
495 | u64 remote_openclose_args_pa; /* phys addr of remote's args */ | 544 | u64 remote_openclose_args_pa; /* phys addr of remote's args */ |
496 | 545 | ||
497 | int remote_IPI_nasid; /* nasid of where to send IPIs */ | 546 | int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ |
498 | int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */ | 547 | int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ |
499 | char IPI_owner[8]; /* IPI owner's name */ | 548 | char notify_IRQ_owner[8]; /* notify IRQ's owner's name */ |
500 | 549 | ||
501 | AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */ | 550 | AMO_t *remote_chctl_amo_va; /* address of remote chctl flags' AMO_t */ |
502 | AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */ | 551 | AMO_t *local_chctl_amo_va; /* address of chctl flags' AMO_t */ |
503 | 552 | ||
504 | struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */ | 553 | struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */ |
505 | }; | 554 | }; |
@@ -536,7 +585,10 @@ struct xpc_partition { | |||
536 | atomic_t nchannels_engaged; /* #of channels engaged with remote part */ | 585 | atomic_t nchannels_engaged; /* #of channels engaged with remote part */ |
537 | struct xpc_channel *channels; /* array of channel structures */ | 586 | struct xpc_channel *channels; /* array of channel structures */ |
538 | 587 | ||
539 | /* fields used to pass args when opening or closing a channel */ | 588 | /* fields used for managing channel avialability and activity */ |
589 | |||
590 | union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */ | ||
591 | spinlock_t chctl_lock; /* chctl flags lock */ | ||
540 | 592 | ||
541 | void *local_openclose_args_base; /* base address of kmalloc'd space */ | 593 | void *local_openclose_args_base; /* base address of kmalloc'd space */ |
542 | struct xpc_openclose_args *local_openclose_args; /* local's args */ | 594 | struct xpc_openclose_args *local_openclose_args; /* local's args */ |
@@ -544,11 +596,6 @@ struct xpc_partition { | |||
544 | struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ | 596 | struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ |
545 | /* args */ | 597 | /* args */ |
546 | 598 | ||
547 | /* IPI sending, receiving and handling related fields */ | ||
548 | |||
549 | u64 local_IPI_amo; /* IPI amo flags yet to be handled */ | ||
550 | spinlock_t IPI_lock; /* IPI handler lock */ | ||
551 | |||
552 | /* channel manager related fields */ | 599 | /* channel manager related fields */ |
553 | 600 | ||
554 | atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */ | 601 | atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */ |
@@ -580,11 +627,12 @@ struct xpc_partition { | |||
580 | #define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */ | 627 | #define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */ |
581 | 628 | ||
582 | /* | 629 | /* |
583 | * struct xpc_partition IPI_timer #of seconds to wait before checking for | 630 | * struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the |
584 | * dropped IPIs. These occur whenever an IPI amo write doesn't complete until | 631 | * following interval #of seconds before checking for dropped notify IRQs. |
585 | * after the IPI was received. | 632 | * These can occur whenever an IRQ's associated amo write doesn't complete |
633 | * until after the IRQ was received. | ||
586 | */ | 634 | */ |
587 | #define XPC_P_DROPPED_IPI_WAIT_INTERVAL (0.25 * HZ) | 635 | #define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL (0.25 * HZ) |
588 | 636 | ||
589 | /* number of seconds to wait for other partitions to disengage */ | 637 | /* number of seconds to wait for other partitions to disengage */ |
590 | #define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90 | 638 | #define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90 |
@@ -617,9 +665,9 @@ extern void (*xpc_offline_heartbeat) (void); | |||
617 | extern void (*xpc_online_heartbeat) (void); | 665 | extern void (*xpc_online_heartbeat) (void); |
618 | extern void (*xpc_check_remote_hb) (void); | 666 | extern void (*xpc_check_remote_hb) (void); |
619 | extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); | 667 | extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); |
620 | extern u64 (*xpc_get_IPI_flags) (struct xpc_partition *); | 668 | extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); |
621 | extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); | 669 | extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); |
622 | extern void (*xpc_process_msg_IPI) (struct xpc_partition *, int); | 670 | extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int); |
623 | extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *); | 671 | extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *); |
624 | extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *); | 672 | extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *); |
625 | extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, u64, | 673 | extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, u64, |
@@ -638,14 +686,13 @@ extern int (*xpc_any_partition_engaged) (void); | |||
638 | extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *); | 686 | extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *); |
639 | extern void (*xpc_assume_partition_disengaged) (short); | 687 | extern void (*xpc_assume_partition_disengaged) (short); |
640 | 688 | ||
641 | extern void (*xpc_send_channel_closerequest) (struct xpc_channel *, | 689 | extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *, |
642 | unsigned long *); | ||
643 | extern void (*xpc_send_channel_closereply) (struct xpc_channel *, | ||
644 | unsigned long *); | 690 | unsigned long *); |
645 | extern void (*xpc_send_channel_openrequest) (struct xpc_channel *, | 691 | extern void (*xpc_send_chctl_closereply) (struct xpc_channel *, |
646 | unsigned long *); | 692 | unsigned long *); |
647 | extern void (*xpc_send_channel_openreply) (struct xpc_channel *, | 693 | extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *, |
648 | unsigned long *); | 694 | unsigned long *); |
695 | extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *); | ||
649 | 696 | ||
650 | extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16, | 697 | extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16, |
651 | u8, xpc_notify_func, void *); | 698 | u8, xpc_notify_func, void *); |
@@ -689,7 +736,7 @@ extern enum xp_retval xpc_initiate_send(short, int, u32, void *, u16); | |||
689 | extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16, | 736 | extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16, |
690 | xpc_notify_func, void *); | 737 | xpc_notify_func, void *); |
691 | extern void xpc_initiate_received(short, int, void *); | 738 | extern void xpc_initiate_received(short, int, void *); |
692 | extern void xpc_process_channel_activity(struct xpc_partition *); | 739 | extern void xpc_process_sent_chctl_flags(struct xpc_partition *); |
693 | extern void xpc_connected_callout(struct xpc_channel *); | 740 | extern void xpc_connected_callout(struct xpc_channel *); |
694 | extern void xpc_deliver_msg(struct xpc_channel *); | 741 | extern void xpc_deliver_msg(struct xpc_channel *); |
695 | extern void xpc_disconnect_channel(const int, struct xpc_channel *, | 742 | extern void xpc_disconnect_channel(const int, struct xpc_channel *, |
@@ -799,25 +846,4 @@ xpc_part_ref(struct xpc_partition *part) | |||
799 | (_p)->reason_line = _line; \ | 846 | (_p)->reason_line = _line; \ |
800 | } | 847 | } |
801 | 848 | ||
802 | /* | ||
803 | * The sending and receiving of IPIs includes the setting of an >>>AMO variable | ||
804 | * to indicate the reason the IPI was sent. The 64-bit variable is divided | ||
805 | * up into eight bytes, ordered from right to left. Byte zero pertains to | ||
806 | * channel 0, byte one to channel 1, and so on. Each byte is described by | ||
807 | * the following IPI flags. | ||
808 | */ | ||
809 | |||
810 | #define XPC_IPI_CLOSEREQUEST 0x01 | ||
811 | #define XPC_IPI_CLOSEREPLY 0x02 | ||
812 | #define XPC_IPI_OPENREQUEST 0x04 | ||
813 | #define XPC_IPI_OPENREPLY 0x08 | ||
814 | #define XPC_IPI_MSGREQUEST 0x10 | ||
815 | |||
816 | /* given an >>>AMO variable and a channel#, get its associated IPI flags */ | ||
817 | #define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff)) | ||
818 | #define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8)) | ||
819 | |||
820 | #define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0fUL) | ||
821 | #define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010UL) | ||
822 | |||
823 | #endif /* _DRIVERS_MISC_SGIXP_XPC_H */ | 849 | #endif /* _DRIVERS_MISC_SGIXP_XPC_H */ |