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/qat_common/adf_freebsd_cfg_dev_dbg.c

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 #include "qat_freebsd.h"
    5 #include "adf_common_drv.h"
    6 #include "adf_cfg_device.h"
    7 #include "adf_cfg_dev_dbg.h"
    8 #include <sys/bus.h>
    9 #include <sys/libkern.h>
   10 #include <sys/lock.h>
   11 #include <sys/kernel.h>
   12 #include <sys/sbuf.h>
   13 #include <sys/sx.h>
   14 #include <sys/systm.h>
   15 #include <sys/malloc.h>
   16 
   17 static int qat_dev_cfg_show(SYSCTL_HANDLER_ARGS)
   18 {
   19         struct adf_cfg_device_data *dev_cfg;
   20         struct adf_cfg_section *sec;
   21         struct adf_cfg_key_val *ptr;
   22         struct sbuf sb;
   23         int error;
   24 
   25         sbuf_new_for_sysctl(&sb, NULL, 128, req);
   26         dev_cfg = arg1;
   27         sx_slock(&dev_cfg->lock);
   28         list_for_each_entry(sec, &dev_cfg->sec_list, list)
   29         {
   30                 sbuf_printf(&sb, "[%s]\n", sec->name);
   31                 list_for_each_entry(ptr, &sec->param_head, list)
   32                 {
   33                         sbuf_printf(&sb, "%s = %s\n", ptr->key, ptr->val);
   34                 }
   35         }
   36         sx_sunlock(&dev_cfg->lock);
   37         error = sbuf_finish(&sb);
   38         sbuf_delete(&sb);
   39         return error;
   40 }
   41 
   42 int
   43 adf_cfg_dev_dbg_add(struct adf_accel_dev *accel_dev)
   44 {
   45         struct adf_cfg_device_data *dev_cfg_data = accel_dev->cfg;
   46         device_t dev;
   47 
   48         dev = GET_DEV(accel_dev);
   49         dev_cfg_data->debug =
   50             SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
   51                             SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
   52                             OID_AUTO,
   53                             "dev_cfg",
   54                             CTLFLAG_RD | CTLTYPE_STRING,
   55                             dev_cfg_data,
   56                             0,
   57                             qat_dev_cfg_show,
   58                             "A",
   59                             "Device configuration");
   60 
   61         if (!dev_cfg_data->debug) {
   62                 device_printf(dev, "Failed to create qat cfg sysctl.\n");
   63                 return ENXIO;
   64         }
   65         return 0;
   66 }
   67 
   68 void
   69 adf_cfg_dev_dbg_remove(struct adf_accel_dev *accel_dev)
   70 {
   71         struct adf_cfg_device_data *dev_cfg_data = accel_dev->cfg;
   72 
   73         if (dev_cfg_data->dev) {
   74                 adf_cfg_device_clear(dev_cfg_data->dev, accel_dev);
   75                 free(dev_cfg_data->dev, M_QAT);
   76                 dev_cfg_data->dev = NULL;
   77         }
   78 }

Cache object: e44158fdb688f477ba55da78370c045f


[ 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.