ap_bus.h (9095bf25ea08135a5b74875dd0e3eeaddc4218a0) ap_bus.h (e7fc5146cfe4f1b10f2ed6c36b65248aa948abe8)
1/*
2 * Copyright IBM Corp. 2006, 2012
3 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Ralph Wuerthner <rwuerthn@de.ibm.com>
6 * Felix Beck <felix.beck@de.ibm.com>
7 * Holger Dengler <hd@linux.vnet.ibm.com>
8 *

--- 14 unchanged lines hidden (view full) ---

23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#ifndef _AP_BUS_H_
27#define _AP_BUS_H_
28
29#include <linux/device.h>
30#include <linux/types.h>
1/*
2 * Copyright IBM Corp. 2006, 2012
3 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Ralph Wuerthner <rwuerthn@de.ibm.com>
6 * Felix Beck <felix.beck@de.ibm.com>
7 * Holger Dengler <hd@linux.vnet.ibm.com>
8 *

--- 14 unchanged lines hidden (view full) ---

23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#ifndef _AP_BUS_H_
27#define _AP_BUS_H_
28
29#include <linux/device.h>
30#include <linux/types.h>
31#include <asm/ap.h>
31
32#define AP_DEVICES 64 /* Number of AP devices. */
33#define AP_DOMAINS 256 /* Number of AP domains. */
34#define AP_RESET_TIMEOUT (HZ*0.7) /* Time in ticks for reset timeouts. */
35#define AP_CONFIG_TIME 30 /* Time in seconds between AP bus rescans. */
36#define AP_POLL_TIME 1 /* Time in ticks between receive polls. */
37
38extern int ap_domain_index;
39
40extern spinlock_t ap_list_lock;
41extern struct list_head ap_card_list;
42
32
33#define AP_DEVICES 64 /* Number of AP devices. */
34#define AP_DOMAINS 256 /* Number of AP domains. */
35#define AP_RESET_TIMEOUT (HZ*0.7) /* Time in ticks for reset timeouts. */
36#define AP_CONFIG_TIME 30 /* Time in seconds between AP bus rescans. */
37#define AP_POLL_TIME 1 /* Time in ticks between receive polls. */
38
39extern int ap_domain_index;
40
41extern spinlock_t ap_list_lock;
42extern struct list_head ap_card_list;
43
43/**
44 * The ap_qid_t identifier of an ap queue. It contains a
45 * 6 bit card index and a 4 bit queue index (domain).
46 */
47typedef unsigned int ap_qid_t;
48
49#define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255))
50#define AP_QID_CARD(_qid) (((_qid) >> 8) & 63)
51#define AP_QID_QUEUE(_qid) ((_qid) & 255)
52
53/**
54 * structy ap_queue_status - Holds the AP queue status.
55 * @queue_empty: Shows if queue is empty
56 * @replies_waiting: Waiting replies
57 * @queue_full: Is 1 if the queue is full
58 * @pad: A 4 bit pad
59 * @int_enabled: Shows if interrupts are enabled for the AP
60 * @response_code: Holds the 8 bit response code
61 * @pad2: A 16 bit pad
62 *
63 * The ap queue status word is returned by all three AP functions
64 * (PQAP, NQAP and DQAP). There's a set of flags in the first
65 * byte, followed by a 1 byte response code.
66 */
67struct ap_queue_status {
68 unsigned int queue_empty : 1;
69 unsigned int replies_waiting : 1;
70 unsigned int queue_full : 1;
71 unsigned int pad1 : 4;
72 unsigned int int_enabled : 1;
73 unsigned int response_code : 8;
74 unsigned int pad2 : 16;
75} __packed;
76
77
78static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
79{
80 return (*ptr & (0x80000000u >> nr)) != 0;
81}
82
83#define AP_RESPONSE_NORMAL 0x00
84#define AP_RESPONSE_Q_NOT_AVAIL 0x01
85#define AP_RESPONSE_RESET_IN_PROGRESS 0x02

--- 219 unchanged lines hidden ---
44static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
45{
46 return (*ptr & (0x80000000u >> nr)) != 0;
47}
48
49#define AP_RESPONSE_NORMAL 0x00
50#define AP_RESPONSE_Q_NOT_AVAIL 0x01
51#define AP_RESPONSE_RESET_IN_PROGRESS 0x02

--- 219 unchanged lines hidden ---