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/arm/include/platformvar.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 /*-
    2  * Copyright (c) 2005 Peter Grehan
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 #ifndef _MACHINE_PLATFORMVAR_H_
   30 #define _MACHINE_PLATFORMVAR_H_
   31 
   32 /*
   33  * An ARM platform implementation is declared with a kernel object and
   34  * an associated method table, similar to a device driver.
   35  *
   36  * e.g.
   37  *
   38  * static platform_method_t bcm2835_methods[] = {
   39  *      PLATFORMMETHOD(platform_probe,          bcm2835_probe),
   40  *  ...
   41  *      PLATFORMMETHOD_END
   42  * };
   43  *
   44  * static platform_def_t bcm3835_platform = {
   45  *      "bcm2835",
   46  *      bcm2835_methods,
   47  *      sizeof(bcm2835_platform_softc), // or 0 if no softc
   48  * };
   49  *
   50  * PLATFORM_DEF(bcm2835_platform);
   51  */
   52 
   53 #include <sys/kobj.h>
   54 #include <sys/linker_set.h>
   55 
   56 struct platform_class {
   57         KOBJ_CLASS_FIELDS;
   58 
   59         /* How many times to loop to delay approximately 1us */
   60         int delay_count;
   61 };
   62 
   63 struct platform_kobj {
   64         /*
   65          * A platform instance is a kernel object
   66          */
   67         KOBJ_FIELDS;
   68 
   69         /* Platform class, for access to class specific data */
   70         struct platform_class *cls;
   71 };
   72 
   73 typedef struct platform_kobj    *platform_t;
   74 typedef struct platform_class   platform_def_t;
   75 #define platform_method_t       kobj_method_t
   76 
   77 #define PLATFORMMETHOD          KOBJMETHOD
   78 #define PLATFORMMETHOD_END      KOBJMETHOD_END
   79 
   80 #define PLATFORM_DEF(name)      DATA_SET(platform_set, name)
   81 
   82 #ifdef FDT
   83 struct fdt_platform_class {
   84         KOBJ_CLASS_FIELDS;
   85 
   86         const char *fdt_compatible;
   87 };
   88 
   89 typedef struct fdt_platform_class fdt_platform_def_t;
   90 
   91 extern platform_method_t fdt_platform_methods[];
   92 
   93 #define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, _size, _compatible, \
   94     _delay)                                                             \
   95 CTASSERT(_delay > 0);                                                   \
   96 static fdt_platform_def_t VAR_NAME ## _fdt_platform = {                 \
   97         .name = NAME_STR,                                               \
   98         .methods = fdt_platform_methods,                                \
   99         .fdt_compatible = _compatible,                                  \
  100 };                                                                      \
  101 static kobj_class_t VAR_NAME ## _baseclasses[] =                        \
  102         { (kobj_class_t)&VAR_NAME ## _fdt_platform, NULL };             \
  103 static platform_def_t VAR_NAME ## _platform = {                         \
  104         .name = NAME_STR,                                               \
  105         .methods = NAME ## _methods,                                    \
  106         .size = _size,                                                  \
  107         .baseclasses = VAR_NAME ## _baseclasses,                        \
  108         .delay_count = _delay,                                          \
  109 };                                                                      \
  110 DATA_SET(platform_set, VAR_NAME ## _platform)
  111 
  112 #define FDT_PLATFORM_DEF(NAME, NAME_STR, size, compatible, delay)       \
  113     FDT_PLATFORM_DEF2(NAME, NAME, NAME_STR, size, compatible, delay)
  114 
  115 #endif
  116 
  117 /*
  118  * Helper to get the platform object
  119  */
  120 platform_t platform_obj(void);
  121 
  122 bool arm_tmr_timed_wait(platform_t, int);
  123 
  124 #endif /* _MACHINE_PLATFORMVAR_H_ */

Cache object: 20ff97f59501947f921b5994510ad364


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