| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* Copyright IBM Corp. 2006 |
| 4 |
* |
| 5 |
* Author(s): Melissa Howland <[email protected]> |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef _ASM_S390_APPLDATA_H |
| 9 |
#define _ASM_S390_APPLDATA_H |
| 10 |
|
| 11 |
#include <linux/io.h> |
| 12 |
#include <asm/machine.h> |
| 13 |
#include <asm/diag.h> |
| 14 |
|
| 15 |
#define APPLDATA_START_INTERVAL_REC 0x80 |
| 16 |
#define APPLDATA_STOP_REC 0x81 |
| 17 |
#define APPLDATA_GEN_EVENT_REC 0x82 |
| 18 |
#define APPLDATA_START_CONFIG_REC 0x83 |
| 19 |
|
| 20 |
/* |
| 21 |
* Parameter list for DIAGNOSE X'DC' |
| 22 |
*/ |
| 23 |
struct appldata_parameter_list { |
| 24 |
u16 diag; |
| 25 |
u8 function; |
| 26 |
u8 parlist_length; |
| 27 |
u32 unused01; |
| 28 |
u16 reserved; |
| 29 |
u16 buffer_length; |
| 30 |
u32 unused02; |
| 31 |
u64 product_id_addr; |
| 32 |
u64 buffer_addr; |
| 33 |
} __attribute__ ((packed)); |
| 34 |
|
| 35 |
struct appldata_product_id { |
| 36 |
char prod_nr[7]; /* product number */ |
| 37 |
u16 prod_fn; /* product function */ |
| 38 |
u8 record_nr; /* record number */ |
| 39 |
u16 version_nr; /* version */ |
| 40 |
u16 release_nr; /* release */ |
| 41 |
u16 mod_lvl; /* modification level */ |
| 42 |
} __attribute__ ((packed)); |
| 43 |
|
| 44 |
|
| 45 |
static inline int appldata_asm(struct appldata_parameter_list *parm_list, |
| 46 |
struct appldata_product_id *id, |
| 47 |
unsigned short fn, void *buffer, |
| 48 |
unsigned short length) |
| 49 |
{ |
| 50 |
int ry; |
| 51 |
|
| 52 |
if (!machine_is_vm()) |
| 53 |
return -EOPNOTSUPP; |
| 54 |
parm_list->diag = 0xdc; |
| 55 |
parm_list->function = fn; |
| 56 |
parm_list->parlist_length = sizeof(*parm_list); |
| 57 |
parm_list->buffer_length = length; |
| 58 |
parm_list->product_id_addr = virt_to_phys(id); |
| 59 |
parm_list->buffer_addr = virt_to_phys(buffer); |
| 60 |
diag_stat_inc(DIAG_STAT_X0DC); |
| 61 |
asm volatile( |
| 62 |
" diag %1,%0,0xdc" |
| 63 |
: "=d" (ry) |
| 64 |
: "d" (virt_to_phys(parm_list)), "m" (*parm_list), "m" (*id) |
| 65 |
: "cc"); |
| 66 |
return ry; |
| 67 |
} |
| 68 |
|
| 69 |
#endif /* _ASM_S390_APPLDATA_H */ |