1*e7fc5146STony Krowiak /* 2*e7fc5146STony Krowiak * Adjunct processor (AP) interfaces 3*e7fc5146STony Krowiak * 4*e7fc5146STony Krowiak * Copyright IBM Corp. 2017 5*e7fc5146STony Krowiak * 6*e7fc5146STony Krowiak * This program is free software; you can redistribute it and/or modify 7*e7fc5146STony Krowiak * it under the terms of the GNU General Public License (version 2 only) 8*e7fc5146STony Krowiak * as published by the Free Software Foundation. 9*e7fc5146STony Krowiak * 10*e7fc5146STony Krowiak * Author(s): Tony Krowiak <akrowia@linux.vnet.ibm.com> 11*e7fc5146STony Krowiak * Martin Schwidefsky <schwidefsky@de.ibm.com> 12*e7fc5146STony Krowiak * Harald Freudenberger <freude@de.ibm.com> 13*e7fc5146STony Krowiak */ 14*e7fc5146STony Krowiak 15*e7fc5146STony Krowiak #ifndef _ASM_S390_AP_H_ 16*e7fc5146STony Krowiak #define _ASM_S390_AP_H_ 17*e7fc5146STony Krowiak 18*e7fc5146STony Krowiak /** 19*e7fc5146STony Krowiak * The ap_qid_t identifier of an ap queue. 20*e7fc5146STony Krowiak * If the AP facilities test (APFT) facility is available, 21*e7fc5146STony Krowiak * card and queue index are 8 bit values, otherwise 22*e7fc5146STony Krowiak * card index is 6 bit and queue index a 4 bit value. 23*e7fc5146STony Krowiak */ 24*e7fc5146STony Krowiak typedef unsigned int ap_qid_t; 25*e7fc5146STony Krowiak 26*e7fc5146STony Krowiak #define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255)) 27*e7fc5146STony Krowiak #define AP_QID_CARD(_qid) (((_qid) >> 8) & 63) 28*e7fc5146STony Krowiak #define AP_QID_QUEUE(_qid) ((_qid) & 255) 29*e7fc5146STony Krowiak 30*e7fc5146STony Krowiak /** 31*e7fc5146STony Krowiak * struct ap_queue_status - Holds the AP queue status. 32*e7fc5146STony Krowiak * @queue_empty: Shows if queue is empty 33*e7fc5146STony Krowiak * @replies_waiting: Waiting replies 34*e7fc5146STony Krowiak * @queue_full: Is 1 if the queue is full 35*e7fc5146STony Krowiak * @irq_enabled: Shows if interrupts are enabled for the AP 36*e7fc5146STony Krowiak * @response_code: Holds the 8 bit response code 37*e7fc5146STony Krowiak * 38*e7fc5146STony Krowiak * The ap queue status word is returned by all three AP functions 39*e7fc5146STony Krowiak * (PQAP, NQAP and DQAP). There's a set of flags in the first 40*e7fc5146STony Krowiak * byte, followed by a 1 byte response code. 41*e7fc5146STony Krowiak */ 42*e7fc5146STony Krowiak struct ap_queue_status { 43*e7fc5146STony Krowiak unsigned int queue_empty : 1; 44*e7fc5146STony Krowiak unsigned int replies_waiting : 1; 45*e7fc5146STony Krowiak unsigned int queue_full : 1; 46*e7fc5146STony Krowiak unsigned int _pad1 : 4; 47*e7fc5146STony Krowiak unsigned int irq_enabled : 1; 48*e7fc5146STony Krowiak unsigned int response_code : 8; 49*e7fc5146STony Krowiak unsigned int _pad2 : 16; 50*e7fc5146STony Krowiak }; 51*e7fc5146STony Krowiak 52*e7fc5146STony Krowiak /** 53*e7fc5146STony Krowiak * ap_test_queue(): Test adjunct processor queue. 54*e7fc5146STony Krowiak * @qid: The AP queue number 55*e7fc5146STony Krowiak * @tbit: Test facilities bit 56*e7fc5146STony Krowiak * @info: Pointer to queue descriptor 57*e7fc5146STony Krowiak * 58*e7fc5146STony Krowiak * Returns AP queue status structure. 59*e7fc5146STony Krowiak */ 60*e7fc5146STony Krowiak struct ap_queue_status ap_test_queue(ap_qid_t qid, 61*e7fc5146STony Krowiak int tbit, 62*e7fc5146STony Krowiak unsigned long *info); 63*e7fc5146STony Krowiak 64*e7fc5146STony Krowiak #endif /* _ASM_S390_AP_H_ */ 65