Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright IBM Corp. 2006
0004  *
0005  * Author(s): Melissa Howland <melissah@us.ibm.com>
0006  */
0007 
0008 #ifndef _ASM_S390_APPLDATA_H
0009 #define _ASM_S390_APPLDATA_H
0010 
0011 #include <asm/diag.h>
0012 #include <asm/io.h>
0013 
0014 #define APPLDATA_START_INTERVAL_REC 0x80
0015 #define APPLDATA_STOP_REC       0x81
0016 #define APPLDATA_GEN_EVENT_REC      0x82
0017 #define APPLDATA_START_CONFIG_REC   0x83
0018 
0019 /*
0020  * Parameter list for DIAGNOSE X'DC'
0021  */
0022 struct appldata_parameter_list {
0023     u16 diag;
0024     u8  function;
0025     u8  parlist_length;
0026     u32 unused01;
0027     u16 reserved;
0028     u16 buffer_length;
0029     u32 unused02;
0030     u64 product_id_addr;
0031     u64 buffer_addr;
0032 } __attribute__ ((packed));
0033 
0034 struct appldata_product_id {
0035     char prod_nr[7];    /* product number */
0036     u16  prod_fn;       /* product function */
0037     u8   record_nr;     /* record number */
0038     u16  version_nr;    /* version */
0039     u16  release_nr;    /* release */
0040     u16  mod_lvl;       /* modification level */
0041 } __attribute__ ((packed));
0042 
0043 
0044 static inline int appldata_asm(struct appldata_parameter_list *parm_list,
0045                    struct appldata_product_id *id,
0046                    unsigned short fn, void *buffer,
0047                    unsigned short length)
0048 {
0049     int ry;
0050 
0051     if (!MACHINE_IS_VM)
0052         return -EOPNOTSUPP;
0053     parm_list->diag = 0xdc;
0054     parm_list->function = fn;
0055     parm_list->parlist_length = sizeof(*parm_list);
0056     parm_list->buffer_length = length;
0057     parm_list->product_id_addr = (unsigned long) id;
0058     parm_list->buffer_addr = virt_to_phys(buffer);
0059     diag_stat_inc(DIAG_STAT_X0DC);
0060     asm volatile(
0061         "   diag    %1,%0,0xdc"
0062         : "=d" (ry)
0063         : "d" (parm_list), "m" (*parm_list), "m" (*id)
0064         : "cc");
0065     return ry;
0066 }
0067 
0068 #endif /* _ASM_S390_APPLDATA_H */