summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/nfp/nfp_cmd.h
blob: db8af0b2f9e1c0f4c519394af2f2d191f3361511 (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
/*

nfp_cmd.h: nCipher PCI HSM command driver decalrations

(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

history

10/10/2001 jsh  Original

*/

#ifndef NFPCMD_H
#define NFPCMD_H

#include "nfp_hostif.h"
#include "nfp_error.h"

/* read and write called with userspace buffer */

typedef struct nfpcmd_dev {
  const char *name;
  unsigned short vendorid, deviceid,
                 sub_vendorid, sub_deviceid;
  unsigned int bar_sizes[6];    /* includes IO bit */
  unsigned int flags;
  nfp_err (*create)(struct nfp_cdev *pdev);
  nfp_err (*destroy)(void * ctx);
  nfp_err (*open)(void * ctx);
  nfp_err (*close)(void * ctx);
  nfp_err (*isr)(void *ctx, int *handled);
  nfp_err (*write_block)( const char *ublock, int len, void *ctx );
  nfp_err (*read_block)( char *ublock, int len, void *ctx, int *rcount);
  nfp_err (*channel_update)( char *data, int len, void *ctx);
  nfp_err (*ensure_reading)( unsigned int addr, int len, void *ctx );
  nfp_err (*debug)( int cmd, void *ctx);
} nfpcmd_dev;

#define NFP_CMD_FLG_NEED_IOBUF	0x1

/* list of all supported drivers ---------------------------------------- */

extern const nfpcmd_dev *nfp_drvlist[];

extern const nfpcmd_dev i21285_cmddev;
extern const nfpcmd_dev i21555_cmddev;
extern const nfpcmd_dev bcm5820_cmddev;

#ifndef PCI_BASE_ADDRESS_SPACE_IO
#define PCI_BASE_ADDRESS_SPACE_IO	0x1
#endif

#define NFP_MAXDEV	16


#define NFP_MEMBAR_MASK    ~0xf
#define NFP_IOBAR_MASK     ~0x3
/*
   This masks off the bottom bits of the PCI_CSR_BAR which signify that the
   BAR is an IO BAR rather than a MEM BAR 
*/ 

#endif