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/drm/drm_init.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 /* drm_init.h -- Setup/Cleanup for DRM -*- linux-c -*-
    2  * Created: Mon Jan  4 08:58:31 1999 by faith@valinux.com
    3  *
    4  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
    5  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
    6  * All Rights Reserved.
    7  *
    8  * Permission is hereby granted, free of charge, to any person obtaining a
    9  * copy of this software and associated documentation files (the "Software"),
   10  * to deal in the Software without restriction, including without limitation
   11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   12  * and/or sell copies of the Software, and to permit persons to whom the
   13  * Software is furnished to do so, subject to the following conditions:
   14  *
   15  * The above copyright notice and this permission notice (including the next
   16  * paragraph) shall be included in all copies or substantial portions of the
   17  * Software.
   18  *
   19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   22  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   25  * OTHER DEALINGS IN THE SOFTWARE.
   26  *
   27  * Authors:
   28  *    Rickard E. (Rik) Faith <faith@valinux.com>
   29  *    Gareth Hughes <gareth@valinux.com>
   30  *
   31  * $FreeBSD: releng/5.0/sys/dev/drm/drm_init.h 95584 2002-04-27 20:47:57Z anholt $
   32  */
   33 
   34 #define __NO_VERSION__
   35 #include "dev/drm/drmP.h"
   36 
   37 #if 1 && DRM_DEBUG_CODE
   38 int DRM(flags) = DRM_FLAG_DEBUG;
   39 #else
   40 int DRM(flags) = 0;
   41 #endif
   42 
   43 /* drm_parse_option parses a single option.  See description for
   44  * drm_parse_options for details.
   45  */
   46 static void DRM(parse_option)(char *s)
   47 {
   48         char *c, *r;
   49 
   50         DRM_DEBUG("\"%s\"\n", s);
   51         if (!s || !*s) return;
   52         for (c = s; *c && *c != ':'; c++); /* find : or \0 */
   53         if (*c) r = c + 1; else r = NULL;  /* remember remainder */
   54         *c = '\0';                         /* terminate */
   55         if (!strcmp(s, "noctx")) {
   56                 DRM(flags) |= DRM_FLAG_NOCTX;
   57                 DRM_INFO("Server-mediated context switching OFF\n");
   58                 return;
   59         }
   60         if (!strcmp(s, "debug")) {
   61                 DRM(flags) |= DRM_FLAG_DEBUG;
   62                 DRM_INFO("Debug messages ON\n");
   63                 return;
   64         }
   65         DRM_ERROR("\"%s\" is not a valid option\n", s);
   66         return;
   67 }
   68 
   69 /* drm_parse_options parse the insmod "drm_opts=" options, or the command-line
   70  * options passed to the kernel via LILO.  The grammar of the format is as
   71  * follows:
   72  *
   73  * drm          ::= 'drm_opts=' option_list
   74  * option_list  ::= option [ ';' option_list ]
   75  * option       ::= 'device:' major
   76  *              |   'debug'
   77  *              |   'noctx'
   78  * major        ::= INTEGER
   79  *
   80  * Note that 's' contains option_list without the 'drm_opts=' part.
   81  *
   82  * device=major,minor specifies the device number used for /dev/drm
   83  *        if major == 0 then the misc device is used
   84  *        if major == 0 and minor == 0 then dynamic misc allocation is used
   85  * debug=on specifies that debugging messages will be printk'd
   86  * debug=trace specifies that each function call will be logged via printk
   87  * debug=off turns off all debugging options
   88  *
   89  */
   90 
   91 void DRM(parse_options)(char *s)
   92 {
   93         char *h, *t, *n;
   94 
   95         DRM_DEBUG("\"%s\"\n", s ?: "");
   96         if (!s || !*s) return;
   97 
   98         for (h = t = n = s; h && *h; h = n) {
   99                 for (; *t && *t != ';'; t++);          /* find ; or \0 */
  100                 if (*t) n = t + 1; else n = NULL;      /* remember next */
  101                 *t = '\0';                             /* terminate */
  102                 DRM(parse_option)(h);                  /* parse */
  103         }
  104 }
  105 
  106 /* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0
  107  * otherwise.
  108  */
  109 int DRM(cpu_valid)(void)
  110 {
  111 #ifdef __linux__
  112 #if defined(__i386__)
  113         if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
  114 #endif
  115 #if defined(__sparc__) && !defined(__sparc_v9__)
  116         return 0; /* No cmpxchg before v9 sparc. */
  117 #endif
  118 #endif /* __linux__ */
  119         return 1;
  120 }

Cache object: f34d209aebaf1682b32389ebc45dd3b1


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