1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright IBM Corp. 2020
4 *
5 * Author(s): Alexandra Winter <wintera@linux.ibm.com>
6 *
7 * Interface for Channel Subsystem Call
8 */
9#ifndef _ASM_S390_CHSC_H
10#define _ASM_S390_CHSC_H
11
12#include <uapi/asm/chsc.h>
13
14/* struct from linux/notifier.h */
15struct notifier_block;
16
17/**
18 * Operation codes for CHSC PNSO:
19 *    PNSO_OC_NET_BRIDGE_INFO - only addresses that are visible to a bridgeport
20 *    PNSO_OC_NET_ADDR_INFO   - all addresses
21 */
22#define PNSO_OC_NET_BRIDGE_INFO		0
23#define PNSO_OC_NET_ADDR_INFO		3
24/**
25 * struct chsc_pnso_naid_l2 - network address information descriptor
26 * @nit:  Network interface token
27 * @addr_lnid: network address and logical network id (VLAN ID)
28 */
29struct chsc_pnso_naid_l2 {
30	u64 nit;
31	struct { u8 mac[6]; u16 lnid; } addr_lnid;
32} __packed;
33
34struct chsc_pnso_resume_token {
35	u64 t1;
36	u64 t2;
37} __packed;
38
39struct chsc_pnso_naihdr {
40	struct chsc_pnso_resume_token resume_token;
41	u32:32;
42	u32 instance;
43	u32:24;
44	u8 naids;
45	u32 reserved[3];
46} __packed;
47
48struct chsc_pnso_area {
49	struct chsc_header request;
50	u8:2;
51	u8 m:1;
52	u8:5;
53	u8:2;
54	u8 ssid:2;
55	u8 fmt:4;
56	u16 sch;
57	u8:8;
58	u8 cssid;
59	u16:16;
60	u8 oc;
61	u32:24;
62	struct chsc_pnso_resume_token resume_token;
63	u32 n:1;
64	u32:31;
65	u32 reserved[3];
66	struct chsc_header response;
67	u32:32;
68	struct chsc_pnso_naihdr naihdr;
69	struct chsc_pnso_naid_l2 entries[];
70} __packed __aligned(PAGE_SIZE);
71
72/*
73 * notifier interface - registered notifiers gets called on
74 * the following events:
75 * - ap config changed (CHSC_NOTIFY_AP_CFG)
76 */
77enum chsc_notify_type {
78	CHSC_NOTIFY_AP_CFG = 3,
79};
80
81int chsc_notifier_register(struct notifier_block *nb);
82int chsc_notifier_unregister(struct notifier_block *nb);
83
84#endif /* _ASM_S390_CHSC_H */
85