📄 xp.h
字号:
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved. *//* * External Cross Partition (XP) structures and defines. */#ifndef _ASM_IA64_SN_XP_H#define _ASM_IA64_SN_XP_H#include <linux/cache.h>#include <linux/hardirq.h>#include <asm/sn/types.h>#include <asm/sn/bte.h>#ifdef USE_DBUG_ON#define DBUG_ON(condition) BUG_ON(condition)#else#define DBUG_ON(condition)#endif/* * Define the maximum number of logically defined partitions the system * can support. It is constrained by the maximum number of hardware * partitionable regions. The term 'region' in this context refers to the * minimum number of nodes that can comprise an access protection grouping. * The access protection is in regards to memory, IPI and IOI. * * The maximum number of hardware partitionable regions is equal to the * maximum number of nodes in the entire system divided by the minimum number * of nodes that comprise an access protection grouping. */#define XP_MAX_PARTITIONS 64/* * Define the number of u64s required to represent all the C-brick nasids * as a bitmap. The cross-partition kernel modules deal only with * C-brick nasids, thus the need for bitmaps which don't account for * odd-numbered (non C-brick) nasids. */#define XP_MAX_PHYSNODE_ID (MAX_NUMALINK_NODES / 2)#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8)#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64)/* * Wrapper for bte_copy() that should it return a failure status will retry * the bte_copy() once in the hope that the failure was due to a temporary * aberration (i.e., the link going down temporarily). * * See bte_copy for definition of the input parameters. * * Note: xp_bte_copy() should never be called while holding a spinlock. */static inline bte_result_txp_bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification){ bte_result_t ret; ret = bte_copy(src, dest, len, mode, notification); if (ret != BTE_SUCCESS) { if (!in_interrupt()) { cond_resched(); } ret = bte_copy(src, dest, len, mode, notification); } return ret;}/* * XPC establishes channel connections between the local partition and any * other partition that is currently up. Over these channels, kernel-level * `users' can communicate with their counterparts on the other partitions. * * The maxinum number of channels is limited to eight. For performance reasons, * the internal cross partition structures require sixteen bytes per channel, * and eight allows all of this interface-shared info to fit in one cache line. * * XPC_NCHANNELS reflects the total number of channels currently defined. * If the need for additional channels arises, one can simply increase * XPC_NCHANNELS accordingly. If the day should come where that number * exceeds the MAXIMUM number of channels allowed (eight), then one will need * to make changes to the XPC code to allow for this. */#define XPC_MEM_CHANNEL 0 /* memory channel number */#define XPC_NET_CHANNEL 1 /* network channel number */#define XPC_NCHANNELS 2 /* #of defined channels */#define XPC_MAX_NCHANNELS 8 /* max #of channels allowed */#if XPC_NCHANNELS > XPC_MAX_NCHANNELS#error XPC_NCHANNELS exceeds MAXIMUM allowed.#endif/* * The format of an XPC message is as follows: * * +-------+--------------------------------+ * | flags |////////////////////////////////| * +-------+--------------------------------+ * | message # | * +----------------------------------------+ * | payload (user-defined message) | * | | * : * | | * +----------------------------------------+ * * The size of the payload is defined by the user via xpc_connect(). A user- * defined message resides in the payload area. * * The user should have no dealings with the message header, but only the * message's payload. When a message entry is allocated (via xpc_allocate()) * a pointer to the payload area is returned and not the actual beginning of * the XPC message. The user then constructs a message in the payload area * and passes that pointer as an argument on xpc_send() or xpc_send_notify(). * * The size of a message entry (within a message queue) must be a cacheline * sized multiple in order to facilitate the BTE transfer of messages from one * message queue to another. A macro, XPC_MSG_SIZE(), is provided for the user * that wants to fit as many msg entries as possible in a given memory size * (e.g. a memory page). */struct xpc_msg { u8 flags; /* FOR XPC INTERNAL USE ONLY */ u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */ s64 number; /* FOR XPC INTERNAL USE ONLY */ u64 payload; /* user defined portion of message */};#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)#define XPC_MSG_SIZE(_payload_size) \ L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))/* * Define the return values and values passed to user's callout functions. * (It is important to add new value codes at the end just preceding * xpcUnknownReason, which must have the highest numerical value.) */enum xpc_retval { xpcSuccess = 0, xpcNotConnected, /* 1: channel is not connected */ xpcConnected, /* 2: channel connected (opened) */ xpcRETIRED1, /* 3: (formerly xpcDisconnected) */ xpcMsgReceived, /* 4: message received */ xpcMsgDelivered, /* 5: message delivered and acknowledged */ xpcRETIRED2, /* 6: (formerly xpcTransferFailed) */ xpcNoWait, /* 7: operation would require wait */ xpcRetry, /* 8: retry operation */ xpcTimeout, /* 9: timeout in xpc_allocate_msg_wait() */ xpcInterrupted, /* 10: interrupted wait */ xpcUnequalMsgSizes, /* 11: message size disparity between sides */ xpcInvalidAddress, /* 12: invalid address */ xpcNoMemory, /* 13: no memory available for XPC structures */ xpcLackOfResources, /* 14: insufficient resources for operation */ xpcUnregistered, /* 15: channel is not registered */ xpcAlreadyRegistered, /* 16: channel is already registered */ xpcPartitionDown, /* 17: remote partition is down */ xpcNotLoaded, /* 18: XPC module is not loaded */ xpcUnloading, /* 19: this side is unloading XPC module */ xpcBadMagic, /* 20: XPC MAGIC string not found */ xpcReactivating, /* 21: remote partition was reactivated */ xpcUnregistering, /* 22: this side is unregistering channel */ xpcOtherUnregistering, /* 23: other side is unregistering channel */ xpcCloneKThread, /* 24: cloning kernel thread */ xpcCloneKThreadFailed, /* 25: cloning kernel thread failed */ xpcNoHeartbeat, /* 26: remote partition has no heartbeat */ xpcPioReadError, /* 27: PIO read error */ xpcPhysAddrRegFailed, /* 28: registration of phys addr range failed */ xpcBteDirectoryError, /* 29: maps to BTEFAIL_DIR */ xpcBtePoisonError, /* 30: maps to BTEFAIL_POISON */ xpcBteWriteError, /* 31: maps to BTEFAIL_WERR */ xpcBteAccessError, /* 32: maps to BTEFAIL_ACCESS */ xpcBtePWriteError, /* 33: maps to BTEFAIL_PWERR */ xpcBtePReadError, /* 34: maps to BTEFAIL_PRERR */ xpcBteTimeOutError, /* 35: maps to BTEFAIL_TOUT */ xpcBteXtalkError, /* 36: maps to BTEFAIL_XTERR */ xpcBteNotAvailable, /* 37: maps to BTEFAIL_NOTAVAIL */ xpcBteUnmappedError, /* 38: unmapped BTEFAIL_ error */ xpcBadVersion, /* 39: bad version number */ xpcVarsNotSet, /* 40: the XPC variables are not set up */ xpcNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */ xpcInvalidPartid, /* 42: invalid partition ID */ xpcLocalPartid, /* 43: local partition ID */ xpcOtherGoingDown, /* 44: other side going down, reason unknown */ xpcSystemGoingDown, /* 45: system is going down, reason unknown */ xpcSystemHalt, /* 46: system is being halted */ xpcSystemReboot, /* 47: system is being rebooted */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -