OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [drm-4.0/] [init.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* init.c -- Setup/Cleanup for DRM -*- linux-c -*-
2
 * Created: Mon Jan  4 08:58:31 1999 by faith@precisioninsight.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
 * PRECISION INSIGHT 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 OTHER
25
 * DEALINGS IN THE SOFTWARE.
26
 *
27
 * Authors:
28
 *    Rickard E. (Rik) Faith <faith@valinux.com>
29
 *
30
 */
31
 
32
#define __NO_VERSION__
33
#include "drmP.h"
34
 
35
int                           drm_flags         = 0;
36
 
37
/* drm_parse_option parses a single option.  See description for
38
   drm_parse_options for details. */
39
 
40
static void drm_parse_option(char *s)
41
{
42
        char *c, *r;
43
 
44
        DRM_DEBUG("\"%s\"\n", s);
45
        if (!s || !*s) return;
46
        for (c = s; *c && *c != ':'; c++); /* find : or \0 */
47
        if (*c) r = c + 1; else r = NULL;  /* remember remainder */
48
        *c = '\0';                         /* terminate */
49
        if (!strcmp(s, "noctx")) {
50
                drm_flags |= DRM_FLAG_NOCTX;
51
                DRM_INFO("Server-mediated context switching OFF\n");
52
                return;
53
        }
54
        if (!strcmp(s, "debug")) {
55
                drm_flags |= DRM_FLAG_DEBUG;
56
                DRM_INFO("Debug messages ON\n");
57
                return;
58
        }
59
        DRM_ERROR("\"%s\" is not a valid option\n", s);
60
        return;
61
}
62
 
63
/* drm_parse_options parse the insmod "drm=" options, or the command-line
64
 * options passed to the kernel via LILO.  The grammar of the format is as
65
 * follows:
66
 *
67
 * drm          ::= 'drm=' option_list
68
 * option_list  ::= option [ ';' option_list ]
69
 * option       ::= 'device:' major
70
 *              |   'debug'
71
 *              |   'noctx'
72
 * major        ::= INTEGER
73
 *
74
 * Note that 's' contains option_list without the 'drm=' part.
75
 *
76
 * device=major,minor specifies the device number used for /dev/drm
77
 *        if major == 0 then the misc device is used
78
 *        if major == 0 and minor == 0 then dynamic misc allocation is used
79
 * debug=on specifies that debugging messages will be printk'd
80
 * debug=trace specifies that each function call will be logged via printk
81
 * debug=off turns off all debugging options
82
 *
83
 */
84
 
85
void drm_parse_options(char *s)
86
{
87
        char *h, *t, *n;
88
 
89
        DRM_DEBUG("\"%s\"\n", s ?: "");
90
        if (!s || !*s) return;
91
 
92
        for (h = t = n = s; h && *h; h = n) {
93
                for (; *t && *t != ';'; t++);          /* find ; or \0 */
94
                if (*t) n = t + 1; else n = NULL;      /* remember next */
95
                *t = '\0';                             /* terminate */
96
                drm_parse_option(h);                   /* parse */
97
        }
98
}
99
 
100
/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0
101
 * otherwise. */
102
 
103
int drm_cpu_valid(void)
104
{
105
#if defined(__i386__)
106
        if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
107
#endif
108
#if defined(__sparc__) && !defined(__sparc_v9__)
109
        if (1)
110
                return 0; /* No cmpxchg before v9 sparc. */
111
#endif
112
        return 1;
113
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.