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/sis_ds.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 /* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*-
    2  * Created: Mon Jan  4 10:05:05 1999 by sclin@sis.com.tw
    3  */
    4 /*-
    5  * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
    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  *    Sung-Ching Lin <sclin@sis.com.tw>
   29  *
   30  */
   31 
   32 #include <sys/cdefs.h>
   33 __FBSDID("$FreeBSD: releng/9.0/sys/dev/drm/sis_ds.h 157617 2006-04-09 20:45:45Z anholt $");
   34 
   35 #ifndef __SIS_DS_H__
   36 #define __SIS_DS_H__
   37 
   38 /* Set Data Structure */
   39 
   40 #define SET_SIZE 5000
   41 
   42 typedef unsigned long ITEM_TYPE;
   43 
   44 typedef struct {
   45         ITEM_TYPE val;
   46         int alloc_next, free_next;
   47 } list_item_t;
   48 
   49 typedef struct {
   50         int alloc;
   51         int free;
   52         int trace;
   53         list_item_t list[SET_SIZE];
   54 } set_t;
   55 
   56 set_t *setInit(void);
   57 int setAdd(set_t * set, ITEM_TYPE item);
   58 int setDel(set_t * set, ITEM_TYPE item);
   59 int setFirst(set_t * set, ITEM_TYPE * item);
   60 int setNext(set_t * set, ITEM_TYPE * item);
   61 int setDestroy(set_t * set);
   62 
   63 /*
   64  * GLX Hardware Device Driver common code
   65  * Copyright (C) 1999 Wittawat Yamwong
   66  *
   67  * Permission is hereby granted, free of charge, to any person obtaining a
   68  * copy of this software and associated documentation files (the "Software"),
   69  * to deal in the Software without restriction, including without limitation
   70  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   71  * and/or sell copies of the Software, and to permit persons to whom the
   72  * Software is furnished to do so, subject to the following conditions:
   73  *
   74  * The above copyright notice and this permission notice shall be included
   75  * in all copies or substantial portions of the Software.
   76  *
   77  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   78  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   79  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   80  * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
   81  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
   82  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
   83  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   84  *
   85  */
   86 
   87 struct mem_block_t {
   88         struct mem_block_t *next;
   89         struct mem_block_t *heap;
   90         int ofs, size;
   91         int align;
   92         unsigned int free:1;
   93         unsigned int reserved:1;
   94 };
   95 typedef struct mem_block_t TMemBlock;
   96 typedef struct mem_block_t *PMemBlock;
   97 
   98 /* a heap is just the first block in a chain */
   99 typedef struct mem_block_t memHeap_t;
  100 
  101 static __inline__ int mmBlockSize(PMemBlock b)
  102 {
  103         return b->size;
  104 }
  105 
  106 static __inline__ int mmOffset(PMemBlock b)
  107 {
  108         return b->ofs;
  109 }
  110 
  111 static __inline__ void mmMarkReserved(PMemBlock b)
  112 {
  113         b->reserved = 1;
  114 }
  115 
  116 /*
  117  * input: total size in bytes
  118  * return: a heap pointer if OK, NULL if error
  119  */
  120 memHeap_t *mmInit(int ofs, int size);
  121 
  122 /*
  123  * Allocate 'size' bytes with 2^align2 bytes alignment,
  124  * restrict the search to free memory after 'startSearch'
  125  * depth and back buffers should be in different 4mb banks
  126  * to get better page hits if possible
  127  * input:       size = size of block
  128  *              align2 = 2^align2 bytes alignment
  129  *              startSearch = linear offset from start of heap to begin search
  130  * return: pointer to the allocated block, 0 if error
  131  */
  132 PMemBlock mmAllocMem(memHeap_t * heap, int size, int align2, int startSearch);
  133 
  134 /*
  135  * Returns 1 if the block 'b' is part of the heap 'heap'
  136  */
  137 int mmBlockInHeap(PMemBlock heap, PMemBlock b);
  138 
  139 /*
  140  * Free block starts at offset
  141  * input: pointer to a block
  142  * return: 0 if OK, -1 if error
  143  */
  144 int mmFreeMem(PMemBlock b);
  145 
  146 /* For debuging purpose. */
  147 void mmDumpMemInfo(memHeap_t * mmInit);
  148 
  149 #endif                          /* __SIS_DS_H__ */

Cache object: 75146ecf2efcecf79e5afa1b8f64ceff


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