fcx.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) fcx.c (5c2e5a0cf5b12c156b0cb07af43b51627c086480)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions for assembling fcx enabled I/O control blocks.
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
7 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/string.h>
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions for assembling fcx enabled I/O control blocks.
4 *
5 * Copyright IBM Corp. 2008
6 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
7 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/string.h>
12#include <linux/io.h>
12#include <linux/errno.h>
13#include <linux/err.h>
14#include <linux/module.h>
15#include <asm/fcx.h>
16#include "cio.h"
17
18/**
19 * tcw_get_intrg - return pointer to associated interrogate tcw
20 * @tcw: pointer to the original tcw
21 *
22 * Return a pointer to the interrogate tcw associated with the specified tcw
23 * or %NULL if there is no associated interrogate tcw.
24 */
25struct tcw *tcw_get_intrg(struct tcw *tcw)
26{
13#include <linux/errno.h>
14#include <linux/err.h>
15#include <linux/module.h>
16#include <asm/fcx.h>
17#include "cio.h"
18
19/**
20 * tcw_get_intrg - return pointer to associated interrogate tcw
21 * @tcw: pointer to the original tcw
22 *
23 * Return a pointer to the interrogate tcw associated with the specified tcw
24 * or %NULL if there is no associated interrogate tcw.
25 */
26struct tcw *tcw_get_intrg(struct tcw *tcw)
27{
27 return (struct tcw *) ((addr_t) tcw->intrg);
28 return phys_to_virt(tcw->intrg);
28}
29EXPORT_SYMBOL(tcw_get_intrg);
30
31/**
32 * tcw_get_data - return pointer to input/output data associated with tcw
33 * @tcw: pointer to the tcw
34 *
35 * Return the input or output data address specified in the tcw depending
36 * on whether the r-bit or the w-bit is set. If neither bit is set, return
37 * %NULL.
38 */
39void *tcw_get_data(struct tcw *tcw)
40{
41 if (tcw->r)
29}
30EXPORT_SYMBOL(tcw_get_intrg);
31
32/**
33 * tcw_get_data - return pointer to input/output data associated with tcw
34 * @tcw: pointer to the tcw
35 *
36 * Return the input or output data address specified in the tcw depending
37 * on whether the r-bit or the w-bit is set. If neither bit is set, return
38 * %NULL.
39 */
40void *tcw_get_data(struct tcw *tcw)
41{
42 if (tcw->r)
42 return (void *) ((addr_t) tcw->input);
43 return phys_to_virt(tcw->input);
43 if (tcw->w)
44 if (tcw->w)
44 return (void *) ((addr_t) tcw->output);
45 return phys_to_virt(tcw->output);
45 return NULL;
46}
47EXPORT_SYMBOL(tcw_get_data);
48
49/**
50 * tcw_get_tccb - return pointer to tccb associated with tcw
51 * @tcw: pointer to the tcw
52 *
53 * Return pointer to the tccb associated with this tcw.
54 */
55struct tccb *tcw_get_tccb(struct tcw *tcw)
56{
46 return NULL;
47}
48EXPORT_SYMBOL(tcw_get_data);
49
50/**
51 * tcw_get_tccb - return pointer to tccb associated with tcw
52 * @tcw: pointer to the tcw
53 *
54 * Return pointer to the tccb associated with this tcw.
55 */
56struct tccb *tcw_get_tccb(struct tcw *tcw)
57{
57 return (struct tccb *) ((addr_t) tcw->tccb);
58 return phys_to_virt(tcw->tccb);
58}
59EXPORT_SYMBOL(tcw_get_tccb);
60
61/**
62 * tcw_get_tsb - return pointer to tsb associated with tcw
63 * @tcw: pointer to the tcw
64 *
65 * Return pointer to the tsb associated with this tcw.
66 */
67struct tsb *tcw_get_tsb(struct tcw *tcw)
68{
59}
60EXPORT_SYMBOL(tcw_get_tccb);
61
62/**
63 * tcw_get_tsb - return pointer to tsb associated with tcw
64 * @tcw: pointer to the tcw
65 *
66 * Return pointer to the tsb associated with this tcw.
67 */
68struct tsb *tcw_get_tsb(struct tcw *tcw)
69{
69 return (struct tsb *) ((addr_t) tcw->tsb);
70 return phys_to_virt(tcw->tsb);
70}
71EXPORT_SYMBOL(tcw_get_tsb);
72
73/**
74 * tcw_init - initialize tcw data structure
75 * @tcw: pointer to the tcw to be initialized
76 * @r: initial value of the r-bit
77 * @w: initial value of the w-bit

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

184 * tcw_set_intrg - set the interrogate tcw address of a tcw
185 * @tcw: the tcw address
186 * @intrg_tcw: the address of the interrogate tcw
187 *
188 * Set the address of the interrogate tcw in the specified tcw.
189 */
190void tcw_set_intrg(struct tcw *tcw, struct tcw *intrg_tcw)
191{
71}
72EXPORT_SYMBOL(tcw_get_tsb);
73
74/**
75 * tcw_init - initialize tcw data structure
76 * @tcw: pointer to the tcw to be initialized
77 * @r: initial value of the r-bit
78 * @w: initial value of the w-bit

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

185 * tcw_set_intrg - set the interrogate tcw address of a tcw
186 * @tcw: the tcw address
187 * @intrg_tcw: the address of the interrogate tcw
188 *
189 * Set the address of the interrogate tcw in the specified tcw.
190 */
191void tcw_set_intrg(struct tcw *tcw, struct tcw *intrg_tcw)
192{
192 tcw->intrg = (u32) ((addr_t) intrg_tcw);
193 tcw->intrg = (u32)virt_to_phys(intrg_tcw);
193}
194EXPORT_SYMBOL(tcw_set_intrg);
195
196/**
197 * tcw_set_data - set data address and tida flag of a tcw
198 * @tcw: the tcw address
199 * @data: the data address
200 * @use_tidal: zero of the data address specifies a contiguous block of data,
201 * non-zero if it specifies a list if tidaws.
202 *
203 * Set the input/output data address of a tcw (depending on the value of the
204 * r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag
205 * is set as well.
206 */
207void tcw_set_data(struct tcw *tcw, void *data, int use_tidal)
208{
209 if (tcw->r) {
194}
195EXPORT_SYMBOL(tcw_set_intrg);
196
197/**
198 * tcw_set_data - set data address and tida flag of a tcw
199 * @tcw: the tcw address
200 * @data: the data address
201 * @use_tidal: zero of the data address specifies a contiguous block of data,
202 * non-zero if it specifies a list if tidaws.
203 *
204 * Set the input/output data address of a tcw (depending on the value of the
205 * r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag
206 * is set as well.
207 */
208void tcw_set_data(struct tcw *tcw, void *data, int use_tidal)
209{
210 if (tcw->r) {
210 tcw->input = (u64) ((addr_t) data);
211 tcw->input = virt_to_phys(data);
211 if (use_tidal)
212 tcw->flags |= TCW_FLAGS_INPUT_TIDA;
213 } else if (tcw->w) {
212 if (use_tidal)
213 tcw->flags |= TCW_FLAGS_INPUT_TIDA;
214 } else if (tcw->w) {
214 tcw->output = (u64) ((addr_t) data);
215 tcw->output = virt_to_phys(data);
215 if (use_tidal)
216 tcw->flags |= TCW_FLAGS_OUTPUT_TIDA;
217 }
218}
219EXPORT_SYMBOL(tcw_set_data);
220
221/**
222 * tcw_set_tccb - set tccb address of a tcw
223 * @tcw: the tcw address
224 * @tccb: the tccb address
225 *
226 * Set the address of the tccb in the specified tcw.
227 */
228void tcw_set_tccb(struct tcw *tcw, struct tccb *tccb)
229{
216 if (use_tidal)
217 tcw->flags |= TCW_FLAGS_OUTPUT_TIDA;
218 }
219}
220EXPORT_SYMBOL(tcw_set_data);
221
222/**
223 * tcw_set_tccb - set tccb address of a tcw
224 * @tcw: the tcw address
225 * @tccb: the tccb address
226 *
227 * Set the address of the tccb in the specified tcw.
228 */
229void tcw_set_tccb(struct tcw *tcw, struct tccb *tccb)
230{
230 tcw->tccb = (u64) ((addr_t) tccb);
231 tcw->tccb = virt_to_phys(tccb);
231}
232EXPORT_SYMBOL(tcw_set_tccb);
233
234/**
235 * tcw_set_tsb - set tsb address of a tcw
236 * @tcw: the tcw address
237 * @tsb: the tsb address
238 *
239 * Set the address of the tsb in the specified tcw.
240 */
241void tcw_set_tsb(struct tcw *tcw, struct tsb *tsb)
242{
232}
233EXPORT_SYMBOL(tcw_set_tccb);
234
235/**
236 * tcw_set_tsb - set tsb address of a tcw
237 * @tcw: the tcw address
238 * @tsb: the tsb address
239 *
240 * Set the address of the tsb in the specified tcw.
241 */
242void tcw_set_tsb(struct tcw *tcw, struct tsb *tsb)
243{
243 tcw->tsb = (u64) ((addr_t) tsb);
244 tcw->tsb = virt_to_phys(tsb);
244}
245EXPORT_SYMBOL(tcw_set_tsb);
246
247/**
248 * tccb_init - initialize tccb
249 * @tccb: the tccb address
250 * @size: the maximum size of the tccb
251 * @sac: the service-action-code to be user

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

340{
341 struct tidaw *tidaw;
342
343 /* Add tidaw to tidaw-list. */
344 tidaw = ((struct tidaw *) tcw_get_data(tcw)) + num_tidaws;
345 memset(tidaw, 0, sizeof(struct tidaw));
346 tidaw->flags = flags;
347 tidaw->count = count;
245}
246EXPORT_SYMBOL(tcw_set_tsb);
247
248/**
249 * tccb_init - initialize tccb
250 * @tccb: the tccb address
251 * @size: the maximum size of the tccb
252 * @sac: the service-action-code to be user

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

341{
342 struct tidaw *tidaw;
343
344 /* Add tidaw to tidaw-list. */
345 tidaw = ((struct tidaw *) tcw_get_data(tcw)) + num_tidaws;
346 memset(tidaw, 0, sizeof(struct tidaw));
347 tidaw->flags = flags;
348 tidaw->count = count;
348 tidaw->addr = (u64) ((addr_t) addr);
349 tidaw->addr = virt_to_phys(addr);
349 return tidaw;
350}
351EXPORT_SYMBOL(tcw_add_tidaw);
350 return tidaw;
351}
352EXPORT_SYMBOL(tcw_add_tidaw);