Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
b05fd35
Documentation
arch
block
crypto
drivers
accessibility
acpi
amba
ata
atm
auxdisplay
base
block
bluetooth
cdrom
char
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma
edac
eisa
firewire
firmware
gpio
gpu
hid
hwmon
i2c
ide
idle
ieee1394
ieee802154
infiniband
input
isdn
leds
lguest
macintosh
mca
md
media
memstick
message
mfd
misc
mmc
mtd
net
nubus
of
oprofile
parisc
parport
pci
pcmcia
platform
pnp
power
pps
ps3
rapidio
regulator
rtc
s390
block
char
Kconfig
Makefile
con3215.c
con3270.c
ctrlchar.c
ctrlchar.h
defkeymap.c
defkeymap.map
fs3270.c
keyboard.c
keyboard.h
monreader.c
monwriter.c
raw3270.c
raw3270.h
sclp.c
sclp.h
sclp_async.c
sclp_cmd.c
sclp_con.c
sclp_config.c
sclp_cpi.c
sclp_cpi_sys.c
sclp_cpi_sys.h
sclp_quiesce.c
sclp_rw.c
sclp_rw.h
sclp_sdias.c
sclp_tty.c
sclp_tty.h
sclp_vt220.c
tape.h
tape_34xx.c
tape_3590.c
tape_3590.h
tape_block.c
tape_char.c
tape_class.c
tape_class.h
tape_core.c
tape_proc.c
tape_std.c
tape_std.h
tty3270.c
tty3270.h
vmcp.c
vmcp.h
vmlogrdr.c
vmur.c
vmur.h
vmwatchdog.c
zcore.c
cio
crypto
kvm
net
scsi
Makefile
sbus
scsi
serial
sfi
sh
sn
spi
ssb
staging
tc
telephony
thermal
uio
usb
uwb
video
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
drivers
/
s390
/
char
/
sclp_async.c
Copy path
Blame
Blame
Latest commit
History
History
212 lines (195 loc) · 5.04 KB
Breadcrumbs
linux
/
drivers
/
s390
/
char
/
sclp_async.c
Top
File metadata and controls
Code
Blame
212 lines (195 loc) · 5.04 KB
Raw
/* * Enable Asynchronous Notification via SCLP. * * Copyright IBM Corp. 2009 * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com> * */ #include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/kmod.h> #include <linux/err.h> #include <linux/errno.h> #include <linux/proc_fs.h> #include <linux/sysctl.h> #include <linux/utsname.h> #include "sclp.h" static int callhome_enabled; static struct sclp_req *request; static struct sclp_async_sccb *sccb; static int sclp_async_send_wait(char *message); static struct ctl_table_header *callhome_sysctl_header; static DEFINE_SPINLOCK(sclp_async_lock); #define SCLP_NORMAL_WRITE 0x00 struct async_evbuf { struct evbuf_header header; u64 reserved; u8 rflags; u8 empty; u8 rtype; u8 otype; char comp_id[12]; char data[3000]; /* there is still some space left */ } __attribute__((packed)); struct sclp_async_sccb { struct sccb_header header; struct async_evbuf evbuf; } __attribute__((packed)); static struct sclp_register sclp_async_register = { .send_mask = EVTYP_ASYNC_MASK, }; static int call_home_on_panic(struct notifier_block *self, unsigned long event, void *data) { strncat(data, init_utsname()->nodename, sizeof(init_utsname()->nodename)); sclp_async_send_wait(data); return NOTIFY_DONE; } static struct notifier_block call_home_panic_nb = { .notifier_call = call_home_on_panic, .priority = INT_MAX, }; static int proc_handler_callhome(struct ctl_table *ctl, int write, void __user *buffer, size_t *count, loff_t *ppos) { unsigned long val; int len, rc; char buf[3]; if (!*count || (*ppos && !write)) { *count = 0; return 0; } if (!write) { len = snprintf(buf, sizeof(buf), "%d\n", callhome_enabled); rc = copy_to_user(buffer, buf, sizeof(buf)); if (rc != 0) return -EFAULT; } else { len = *count; rc = copy_from_user(buf, buffer, sizeof(buf)); if (rc != 0) return -EFAULT; if (strict_strtoul(buf, 0, &val) != 0) return -EINVAL; if (val != 0 && val != 1) return -EINVAL; callhome_enabled = val; } *count = len; *ppos += len; return 0; } static struct ctl_table callhome_table[] = { { .procname = "callhome", .mode = 0644, .proc_handler = proc_handler_callhome, }, {} }; static struct ctl_table kern_dir_table[] = { { .procname = "kernel", .maxlen = 0, .mode = 0555, .child = callhome_table, }, {} }; /* * Function used to transfer asynchronous notification * records which waits for send completion */ static int sclp_async_send_wait(char *message) { struct async_evbuf *evb; int rc; unsigned long flags; if (!callhome_enabled) return 0; sccb->evbuf.header.type = EVTYP_ASYNC; sccb->evbuf.rtype = 0xA5; sccb->evbuf.otype = 0x00; evb = &sccb->evbuf; request->command = SCLP_CMDW_WRITE_EVENT_DATA; request->sccb = sccb; request->status = SCLP_REQ_FILLED; strncpy(sccb->evbuf.data, message, sizeof(sccb->evbuf.data)); /* * Retain Queue * e.g. 5639CC140 500 Red Hat RHEL5 Linux for zSeries (RHEL AS) */ strncpy(sccb->evbuf.comp_id, "000000000", sizeof(sccb->evbuf.comp_id)); sccb->evbuf.header.length = sizeof(sccb->evbuf); sccb->header.length = sizeof(sccb->evbuf) + sizeof(sccb->header); sccb->header.function_code = SCLP_NORMAL_WRITE; rc = sclp_add_request(request); if (rc) return rc; spin_lock_irqsave(&sclp_async_lock, flags); while (request->status != SCLP_REQ_DONE && request->status != SCLP_REQ_FAILED) { sclp_sync_wait(); } spin_unlock_irqrestore(&sclp_async_lock, flags); if (request->status != SCLP_REQ_DONE) return -EIO; rc = ((struct sclp_async_sccb *) request->sccb)->header.response_code; if (rc != 0x0020) return -EIO; if (evb->header.flags != 0x80) return -EIO; return rc; } static int __init sclp_async_init(void) { int rc; rc = sclp_register(&sclp_async_register); if (rc) return rc; rc = -EOPNOTSUPP; if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) goto out_sclp; rc = -ENOMEM; callhome_sysctl_header = register_sysctl_table(kern_dir_table); if (!callhome_sysctl_header) goto out_sclp; request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL); sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!request || !sccb) goto out_mem; rc = atomic_notifier_chain_register(&panic_notifier_list, &call_home_panic_nb); if (!rc) goto out; out_mem: kfree(request); free_page((unsigned long) sccb); unregister_sysctl_table(callhome_sysctl_header); out_sclp: sclp_unregister(&sclp_async_register); out: return rc; } module_init(sclp_async_init); static void __exit sclp_async_exit(void) { atomic_notifier_chain_unregister(&panic_notifier_list, &call_home_panic_nb); unregister_sysctl_table(callhome_sysctl_header); sclp_unregister(&sclp_async_register); free_page((unsigned long) sccb); kfree(request); } module_exit(sclp_async_exit); MODULE_AUTHOR("Copyright IBM Corp. 2009"); MODULE_AUTHOR("Hans-Joachim Picht <hans@linux.vnet.ibm.com>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCLP Asynchronous Notification Records");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
You can’t perform that action at this time.