#define AP_DEVICES 256 /* Number of AP devices. */ #define AP_DOMAINS 256 /* Number of AP domains. */ #define AP_IOCTLS 256 /* Number of ioctls. */ #define AP_RESET_TIMEOUT (HZ*0.7) /* Time in ticks for reset timeouts. */ #define AP_CONFIG_TIME 30 /* Time in seconds between AP bus rescans. */ #define AP_POLL_TIME 1 /* Time in ticks between receive polls. */ #define AP_DEFAULT_MAX_MSG_SIZE (12 * 1024) #define AP_TAPQ_ML_FIELD_CHUNK_SIZE (4096)
/* * AP queue state machine states
*/ enum ap_sm_state {
AP_SM_STATE_RESET_START = 0,
AP_SM_STATE_RESET_WAIT,
AP_SM_STATE_SETIRQ_WAIT,
AP_SM_STATE_IDLE,
AP_SM_STATE_WORKING,
AP_SM_STATE_QUEUE_FULL,
AP_SM_STATE_ASSOC_WAIT,
NR_AP_SM_STATES
};
/* * AP queue state machine events
*/ enum ap_sm_event {
AP_SM_EVENT_POLL,
AP_SM_EVENT_TIMEOUT,
NR_AP_SM_EVENTS
};
/* * AP queue state wait behaviour
*/ enum ap_sm_wait {
AP_SM_WAIT_AGAIN = 0, /* retry immediately */
AP_SM_WAIT_HIGH_TIMEOUT, /* poll high freq, wait for timeout */
AP_SM_WAIT_LOW_TIMEOUT, /* poll low freq, wait for timeout */
AP_SM_WAIT_INTERRUPT, /* wait for thin interrupt (if available) */
AP_SM_WAIT_NONE, /* no wait */
NR_AP_SM_WAIT
};
/* * AP queue device states
*/ enum ap_dev_state {
AP_DEV_STATE_UNINITIATED = 0, /* fresh and virgin, not touched */
AP_DEV_STATE_OPERATING, /* queue dev is working normal */
AP_DEV_STATE_SHUTDOWN, /* remove/unbind/shutdown in progress */
AP_DEV_STATE_ERROR, /* device is in error state */
NR_AP_DEV_STATES
};
struct ap_device; struct ap_message;
/* * The ap driver struct includes a flags field which holds some info for * the ap bus about the driver. Currently only one flag is supported and * used: The DEFAULT flag marks an ap driver as a default driver which is * used together with the apmask and aqmask whitelisting of the ap bus.
*/ #define AP_DRIVER_FLAG_DEFAULT 0x0001
int (*probe)(struct ap_device *); void (*remove)(struct ap_device *); int (*in_use)(unsignedlong *apm, unsignedlong *aqm); /* * Called at the start of the ap bus scan function when * the crypto config information (qci) has changed. * This callback is not invoked if there is no AP * QCI support available.
*/ void (*on_config_changed)(struct ap_config_info *new_config_info, struct ap_config_info *old_config_info); /* * Called at the end of the ap bus scan function when * the crypto config information (qci) has changed. * This callback is not invoked if there is no AP * QCI support available.
*/ void (*on_scan_complete)(struct ap_config_info *new_config_info, struct ap_config_info *old_config_info);
};
struct ap_queue { struct ap_device ap_dev; struct hlist_node hnode; /* Node for the ap_queues hashtable */ struct ap_card *card; /* Ptr to assoc. AP card. */
spinlock_t lock; /* Per device lock. */ enum ap_dev_state dev_state; /* queue device state */ bool config; /* configured state */ bool chkstop; /* checkstop state */
ap_qid_t qid; /* AP queue id. */ unsignedint se_bstate; /* SE bind state (BS) */ unsignedint assoc_idx; /* SE association index */ int queue_count; /* # messages currently on AP queue. */ int pendingq_count; /* # requests on pendingq list. */ int requestq_count; /* # requests on requestq list. */
u64 total_request_count; /* # requests ever for this AP device.*/ int request_timeout; /* Request timeout in jiffies. */ struct timer_list timeout; /* Timer for request timeouts. */ struct list_head pendingq; /* List of message sent to AP queue. */ struct list_head requestq; /* List of message yet to be sent. */ struct ap_message *reply; /* Per device reply message. */ enum ap_sm_state sm_state; /* ap queue state machine state */ int rapq_fbit; /* fbit arg for next rapq invocation */ int last_err_rc; /* last error state response code */
};
/* * Get ap_queue device for this qid. * Returns ptr to the struct ap_queue device or NULL if there * was no ap_queue device with this qid found. When something is * found, the reference count of the embedded device is increased. * So the caller has to decrease the reference count after use * with a call to put_device(&aq->ap_dev.device).
*/ struct ap_queue *ap_get_qdev(ap_qid_t qid);
/* * check APQN for owned/reserved by ap bus and default driver(s). * Checks if this APQN is or will be in use by the ap bus * and the default set of drivers. * If yes, returns 1, if not returns 0. On error a negative * errno value is returned.
*/ int ap_owned_by_def_drv(int card, int queue);
/* * check 'matrix' of APQNs for owned/reserved by ap bus and * default driver(s). * Checks if there is at least one APQN in the given 'matrix' * marked as owned/reserved by the ap bus and default driver(s). * If such an APQN is found the return value is 1, otherwise * 0 is returned. On error a negative errno value is returned. * The parameter apm is a bitmask which should be declared * as DECLARE_BITMAP(apm, AP_DEVICES), the aqm parameter is * similar, should be declared as DECLARE_BITMAP(aqm, AP_DOMAINS).
*/ int ap_apqn_in_matrix_owned_by_def_drv(unsignedlong *apm, unsignedlong *aqm);
/* * ap_parse_mask_str() - helper function to parse a bitmap string * and clear/set the bits in the bitmap accordingly. The string may be * given as absolute value, a hex string like 0x1F2E3D4C5B6A" simple * overwriting the current content of the bitmap. Or as relative string * like "+1-16,-32,-0x40,+128" where only single bits or ranges of * bits are cleared or set. Distinction is done based on the very * first character which may be '+' or '-' for the relative string * and otherwise assume to be an absolute value string. If parsing fails * a negative errno value is returned. All arguments and bitmaps are * big endian order.
*/ int ap_parse_mask_str(constchar *str, unsignedlong *bitmap, int bits, struct mutex *lock);
/* * ap_hex2bitmap() - Convert a string containing a hexadecimal number (str) * into a bitmap (bitmap) with bits set that correspond to the bits represented * by the hex string. Input and output data is in big endian order. * * str - Input hex string of format "0x1234abcd". The leading "0x" is optional. * At least one digit is required. Must be large enough to hold the number of * bits represented by the bits parameter. * * bitmap - Pointer to a bitmap. Upon successful completion of this function, * this bitmap will have bits set to match the value of str. If bitmap is longer * than str, then the rightmost bits of bitmap are padded with zeros. Must be * large enough to hold the number of bits represented by the bits parameter. * * bits - Length, in bits, of the bitmap represented by str. Must be a multiple * of 8. * * Returns: 0 On success * -EINVAL If str format is invalid or bits is not a multiple of 8.
*/ int ap_hex2bitmap(constchar *str, unsignedlong *bitmap, int bits);
/* * Interface to wait for the AP bus to have done one initial ap bus * scan and all detected APQNs have been bound to device drivers. * If these both conditions are not fulfilled, this function blocks * on a condition with wait_for_completion_killable_timeout(). * If these both conditions are fulfilled (before the timeout hits) * the return value is 0. If the timeout (in jiffies) hits instead * -ETIME is returned. On failures negative return values are * returned to the caller. * It may be that the AP bus scan finds new devices. Then the * condition that all APQNs are bound to their device drivers * is reset to false and this call again blocks until either all * APQNs are bound to a device driver or the timeout hits again.
*/ int ap_wait_apqn_bindings_complete(unsignedlong timeout);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.