Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143230
b: refs/heads/master
c: a7665b0
h: refs/heads/master
v: v3
  • Loading branch information
Robin Holt authored and Linus Torvalds committed Apr 13, 2009
1 parent 02e0825 commit bf16f3e
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 296 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: efdd06ed181a88a11e612238c1ac04668e665395
refs/heads/master: a7665b0a380585fbd70a2275f3120c6086e0c92d
112 changes: 57 additions & 55 deletions trunk/drivers/misc/sgi-xp/xpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,62 @@ struct xpc_partition {

} ____cacheline_aligned;

struct xpc_arch_operations {
int (*setup_partitions) (void);
void (*teardown_partitions) (void);
void (*process_activate_IRQ_rcvd) (void);
enum xp_retval (*get_partition_rsvd_page_pa)
(void *, u64 *, unsigned long *, size_t *);
int (*setup_rsvd_page) (struct xpc_rsvd_page *);

void (*allow_hb) (short);
void (*disallow_hb) (short);
void (*disallow_all_hbs) (void);
void (*increment_heartbeat) (void);
void (*offline_heartbeat) (void);
void (*online_heartbeat) (void);
void (*heartbeat_init) (void);
void (*heartbeat_exit) (void);
enum xp_retval (*get_remote_heartbeat) (struct xpc_partition *);

void (*request_partition_activation) (struct xpc_rsvd_page *,
unsigned long, int);
void (*request_partition_reactivation) (struct xpc_partition *);
void (*request_partition_deactivation) (struct xpc_partition *);
void (*cancel_partition_deactivation_request) (struct xpc_partition *);
enum xp_retval (*setup_ch_structures) (struct xpc_partition *);
void (*teardown_ch_structures) (struct xpc_partition *);

enum xp_retval (*make_first_contact) (struct xpc_partition *);

u64 (*get_chctl_all_flags) (struct xpc_partition *);
void (*send_chctl_closerequest) (struct xpc_channel *, unsigned long *);
void (*send_chctl_closereply) (struct xpc_channel *, unsigned long *);
void (*send_chctl_openrequest) (struct xpc_channel *, unsigned long *);
void (*send_chctl_openreply) (struct xpc_channel *, unsigned long *);
void (*send_chctl_opencomplete) (struct xpc_channel *, unsigned long *);
void (*process_msg_chctl_flags) (struct xpc_partition *, int);

enum xp_retval (*save_remote_msgqueue_pa) (struct xpc_channel *,
unsigned long);

enum xp_retval (*setup_msg_structures) (struct xpc_channel *);
void (*teardown_msg_structures) (struct xpc_channel *);

void (*indicate_partition_engaged) (struct xpc_partition *);
void (*indicate_partition_disengaged) (struct xpc_partition *);
void (*assume_partition_disengaged) (short);
int (*partition_engaged) (short);
int (*any_partition_engaged) (void);

int (*n_of_deliverable_payloads) (struct xpc_channel *);
enum xp_retval (*send_payload) (struct xpc_channel *, u32, void *,
u16, u8, xpc_notify_func, void *);
void *(*get_deliverable_payload) (struct xpc_channel *);
void (*received_payload) (struct xpc_channel *, void *);
void (*notify_senders_of_disconnect) (struct xpc_channel *);
};

/* struct xpc_partition act_state values (for XPC HB) */

#define XPC_P_AS_INACTIVE 0x00 /* partition is not active */
Expand Down Expand Up @@ -820,6 +876,7 @@ extern struct xpc_registration xpc_registrations[];
/* found in xpc_main.c */
extern struct device *xpc_part;
extern struct device *xpc_chan;
extern struct xpc_arch_operations xpc_arch_ops;
extern int xpc_disengage_timelimit;
extern int xpc_disengage_timedout;
extern int xpc_activate_IRQ_rcvd;
Expand All @@ -830,61 +887,6 @@ extern void xpc_activate_partition(struct xpc_partition *);
extern void xpc_activate_kthreads(struct xpc_channel *, int);
extern void xpc_create_kthreads(struct xpc_channel *, int, int);
extern void xpc_disconnect_wait(int);
extern int (*xpc_setup_partitions_sn) (void);
extern void (*xpc_teardown_partitions_sn) (void);
extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
unsigned long *,
size_t *);
extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
extern void (*xpc_heartbeat_init) (void);
extern void (*xpc_heartbeat_exit) (void);
extern void (*xpc_increment_heartbeat) (void);
extern void (*xpc_offline_heartbeat) (void);
extern void (*xpc_online_heartbeat) (void);
extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
extern void (*xpc_allow_hb) (short);
extern void (*xpc_disallow_hb) (short);
extern void (*xpc_disallow_all_hbs) (void);
extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
unsigned long, int);
extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
extern void (*xpc_cancel_partition_deactivation_request) (
struct xpc_partition *);
extern void (*xpc_process_activate_IRQ_rcvd) (void);
extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);

extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
extern int (*xpc_partition_engaged) (short);
extern int (*xpc_any_partition_engaged) (void);
extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
extern void (*xpc_assume_partition_disengaged) (short);

extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
extern void (*xpc_send_chctl_opencomplete) (struct xpc_channel *,
unsigned long *);

extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
unsigned long);

extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
u16, u8, xpc_notify_func, void *);
extern void (*xpc_received_payload) (struct xpc_channel *, void *);

/* found in xpc_sn2.c */
extern int xpc_init_sn2(void);
Expand Down
43 changes: 22 additions & 21 deletions trunk/drivers/misc/sgi-xp/xpc_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)

if (!(ch->flags & XPC_C_SETUP)) {
spin_unlock_irqrestore(&ch->lock, *irq_flags);
ret = xpc_setup_msg_structures(ch);
ret = xpc_arch_ops.setup_msg_structures(ch);
spin_lock_irqsave(&ch->lock, *irq_flags);

if (ret != xpSuccess)
Expand All @@ -53,15 +53,15 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)

if (!(ch->flags & XPC_C_OPENREPLY)) {
ch->flags |= XPC_C_OPENREPLY;
xpc_send_chctl_openreply(ch, irq_flags);
xpc_arch_ops.send_chctl_openreply(ch, irq_flags);
}

if (!(ch->flags & XPC_C_ROPENREPLY))
return;

if (!(ch->flags & XPC_C_OPENCOMPLETE)) {
ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED);
xpc_send_chctl_opencomplete(ch, irq_flags);
xpc_arch_ops.send_chctl_opencomplete(ch, irq_flags);
}

if (!(ch->flags & XPC_C_ROPENCOMPLETE))
Expand Down Expand Up @@ -100,7 +100,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)

if (part->act_state == XPC_P_AS_DEACTIVATING) {
/* can't proceed until the other side disengages from us */
if (xpc_partition_engaged(ch->partid))
if (xpc_arch_ops.partition_engaged(ch->partid))
return;

} else {
Expand All @@ -112,7 +112,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)

if (!(ch->flags & XPC_C_CLOSEREPLY)) {
ch->flags |= XPC_C_CLOSEREPLY;
xpc_send_chctl_closereply(ch, irq_flags);
xpc_arch_ops.send_chctl_closereply(ch, irq_flags);
}

if (!(ch->flags & XPC_C_RCLOSEREPLY))
Expand All @@ -122,7 +122,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
/* wake those waiting for notify completion */
if (atomic_read(&ch->n_to_notify) > 0) {
/* we do callout while holding ch->lock, callout can't block */
xpc_notify_senders_of_disconnect(ch);
xpc_arch_ops.notify_senders_of_disconnect(ch);
}

/* both sides are disconnected now */
Expand All @@ -136,7 +136,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
DBUG_ON(atomic_read(&ch->n_to_notify) != 0);

/* it's now safe to free the channel's message queues */
xpc_teardown_msg_structures(ch);
xpc_arch_ops.teardown_msg_structures(ch);

ch->func = NULL;
ch->key = NULL;
Expand All @@ -148,8 +148,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)

/*
* Mark the channel disconnected and clear all other flags, including
* XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but
* not including XPC_C_WDISCONNECT (if it was set).
* XPC_C_SETUP (because of call to
* xpc_arch_ops.teardown_msg_structures()) but not including
* XPC_C_WDISCONNECT (if it was set).
*/
ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));

Expand Down Expand Up @@ -395,7 +396,8 @@ xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number,
DBUG_ON(args->local_nentries == 0);
DBUG_ON(args->remote_nentries == 0);

ret = xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa);
ret = xpc_arch_ops.save_remote_msgqueue_pa(ch,
args->local_msgqueue_pa);
if (ret != xpSuccess) {
XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags);
goto out;
Expand Down Expand Up @@ -531,7 +533,7 @@ xpc_connect_channel(struct xpc_channel *ch)
/* initiate the connection */

ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING);
xpc_send_chctl_openrequest(ch, &irq_flags);
xpc_arch_ops.send_chctl_openrequest(ch, &irq_flags);

xpc_process_connect(ch, &irq_flags);

Expand All @@ -549,7 +551,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
int ch_number;
u32 ch_flags;

chctl.all_flags = xpc_get_chctl_all_flags(part);
chctl.all_flags = xpc_arch_ops.get_chctl_all_flags(part);

/*
* Initiate channel connections for registered channels.
Expand Down Expand Up @@ -598,7 +600,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
*/

if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
xpc_process_msg_chctl_flags(part, ch_number);
xpc_arch_ops.process_msg_chctl_flags(part, ch_number);
}
}

Expand Down Expand Up @@ -774,7 +776,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
XPC_C_CONNECTING | XPC_C_CONNECTED);

xpc_send_chctl_closerequest(ch, irq_flags);
xpc_arch_ops.send_chctl_closerequest(ch, irq_flags);

if (channel_was_connected)
ch->flags |= XPC_C_WASCONNECTED;
Expand Down Expand Up @@ -881,8 +883,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
DBUG_ON(payload == NULL);

if (xpc_part_ref(part)) {
ret = xpc_send_payload(&part->channels[ch_number], flags,
payload, payload_size, 0, NULL, NULL);
ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
flags, payload, payload_size, 0, NULL, NULL);
xpc_part_deref(part);
}

Expand Down Expand Up @@ -933,9 +935,8 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
DBUG_ON(func == NULL);

if (xpc_part_ref(part)) {
ret = xpc_send_payload(&part->channels[ch_number], flags,
payload, payload_size, XPC_N_CALL, func,
key);
ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
flags, payload, payload_size, XPC_N_CALL, func, key);
xpc_part_deref(part);
}
return ret;
Expand All @@ -949,7 +950,7 @@ xpc_deliver_payload(struct xpc_channel *ch)
{
void *payload;

payload = xpc_get_deliverable_payload(ch);
payload = xpc_arch_ops.get_deliverable_payload(ch);
if (payload != NULL) {

/*
Expand Down Expand Up @@ -1003,7 +1004,7 @@ xpc_initiate_received(short partid, int ch_number, void *payload)
DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);

ch = &part->channels[ch_number];
xpc_received_payload(ch, payload);
xpc_arch_ops.received_payload(ch, payload);

/* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */
xpc_msgqueue_deref(ch);
Expand Down
Loading

0 comments on commit bf16f3e

Please sign in to comment.