The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/qat/include/common/qat_freebsd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* SPDX-License-Identifier: BSD-3-Clause */
    2 /* Copyright(c) 2007-2022 Intel Corporation */
    3 /* $FreeBSD$ */
    4 #ifndef QAT_FREEBSD_H_
    5 #define QAT_FREEBSD_H_
    6 
    7 #include <sys/param.h>
    8 #include <sys/module.h>
    9 #include <sys/bus.h>
   10 #include <sys/param.h>
   11 #include <sys/malloc.h>
   12 #include <sys/firmware.h>
   13 #include <sys/rman.h>
   14 #include <sys/types.h>
   15 #include <sys/ctype.h>
   16 #include <sys/ioccom.h>
   17 #include <sys/param.h>
   18 #include <sys/lock.h>
   19 #include <linux/device.h>
   20 #include <linux/dma-mapping.h>
   21 #include <linux/completion.h>
   22 #include <linux/list.h>
   23 #include <machine/bus.h>
   24 #include <machine/bus_dma.h>
   25 #include <sys/firmware.h>
   26 #include <asm/uaccess.h>
   27 #include <linux/math64.h>
   28 #include <linux/spinlock.h>
   29 
   30 #define PCI_VENDOR_ID_INTEL 0x8086
   31 
   32 #if !defined(__bool_true_false_are_defined)
   33 #define __bool_true_false_are_defined 1
   34 #define false 0
   35 #define true 1
   36 #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
   37 typedef int _Bool;
   38 #endif
   39 typedef _Bool bool;
   40 #endif /* !__bool_true_false_are_defined && !__cplusplus */
   41 
   42 #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
   43 typedef int _Bool;
   44 #endif
   45 
   46 #define pause_ms(wmesg, ms) pause_sbt(wmesg, (ms)*SBT_1MS, 0, C_HARDCLOCK)
   47 
   48 /* Function sets the MaxPayload size of a PCI device. */
   49 int pci_set_max_payload(device_t dev, int payload_size);
   50 
   51 device_t pci_find_pf(device_t vf);
   52 
   53 MALLOC_DECLARE(M_QAT);
   54 
   55 struct msix_entry {
   56         struct resource *irq;
   57         void *cookie;
   58 };
   59 
   60 struct pci_device_id {
   61         uint16_t vendor;
   62         uint16_t device;
   63 };
   64 
   65 struct bus_dmamem {
   66         bus_dma_tag_t dma_tag;
   67         bus_dmamap_t dma_map;
   68         void *dma_vaddr;
   69         bus_addr_t dma_baddr;
   70 };
   71 
   72 /*
   73  * Allocate a mapping.  On success, zero is returned and the 'dma_vaddr'
   74  * and 'dma_baddr' fields are populated with the virtual and bus addresses,
   75  * respectively, of the mapping.
   76  */
   77 int bus_dma_mem_create(struct bus_dmamem *mem,
   78                        bus_dma_tag_t parent,
   79                        bus_size_t alignment,
   80                        bus_addr_t lowaddr,
   81                        bus_size_t len,
   82                        int flags);
   83 
   84 /*
   85  * Release a mapping created by bus_dma_mem_create().
   86  */
   87 void bus_dma_mem_free(struct bus_dmamem *mem);
   88 
   89 #define list_for_each_prev_safe(p, n, h)                                       \
   90         for (p = (h)->prev, n = (p)->prev; p != (h); p = n, n = (p)->prev)
   91 
   92 static inline int
   93 compat_strtoul(const char *cp, unsigned int base, unsigned long *res)
   94 {
   95         char *end;
   96 
   97         *res = strtoul(cp, &end, base);
   98 
   99         /* skip newline character, if any */
  100         if (*end == '\n')
  101                 end++;
  102         if (*cp == 0 || *end != 0)
  103                 return (-EINVAL);
  104         return (0);
  105 }
  106 
  107 static inline int
  108 compat_strtouint(const char *cp, unsigned int base, unsigned int *res)
  109 {
  110         char *end;
  111         unsigned long temp;
  112 
  113         *res = temp = strtoul(cp, &end, base);
  114 
  115         /* skip newline character, if any */
  116         if (*end == '\n')
  117                 end++;
  118         if (*cp == 0 || *end != 0)
  119                 return (-EINVAL);
  120         if (temp != (unsigned int)temp)
  121                 return (-ERANGE);
  122         return (0);
  123 }
  124 
  125 static inline int
  126 compat_strtou8(const char *cp, unsigned int base, unsigned char *res)
  127 {
  128         char *end;
  129         unsigned long temp;
  130 
  131         *res = temp = strtoul(cp, &end, base);
  132 
  133         /* skip newline character, if any */
  134         if (*end == '\n')
  135                 end++;
  136         if (*cp == 0 || *end != 0)
  137                 return -EINVAL;
  138         if (temp != (unsigned char)temp)
  139                 return -ERANGE;
  140         return 0;
  141 }
  142 
  143 #if __FreeBSD_version >= 1300500
  144 #undef dev_to_node
  145 static inline int
  146 dev_to_node(device_t dev)
  147 {
  148         int numa_domain;
  149 
  150         if (!dev || bus_get_domain(dev, &numa_domain) != 0)
  151                 return (-1);
  152         else
  153                 return (numa_domain);
  154 }
  155 #endif
  156 #endif

Cache object: 224938d73aeae61f1a075e1bd53f00db


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.