1 // SPDX-License-Identifier: GPL-2.0
3 * s390 crypto adapter related sclp functions.
5 * Copyright IBM Corp. 2020
7 #define KMSG_COMPONENT "sclp_cmd"
8 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10 #include <linux/export.h>
11 #include <linux/slab.h>
15 #define SCLP_CMDW_CONFIGURE_AP 0x001f0001
16 #define SCLP_CMDW_DECONFIGURE_AP 0x001e0001
19 struct sccb_header header
;
22 static int do_ap_configure(sclp_cmdw_t cmd
, u32 apid
)
24 struct ap_cfg_sccb
*sccb
;
27 if (!SCLP_HAS_AP_RECONFIG
)
30 sccb
= (struct ap_cfg_sccb
*) get_zeroed_page(GFP_KERNEL
| GFP_DMA
);
34 sccb
->header
.length
= PAGE_SIZE
;
35 cmd
|= (apid
& 0xFF) << 8;
36 rc
= sclp_sync_request(cmd
, sccb
);
39 switch (sccb
->header
.response_code
) {
40 case 0x0020: case 0x0120: case 0x0440: case 0x0450:
43 pr_warn("configure AP adapter %u failed: cmd=0x%08x response=0x%04x\n",
44 apid
, cmd
, sccb
->header
.response_code
);
49 free_page((unsigned long) sccb
);
53 int sclp_ap_configure(u32 apid
)
55 return do_ap_configure(SCLP_CMDW_CONFIGURE_AP
, apid
);
57 EXPORT_SYMBOL(sclp_ap_configure
);
59 int sclp_ap_deconfigure(u32 apid
)
61 return do_ap_configure(SCLP_CMDW_DECONFIGURE_AP
, apid
);
63 EXPORT_SYMBOL(sclp_ap_deconfigure
);