Linux 2.6.26-rc5
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / scsi / scsi_netlink.h
blob8c1470cc82096631cb370f1069c619ebf1a2ca54
1 /*
2 * SCSI Transport Netlink Interface
3 * Used for the posting of outbound SCSI transport events
5 * Copyright (C) 2006 James Smart, Emulex Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef SCSI_NETLINK_H
23 #define SCSI_NETLINK_H
26 * This file intended to be included by both kernel and user space
29 /* Single Netlink Message type to send all SCSI Transport messages */
30 #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
32 /* SCSI Transport Broadcast Groups */
33 /* leaving groups 0 and 1 unassigned */
34 #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
35 #define SCSI_NL_GRP_CNT 3
38 /* SCSI_TRANSPORT_MSG event message header */
39 struct scsi_nl_hdr {
40 uint8_t version;
41 uint8_t transport;
42 uint16_t magic;
43 uint16_t msgtype;
44 uint16_t msglen;
45 } __attribute__((aligned(sizeof(uint64_t))));
47 /* scsi_nl_hdr->version value */
48 #define SCSI_NL_VERSION 1
50 /* scsi_nl_hdr->magic value */
51 #define SCSI_NL_MAGIC 0xA1B2
53 /* scsi_nl_hdr->transport value */
54 #define SCSI_NL_TRANSPORT 0
55 #define SCSI_NL_TRANSPORT_FC 1
56 #define SCSI_NL_MAX_TRANSPORTS 2
58 /* scsi_nl_hdr->msgtype values are defined in each transport */
62 * Vendor ID:
63 * If transports post vendor-unique events, they must pass a well-known
64 * 32-bit vendor identifier. This identifier consists of 8 bits indicating
65 * the "type" of identifier contained, and 24 bits of id data.
67 * Identifiers for each type:
68 * PCI : ID data is the 16 bit PCI Registered Vendor ID
70 #define SCSI_NL_VID_TYPE_SHIFT 56
71 #define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
72 #define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
73 #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
76 #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
77 { \
78 (hdr)->version = SCSI_NL_VERSION; \
79 (hdr)->transport = t; \
80 (hdr)->magic = SCSI_NL_MAGIC; \
81 (hdr)->msgtype = mtype; \
82 (hdr)->msglen = mlen; \
86 #endif /* SCSI_NETLINK_H */