FreeBSD kernel CXGBE device code
osdep.h File Reference
#include <sys/cdefs.h>
#include <sys/ctype.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/endian.h>
#include <sys/systm.h>
#include <sys/syslog.h>
#include <dev/pci/pcireg.h>
Include dependency graph for osdep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CH_ERR(adap, fmt, ...)
 
#define CH_WARN(adap, fmt, ...)
 
#define CH_ALERT(adap, fmt, ...)
 
#define CH_WARN_RATELIMIT(adap, fmt, ...)
 
#define __BIG_ENDIAN_BITFIELD
 
#define false   FALSE
 
#define true   TRUE
 
#define __force
 
#define mdelay(x)   DELAY((x) * 1000)
 
#define udelay(x)   DELAY(x)
 
#define simple_strtoul   strtoul
 
#define DIV_ROUND_UP(x, y)   howmany(x, y)
 
#define ARRAY_SIZE(x)   nitems(x)
 
#define container_of(p, s, f)   ((s *)(((uint8_t *)(p)) - offsetof(s, f)))
 
#define swab16(x)   bswap16(x)
 
#define swab32(x)   bswap32(x)
 
#define swab64(x)   bswap64(x)
 
#define le16_to_cpu(x)   le16toh(x)
 
#define le32_to_cpu(x)   le32toh(x)
 
#define le64_to_cpu(x)   le64toh(x)
 
#define cpu_to_le16(x)   htole16(x)
 
#define cpu_to_le32(x)   htole32(x)
 
#define cpu_to_le64(x)   htole64(x)
 
#define be16_to_cpu(x)   be16toh(x)
 
#define be32_to_cpu(x)   be32toh(x)
 
#define be64_to_cpu(x)   be64toh(x)
 
#define cpu_to_be16(x)   htobe16(x)
 
#define cpu_to_be32(x)   htobe32(x)
 
#define cpu_to_be64(x)   htobe64(x)
 
#define DUPLEX_HALF   0
 
#define DUPLEX_FULL   1
 
#define AUTONEG_AUTO   (-1)
 
#define AUTONEG_DISABLE   0
 
#define AUTONEG_ENABLE   1
 
#define PCI_DEVICE_ID   PCIR_DEVICE
 
#define PCI_CAP_ID_VPD   PCIY_VPD
 
#define PCI_VPD_ADDR   PCIR_VPD_ADDR
 
#define PCI_VPD_ADDR_F   0x8000
 
#define PCI_VPD_DATA   PCIR_VPD_DATA
 
#define PCI_CAP_ID_EXP   PCIY_EXPRESS
 
#define PCI_EXP_DEVCTL   PCIER_DEVICE_CTL
 
#define PCI_EXP_DEVCTL_PAYLOAD   PCIEM_CTL_MAX_PAYLOAD
 
#define PCI_EXP_DEVCTL_READRQ   PCIEM_CTL_MAX_READ_REQUEST
 
#define PCI_EXP_LNKCTL   PCIER_LINK_CTL
 
#define PCI_EXP_LNKSTA   PCIER_LINK_STA
 
#define PCI_EXP_LNKSTA_CLS   PCIEM_LINK_STA_SPEED
 
#define PCI_EXP_LNKSTA_NLW   PCIEM_LINK_STA_WIDTH
 
#define PCI_EXP_DEVCTL2   PCIER_DEVICE_CTL2
 

Typedefs

typedef int8_t s8
 
typedef int16_t s16
 
typedef int32_t s32
 
typedef int64_t s64
 
typedef uint8_t u8
 
typedef uint16_t u16
 
typedef uint32_t u32
 
typedef uint64_t u64
 
typedef uint8_t __u8
 
typedef uint16_t __u16
 
typedef uint32_t __u32
 
typedef uint64_t __u64
 
typedef uint8_t __be8
 
typedef uint16_t __be16
 
typedef uint32_t __be32
 
typedef uint64_t __be64
 
typedef boolean_t bool
 

Functions

static int ilog2 (long x)
 
static char * strstrip (char *s)
 

Macro Definition Documentation

◆ __BIG_ENDIAN_BITFIELD

#define __BIG_ENDIAN_BITFIELD

Definition at line 73 of file osdep.h.

◆ __force

#define __force

Definition at line 86 of file osdep.h.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   x)    nitems(x)

Definition at line 94 of file osdep.h.

◆ AUTONEG_AUTO

#define AUTONEG_AUTO   (-1)

Definition at line 115 of file osdep.h.

◆ AUTONEG_DISABLE

#define AUTONEG_DISABLE   0

Definition at line 116 of file osdep.h.

◆ AUTONEG_ENABLE

#define AUTONEG_ENABLE   1

Definition at line 117 of file osdep.h.

◆ be16_to_cpu

#define be16_to_cpu (   x)    be16toh(x)

Definition at line 106 of file osdep.h.

◆ be32_to_cpu

#define be32_to_cpu (   x)    be32toh(x)

Definition at line 107 of file osdep.h.

◆ be64_to_cpu

#define be64_to_cpu (   x)    be64toh(x)

Definition at line 108 of file osdep.h.

◆ CH_ALERT

#define CH_ALERT (   adap,
  fmt,
  ... 
)
Value:
log(LOG_ALERT, "%s: " fmt, \
device_get_nameunit((adap)->dev), ##__VA_ARGS__)

Definition at line 49 of file osdep.h.

◆ CH_ERR

#define CH_ERR (   adap,
  fmt,
  ... 
)
Value:
log(LOG_ERR, "%s: " fmt, \
device_get_nameunit((adap)->dev), ##__VA_ARGS__)

Definition at line 45 of file osdep.h.

◆ CH_WARN

#define CH_WARN (   adap,
  fmt,
  ... 
)
Value:
log(LOG_WARNING, "%s: " fmt, \
device_get_nameunit((adap)->dev), ##__VA_ARGS__)

Definition at line 47 of file osdep.h.

◆ CH_WARN_RATELIMIT

#define CH_WARN_RATELIMIT (   adap,
  fmt,
  ... 
)
Value:
log(LOG_WARNING, "%s: " fmt, \
device_get_nameunit((adap)->dev), ##__VA_ARGS__)

Definition at line 51 of file osdep.h.

◆ container_of

#define container_of (   p,
  s,
 
)    ((s *)(((uint8_t *)(p)) - offsetof(s, f)))

Definition at line 95 of file osdep.h.

◆ cpu_to_be16

#define cpu_to_be16 (   x)    htobe16(x)

Definition at line 109 of file osdep.h.

◆ cpu_to_be32

#define cpu_to_be32 (   x)    htobe32(x)

Definition at line 110 of file osdep.h.

◆ cpu_to_be64

#define cpu_to_be64 (   x)    htobe64(x)

Definition at line 111 of file osdep.h.

◆ cpu_to_le16

#define cpu_to_le16 (   x)    htole16(x)

Definition at line 103 of file osdep.h.

◆ cpu_to_le32

#define cpu_to_le32 (   x)    htole32(x)

Definition at line 104 of file osdep.h.

◆ cpu_to_le64

#define cpu_to_le64 (   x)    htole64(x)

Definition at line 105 of file osdep.h.

◆ DIV_ROUND_UP

#define DIV_ROUND_UP (   x,
 
)    howmany(x, y)

Definition at line 92 of file osdep.h.

◆ DUPLEX_FULL

#define DUPLEX_FULL   1

Definition at line 114 of file osdep.h.

◆ DUPLEX_HALF

#define DUPLEX_HALF   0

Definition at line 113 of file osdep.h.

◆ false

#define false   FALSE

Definition at line 82 of file osdep.h.

◆ le16_to_cpu

#define le16_to_cpu (   x)    le16toh(x)

Definition at line 100 of file osdep.h.

◆ le32_to_cpu

#define le32_to_cpu (   x)    le32toh(x)

Definition at line 101 of file osdep.h.

◆ le64_to_cpu

#define le64_to_cpu (   x)    le64toh(x)

Definition at line 102 of file osdep.h.

◆ mdelay

#define mdelay (   x)    DELAY((x) * 1000)

Definition at line 88 of file osdep.h.

◆ PCI_CAP_ID_EXP

#define PCI_CAP_ID_EXP   PCIY_EXPRESS

Definition at line 125 of file osdep.h.

◆ PCI_CAP_ID_VPD

#define PCI_CAP_ID_VPD   PCIY_VPD

Definition at line 120 of file osdep.h.

◆ PCI_DEVICE_ID

#define PCI_DEVICE_ID   PCIR_DEVICE

Definition at line 119 of file osdep.h.

◆ PCI_EXP_DEVCTL

#define PCI_EXP_DEVCTL   PCIER_DEVICE_CTL

Definition at line 126 of file osdep.h.

◆ PCI_EXP_DEVCTL2

#define PCI_EXP_DEVCTL2   PCIER_DEVICE_CTL2

Definition at line 133 of file osdep.h.

◆ PCI_EXP_DEVCTL_PAYLOAD

#define PCI_EXP_DEVCTL_PAYLOAD   PCIEM_CTL_MAX_PAYLOAD

Definition at line 127 of file osdep.h.

◆ PCI_EXP_DEVCTL_READRQ

#define PCI_EXP_DEVCTL_READRQ   PCIEM_CTL_MAX_READ_REQUEST

Definition at line 128 of file osdep.h.

◆ PCI_EXP_LNKCTL

#define PCI_EXP_LNKCTL   PCIER_LINK_CTL

Definition at line 129 of file osdep.h.

◆ PCI_EXP_LNKSTA

#define PCI_EXP_LNKSTA   PCIER_LINK_STA

Definition at line 130 of file osdep.h.

◆ PCI_EXP_LNKSTA_CLS

#define PCI_EXP_LNKSTA_CLS   PCIEM_LINK_STA_SPEED

Definition at line 131 of file osdep.h.

◆ PCI_EXP_LNKSTA_NLW

#define PCI_EXP_LNKSTA_NLW   PCIEM_LINK_STA_WIDTH

Definition at line 132 of file osdep.h.

◆ PCI_VPD_ADDR

#define PCI_VPD_ADDR   PCIR_VPD_ADDR

Definition at line 121 of file osdep.h.

◆ PCI_VPD_ADDR_F

#define PCI_VPD_ADDR_F   0x8000

Definition at line 122 of file osdep.h.

◆ PCI_VPD_DATA

#define PCI_VPD_DATA   PCIR_VPD_DATA

Definition at line 123 of file osdep.h.

◆ simple_strtoul

#define simple_strtoul   strtoul

Definition at line 91 of file osdep.h.

◆ swab16

#define swab16 (   x)    bswap16(x)

Definition at line 97 of file osdep.h.

◆ swab32

#define swab32 (   x)    bswap32(x)

Definition at line 98 of file osdep.h.

◆ swab64

#define swab64 (   x)    bswap64(x)

Definition at line 99 of file osdep.h.

◆ true

#define true   TRUE

Definition at line 83 of file osdep.h.

◆ udelay

#define udelay (   x)    DELAY(x)

Definition at line 89 of file osdep.h.

Typedef Documentation

◆ __be16

typedef uint16_t __be16

Definition at line 68 of file osdep.h.

◆ __be32

typedef uint32_t __be32

Definition at line 69 of file osdep.h.

◆ __be64

typedef uint64_t __be64

Definition at line 70 of file osdep.h.

◆ __be8

typedef uint8_t __be8

Definition at line 67 of file osdep.h.

◆ __u16

typedef uint16_t __u16

Definition at line 64 of file osdep.h.

◆ __u32

typedef uint32_t __u32

Definition at line 65 of file osdep.h.

◆ __u64

typedef uint64_t __u64

Definition at line 66 of file osdep.h.

◆ __u8

typedef uint8_t __u8

Definition at line 63 of file osdep.h.

◆ bool

typedef boolean_t bool

Definition at line 81 of file osdep.h.

◆ s16

typedef int16_t s16

Definition at line 56 of file osdep.h.

◆ s32

typedef int32_t s32

Definition at line 57 of file osdep.h.

◆ s64

typedef int64_t s64

Definition at line 58 of file osdep.h.

◆ s8

typedef int8_t s8

Definition at line 55 of file osdep.h.

◆ u16

typedef uint16_t u16

Definition at line 60 of file osdep.h.

◆ u32

typedef uint32_t u32

Definition at line 61 of file osdep.h.

◆ u64

typedef uint64_t u64

Definition at line 62 of file osdep.h.

◆ u8

typedef uint8_t u8

Definition at line 59 of file osdep.h.

Function Documentation

◆ ilog2()

static int ilog2 ( long  x)
inlinestatic

Definition at line 136 of file osdep.h.

Referenced by alloc_iq_fl_hwq(), fatal_error_task(), qsize_to_fthresh(), setup_memwin(), setup_pad_and_pack_boundaries(), stop_adapter(), and t4_fatal_err().

Here is the caller graph for this function:

◆ strstrip()

static char * strstrip ( char *  s)
inlinestatic

Definition at line 144 of file osdep.h.

References r.

Referenced by get_vpd_params().

Here is the caller graph for this function: