^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * SCLP Event Type (ET) 7 - Diagnostic Test FTP Services, useable on LPAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright IBM Corp. 2013
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Author(s): Ralf Hoppe (rhoppe@de.ibm.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define KMSG_COMPONENT "hmcdrv"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/wait.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/jiffies.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/sysinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/ebcdic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "sclp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "sclp_diag.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "sclp_ftp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static DECLARE_COMPLETION(sclp_ftp_rx_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static u8 sclp_ftp_ldflg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static u64 sclp_ftp_fsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static u64 sclp_ftp_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * sclp_ftp_txcb() - Diagnostic Test FTP services SCLP command callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static void sclp_ftp_txcb(struct sclp_req *req, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct completion *completion = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) pr_debug("SCLP (ET7) TX-IRQ, SCCB @ 0x%p: %*phN\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) req->sccb, 24, req->sccb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) complete(completion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * sclp_ftp_rxcb() - Diagnostic Test FTP services receiver event callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static void sclp_ftp_rxcb(struct evbuf_header *evbuf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct sclp_diag_evbuf *diag = (struct sclp_diag_evbuf *) evbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * Check for Diagnostic Test FTP Service
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (evbuf->type != EVTYP_DIAG_TEST ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) diag->route != SCLP_DIAG_FTP_ROUTE ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) diag->mdd.ftp.pcx != SCLP_DIAG_FTP_XPCX ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) evbuf->length < SCLP_DIAG_FTP_EVBUF_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) pr_debug("SCLP (ET7) RX-IRQ, Event @ 0x%p: %*phN\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) evbuf, 24, evbuf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * Because the event buffer is located in a page which is owned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * by the SCLP core, all data of interest must be copied. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * error indication is in 'sclp_ftp_ldflg'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) sclp_ftp_ldflg = diag->mdd.ftp.ldflg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) sclp_ftp_fsize = diag->mdd.ftp.fsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) sclp_ftp_length = diag->mdd.ftp.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) complete(&sclp_ftp_rx_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * sclp_ftp_et7() - start a Diagnostic Test FTP Service SCLP request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * @ftp: pointer to FTP descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * Return: 0 on success, else a (negative) error code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static int sclp_ftp_et7(const struct hmcdrv_ftp_cmdspec *ftp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct completion completion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct sclp_diag_sccb *sccb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct sclp_req *req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) size_t len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) req = kzalloc(sizeof(*req), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) if (!req || !sccb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) rc = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) sccb->hdr.length = SCLP_DIAG_FTP_EVBUF_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) sizeof(struct sccb_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) sccb->evbuf.hdr.type = EVTYP_DIAG_TEST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) sccb->evbuf.hdr.length = SCLP_DIAG_FTP_EVBUF_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) sccb->evbuf.hdr.flags = 0; /* clear processed-buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) sccb->evbuf.route = SCLP_DIAG_FTP_ROUTE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) sccb->evbuf.mdd.ftp.pcx = SCLP_DIAG_FTP_XPCX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) sccb->evbuf.mdd.ftp.srcflg = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) sccb->evbuf.mdd.ftp.pgsize = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) sccb->evbuf.mdd.ftp.asce = _ASCE_REAL_SPACE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) sccb->evbuf.mdd.ftp.ldflg = SCLP_DIAG_FTP_LDFAIL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) sccb->evbuf.mdd.ftp.fsize = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) sccb->evbuf.mdd.ftp.cmd = ftp->id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) sccb->evbuf.mdd.ftp.offset = ftp->ofs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) sccb->evbuf.mdd.ftp.length = ftp->len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) sccb->evbuf.mdd.ftp.bufaddr = virt_to_phys(ftp->buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) len = strlcpy(sccb->evbuf.mdd.ftp.fident, ftp->fname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) HMCDRV_FTP_FIDENT_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (len >= HMCDRV_FTP_FIDENT_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) req->command = SCLP_CMDW_WRITE_EVENT_DATA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) req->sccb = sccb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) req->status = SCLP_REQ_FILLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) req->callback = sclp_ftp_txcb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) req->callback_data = &completion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) init_completion(&completion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) rc = sclp_add_request(req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /* Wait for end of ftp sclp command. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) wait_for_completion(&completion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) pr_debug("status of SCLP (ET7) request is 0x%04x (0x%02x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) sccb->hdr.response_code, sccb->evbuf.hdr.flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * Check if sclp accepted the request. The data transfer runs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * asynchronously and the completion is indicated with an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * sclp ET7 event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (req->status != SCLP_REQ_DONE ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) (sccb->evbuf.hdr.flags & 0x80) == 0 || /* processed-buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) (sccb->hdr.response_code & 0xffU) != 0x20U) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) rc = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) free_page((unsigned long) sccb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) kfree(req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * sclp_ftp_cmd() - executes a HMC related SCLP Diagnose (ET7) FTP command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * @ftp: pointer to FTP command specification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * @fsize: return of file size (or NULL if undesirable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * Attention: Notice that this function is not reentrant - so the caller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * must ensure locking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * Return: number of bytes read/written or a (negative) error code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ssize_t sclp_ftp_cmd(const struct hmcdrv_ftp_cmdspec *ftp, size_t *fsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) ssize_t len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) unsigned long start_jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) pr_debug("starting SCLP (ET7), cmd %d for '%s' at %lld with %zd bytes\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ftp->id, ftp->fname, (long long) ftp->ofs, ftp->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) start_jiffies = jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) init_completion(&sclp_ftp_rx_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /* Start ftp sclp command. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) len = sclp_ftp_et7(ftp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) if (len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) goto out_unlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * There is no way to cancel the sclp ET7 request, the code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * needs to wait unconditionally until the transfer is complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) wait_for_completion(&sclp_ftp_rx_complete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) pr_debug("completed SCLP (ET7) request after %lu ms (all)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) (jiffies - start_jiffies) * 1000 / HZ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) pr_debug("return code of SCLP (ET7) FTP Service is 0x%02x, with %lld/%lld bytes\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) sclp_ftp_ldflg, sclp_ftp_length, sclp_ftp_fsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) switch (sclp_ftp_ldflg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) case SCLP_DIAG_FTP_OK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) len = sclp_ftp_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (fsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) *fsize = sclp_ftp_fsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) case SCLP_DIAG_FTP_LDNPERM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) len = -EPERM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) case SCLP_DIAG_FTP_LDRUNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) len = -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) case SCLP_DIAG_FTP_LDFAIL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) len = -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) len = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) out_unlock:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * ET7 event listener
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static struct sclp_register sclp_ftp_event = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .send_mask = EVTYP_DIAG_TEST_MASK, /* want tx events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) .receive_mask = EVTYP_DIAG_TEST_MASK, /* want rx events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) .receiver_fn = sclp_ftp_rxcb, /* async callback (rx) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) .state_change_fn = NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) .pm_event_fn = NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * sclp_ftp_startup() - startup of FTP services, when running on LPAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) int sclp_ftp_startup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) unsigned long info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) rc = sclp_register(&sclp_ftp_event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) #ifdef DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) info = get_zeroed_page(GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) if (info != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if (!stsi(info222, 2, 2, 2)) { /* get SYSIB 2.2.2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) info222->name[sizeof(info222->name) - 1] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) EBCASC_500(info222->name, sizeof(info222->name) - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) pr_debug("SCLP (ET7) FTP Service working on LPAR %u (%s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) info222->lpar_number, info222->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) free_page(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #endif /* DEBUG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * sclp_ftp_shutdown() - shutdown of FTP services, when running on LPAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) void sclp_ftp_shutdown(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) sclp_unregister(&sclp_ftp_event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }