summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/nfp/nfdev-common.h
blob: 8a97bf2c639490ebad65b191ff36d470da711b51 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*

(C) Copyright nCipher Corporation Ltd 2002-2008 All rights reserved

Copyright (c) 2008-2013 Thales e-Security All rights reserved

Copyright (c) 2014 Thales UK All rights reserved

*/
/** \file nfdev-common.h
 *
 * \brief nFast device driver (not generic SCSI) ioctl struct definition file
 *  include NFDEV-$(system) for ioctl number definitions
 *
 *  1998.07.13	jsh	Started
 *
 * 
 */

#ifndef NFDEV_COMMON_H
#define NFDEV_COMMON_H

/**
 * Result of the ENQUIRY ioctl.
 */
typedef struct nfdev_enquiry_str {
  unsigned int  busno; /**< Which bus is the PCI device on. */
  unsigned char slotno; /**< Which slot is the PCI device in. */
  unsigned char reserved[3]; /**< for consistant struct alignment */
} nfdev_enquiry_str;

/**
 * Result of the STATS ioctl.
 */
typedef struct nfdev_stats_str {
  unsigned long  isr; /**< Count interrupts. */
  unsigned long  isr_read; /**< Count read interrupts. */
  unsigned long  isr_write; /**< Count write interrupts. */
  unsigned long  write_fail; /**< Count write failures. */
  unsigned long  write_block; /**< Count blocks written. */
  unsigned long  write_byte; /**< Count bytes written. */
  unsigned long  read_fail; /**< Count read failures. */
  unsigned long  read_block; /**< Count blocks read. */
  unsigned long  read_byte; /**< Count bytes read. */
  unsigned long  ensure_fail; /**< Count read request failures. */
  unsigned long  ensure; /**< Count read requests. */
} nfdev_stats_str;

/**
 * Input to the CONTROL ioctl.
 */
typedef struct nfdev_control_str {
  unsigned control; /**< Control flags. */
} nfdev_control_str;

/** Control bit indicating host supports MOI control */
#define NFDEV_CONTROL_HOST_MOI 0x0001

/** Index of control bits indicating desired mode
 *
 * Desired mode follows the M_ModuleMode enumeration.
 */
#define NFDEV_CONTROL_MODE_SHIFT 1

/** Detect a backwards-compatible control value
 *
 * Returns true if the request control value "makes no difference", i.e.
 * and the failure of an attempt to set it is therefore uninteresting.
 */
#define NFDEV_CONTROL_HARMLESS(c) ((c) <= 1)

/**
 * Result of the STATUS ioctl.
 */
typedef struct nfdev_status_str {
  unsigned  status; /**< Status flags. */
  char      error[8]; /**< Error string. */
} nfdev_status_str;

/** Monitor firmware supports MOI control and error reporting */
#define NFDEV_STATUS_MONITOR_MOI 0x0001

/** Application firmware supports MOI control and error reporting */
#define NFDEV_STATUS_APPLICATION_MOI 0x0002

/** Application firmware running and supports error reporting */
#define NFDEV_STATUS_APPLICATION_RUNNING 0x0004

/** HSM failed
 *
 * Consult error[] for additional information.
 */
#define NFDEV_STATUS_FAILED 0x0008

/** Standard PCI interface. */
#define NFDEV_IF_STANDARD	0x01

/** PCI interface with results pushed from device
 *  via DMA.
 */
#define NFDEV_IF_PCI_PUSH	0x02

/* platform independant base ioctl numbers */

/** Enquiry ioctl.
 *  \return nfdev_enquiry_str describing the attached device. */
#define NFDEV_IOCTL_NUM_ENQUIRY        0x01
/** Channel Update ioctl.
 *  \deprecated */
#define NFDEV_IOCTL_NUM_CHUPDATE       0x02
/** Ensure Reading ioctl.
 *  Signal a read request to the device.
 *  \param (unsigned int) Length of data to be read.
 */
#define NFDEV_IOCTL_NUM_ENSUREREADING  0x03
/** Device Count ioctl.
 *  Not implemented for on all platforms.
 *  \return (int) the number of attached devices. */
#define NFDEV_IOCTL_NUM_DEVCOUNT       0x04
/** Internal Debug ioctl.
 *  Not implemented in release drivers. */
#define NFDEV_IOCTL_NUM_DEBUG          0x05
/** PCI Interface Version ioctl.
 *  \param (int) Maximum PCI interface version
 *   supported by the user of the device. */
#define NFDEV_IOCTL_NUM_PCI_IFVERS     0x06
/** Statistics ioctl.
 *  \return nfdev_enquiry_str describing the attached device. */
#define NFDEV_IOCTL_NUM_STATS          0x07

/** Module control ioctl
 * \param (nfdev_control_str) Value to write to HSM control register
 */
#define NFDEV_IOCTL_NUM_CONTROL        0x08

/** Module state ioctl
 * \return (nfdev_status_str) Values read from HSM status/error registers
 */
#define NFDEV_IOCTL_NUM_STATUS         0x09

#endif