openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

linux-user-bde.h (3668B)


      1 /*
      2  * Copyright 2017 Broadcom
      3  * 
      4  * This program is free software; you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License, version 2, as
      6  * published by the Free Software Foundation (the "GPL").
      7  * 
      8  * This program is distributed in the hope that it will be useful, but
      9  * WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11  * General Public License version 2 (GPLv2) for more details.
     12  * 
     13  * You should have received a copy of the GNU General Public License
     14  * version 2 (GPLv2) along with this source code.
     15  */
     16 /*
     17  * $Id: linux-user-bde.h,v 1.23 Broadcom SDK $
     18  * $Copyright: (c) 2005 Broadcom Corp.
     19  * All Rights Reserved.$
     20  */
     21 
     22 #ifndef __LINUX_USER_BDE_H__
     23 #define __LINUX_USER_BDE_H__
     24 
     25 #include <linux/types.h>
     26 #include <linux/ioctl.h>
     27 #include <linux-bde.h>
     28 #ifndef __KERNEL__
     29 #include <stdint.h>
     30 #endif
     31 
     32 #if defined(SAL_BDE_32BIT_USER_64BIT_KERNEL) || defined(PTRS_ARE_64BITS)
     33 typedef uint64_t bde_kernel_addr_t;
     34 #else
     35 typedef uint32_t bde_kernel_addr_t;
     36 #endif
     37 
     38 /* Ioctl control structure */
     39 typedef struct  {
     40     unsigned int dev;   /* Device ID */
     41     unsigned int rc;    /* Operation Return Code */
     42     unsigned int d0;    /* Operation specific data */
     43     unsigned int d1;
     44     unsigned int d2;
     45     unsigned int d3;    
     46     bde_kernel_addr_t p0;
     47     union {
     48         unsigned int dw[2];
     49         unsigned char buf[64];
     50     } dx;
     51 } lubde_ioctl_t;
     52 
     53 
     54 /* LUBDE ioctls */
     55 #define LUBDE_MAGIC 'L'
     56 
     57 #define LUBDE_VERSION             _IO(LUBDE_MAGIC, 0)
     58 #define LUBDE_GET_NUM_DEVICES     _IO(LUBDE_MAGIC, 1)
     59 #define LUBDE_GET_DEVICE          _IO(LUBDE_MAGIC, 2)
     60 #define LUBDE_PCI_CONFIG_PUT32    _IO(LUBDE_MAGIC, 3)
     61 #define LUBDE_PCI_CONFIG_GET32    _IO(LUBDE_MAGIC, 4)
     62 #define LUBDE_GET_DMA_INFO        _IO(LUBDE_MAGIC, 5)
     63 #define LUBDE_ENABLE_INTERRUPTS   _IO(LUBDE_MAGIC, 6)
     64 #define LUBDE_DISABLE_INTERRUPTS  _IO(LUBDE_MAGIC, 7)
     65 #define LUBDE_USLEEP              _IO(LUBDE_MAGIC, 8)
     66 #define LUBDE_WAIT_FOR_INTERRUPT  _IO(LUBDE_MAGIC, 9)
     67 #define LUBDE_SEM_OP              _IO(LUBDE_MAGIC, 10)
     68 #define LUBDE_UDELAY              _IO(LUBDE_MAGIC, 11)
     69 #define LUBDE_GET_DEVICE_TYPE     _IO(LUBDE_MAGIC, 12)
     70 #define LUBDE_SPI_READ_REG        _IO(LUBDE_MAGIC, 13)
     71 #define LUBDE_SPI_WRITE_REG       _IO(LUBDE_MAGIC, 14)
     72 #define LUBDE_READ_REG_16BIT_BUS  _IO(LUBDE_MAGIC, 19)
     73 #define LUBDE_WRITE_REG_16BIT_BUS _IO(LUBDE_MAGIC, 20)
     74 #define LUBDE_GET_BUS_FEATURES    _IO(LUBDE_MAGIC, 21)
     75 #define LUBDE_WRITE_IRQ_MASK      _IO(LUBDE_MAGIC, 22)
     76 #define LUBDE_CPU_WRITE_REG       _IO(LUBDE_MAGIC, 23)
     77 #define LUBDE_CPU_READ_REG        _IO(LUBDE_MAGIC, 24)
     78 #define LUBDE_CPU_PCI_REGISTER    _IO(LUBDE_MAGIC, 25)
     79 #define LUBDE_DEV_RESOURCE        _IO(LUBDE_MAGIC, 26)
     80 #define LUBDE_IPROC_READ_REG      _IO(LUBDE_MAGIC, 27)
     81 #define LUBDE_IPROC_WRITE_REG     _IO(LUBDE_MAGIC, 28)
     82 #define LUBDE_ATTACH_INSTANCE     _IO(LUBDE_MAGIC, 29)
     83 #define LUBDE_GET_DEVICE_STATE    _IO(LUBDE_MAGIC, 30)
     84 #define LUBDE_REPROBE             _IO(LUBDE_MAGIC, 31)
     85 
     86 #define LUBDE_SEM_OP_CREATE       1
     87 #define LUBDE_SEM_OP_DESTROY      2
     88 #define LUBDE_SEM_OP_TAKE         3
     89 #define LUBDE_SEM_OP_GIVE         4
     90 
     91 #define LUBDE_SUCCESS 0
     92 #define LUBDE_FAIL ((unsigned int)-1)
     93 
     94 
     95 /* 
     96  * Version history
     97  * 1: add LUBDE_GET_DEVICE_STATE to support PCI hot plug 
     98  * 2: add LUBDE_REPROBE to support reprobe available devices
     99  */
    100 #define KBDE_VERSION    2
    101 
    102 
    103 /* This is the signal that will be used
    104  * when an interrupt occurs
    105  */
    106 
    107 #ifndef __KERNEL__
    108 #include <signal.h>
    109 #endif
    110 
    111 #define LUBDE_INTERRUPT_SIGNAL    SIGUSR1
    112 #define LUBDE_ETHER_INTERRUPT_SIGNAL    SIGUSR2
    113 
    114 #endif /* __LUBDE_H__ */