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/hptrr/osm.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) HighPoint Technologies, Inc.
    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: releng/6.3/sys/dev/hptrr/osm.h 174616 2007-12-15 06:32:34Z scottl $
   27  */
   28 #include <dev/hptrr/hptrr_config.h>
   29 /*
   30  * $Id: osm.h,v 1.5 2005/08/18 05:17:43 gmm Exp $
   31  * Copyright (C) 2005 HighPoint Technologies, Inc. All rights reserved.
   32  */
   33 #ifndef _HPT_OSM_H_
   34 #define _HPT_OSM_H_
   35 
   36 #define VERMAGIC_OSM 5
   37 
   38 #define os_max_queue_comm 32
   39 #define os_max_sg_descriptors 18
   40 
   41 
   42 #define DMAPOOL_PAGE_SIZE 0x1000 /* PAGE_SIZE (i386/x86_64) */
   43 #define os_max_cache_size 0x800000 /* 8MB */
   44 #define os_max_cache_pages (os_max_cache_size/DMAPOOL_PAGE_SIZE)
   45 
   46 /* data types */
   47 typedef unsigned int HPT_UINT, HPT_U32;
   48 typedef unsigned long HPT_UPTR;
   49 typedef unsigned short HPT_U16;
   50 typedef unsigned char HPT_U8;
   51 typedef unsigned long HPT_TIME;
   52 typedef unsigned long long HPT_U64;
   53 
   54 #define CPU_TO_LE64(x) (x)
   55 #define CPU_TO_LE32(x) (x)
   56 #define CPU_TO_LE16(x) (x)
   57 #define LE32_TO_CPU(x) (x)
   58 #define LE16_TO_CPU(x) (x)
   59 #define LE64_TO_CPU(x) (x)
   60 
   61 #define FAR
   62 #define EXTERN_C
   63 
   64 typedef void * HPT_PTR;
   65 
   66 typedef HPT_U64 HPT_LBA;
   67 typedef HPT_U32 HPT_RAW_LBA;
   68 #define MAX_LBA_VALUE 0xffffffffffffffffull
   69 #define MAX_RAW_LBA_VALUE 0xfffffffful
   70 #define RAW_LBA(x) ((HPT_U32)(x))
   71 #define LO_LBA(x) ((HPT_U32)(x))
   72 #define HI_LBA(x) (sizeof(HPT_LBA)>4? (HPT_U32)((x)>>32) : 0)
   73 #define LBA_FORMAT_STR "0x%llX"
   74 
   75 typedef HPT_U64 BUS_ADDRESS;
   76 #define LO_BUSADDR(x) ((HPT_U32)(x))
   77 #define HI_BUSADDR(x) (sizeof(BUS_ADDRESS)>4? (x)>>32 : 0)
   78 
   79 typedef unsigned char HPT_BOOL;
   80 #define HPT_TRUE  1
   81 #define HPT_FALSE 0
   82 
   83 typedef struct _TIME_RECORD {
   84    HPT_U32        seconds:6;      /* 0 - 59 */
   85    HPT_U32        minutes:6;      /* 0 - 59 */
   86    HPT_U32        month:4;        /* 1 - 12 */
   87    HPT_U32        hours:6;        /* 0 - 59 */
   88    HPT_U32        day:5;          /* 1 - 31 */
   89    HPT_U32        year:5;         /* 0=2000, 31=2031 */
   90 } TIME_RECORD;
   91 
   92 /* hardware access */
   93 HPT_U8   os_inb  (void *port);
   94 HPT_U16  os_inw  (void *port);
   95 HPT_U32  os_inl  (void *port);
   96 void     os_outb (void *port, HPT_U8 value);
   97 void     os_outw (void *port, HPT_U16 value);
   98 void     os_outl (void *port, HPT_U32 value);
   99 void     os_insw (void *port, HPT_U16 *buffer, HPT_U32 count);
  100 void     os_outsw(void *port, HPT_U16 *buffer, HPT_U32 count);
  101 
  102 extern HPT_U32 __dummy_reg; /* to avoid the compiler warning */
  103 
  104 #define os_readb(addr) (*(HPT_U8 *)&__dummy_reg = *(volatile HPT_U8 *)(addr))
  105 #define os_readw(addr) (*(HPT_U16 *)&__dummy_reg = *(volatile HPT_U16 *)(addr))
  106 #define os_readl(addr) (*(HPT_U32 *)&__dummy_reg = *(volatile HPT_U32 *)(addr))
  107 
  108 #define os_writeb(addr, val) *(volatile HPT_U8 *)(addr) = (HPT_U8)(val)
  109 #define os_writew(addr, val) *(volatile HPT_U16 *)(addr) = (HPT_U16)(val)
  110 #define os_writel(addr, val) *(volatile HPT_U32 *)(addr) = (HPT_U32)(val)
  111 
  112 /* PCI configuration space for specified device*/
  113 HPT_U8   os_pci_readb (void *osext, HPT_U8 offset);
  114 HPT_U16  os_pci_readw (void *osext, HPT_U8 offset);
  115 HPT_U32  os_pci_readl (void *osext, HPT_U8 offset);
  116 void     os_pci_writeb(void *osext, HPT_U8 offset, HPT_U8 value);
  117 void     os_pci_writew(void *osext, HPT_U8 offset, HPT_U16 value);
  118 void     os_pci_writel(void *osext, HPT_U8 offset, HPT_U32 value);
  119 
  120 /* obsolute interface */
  121 #define MAX_PCI_BUS_NUMBER 0xff
  122 #define MAX_PCI_DEVICE_NUMBER 32
  123 #define MAX_PCI_FUNC_NUMBER 8
  124 #define pcicfg_read_dword(bus, dev, fn, reg) 0xffff
  125 
  126 
  127 void *os_map_pci_bar(
  128         void *osext, 
  129         int index,   
  130         HPT_U32 offset,
  131         HPT_U32 length
  132 );
  133 
  134 
  135 void os_unmap_pci_bar(void *osext, void *base);
  136 
  137 #define os_kmap_sgptr(psg) (psg->addr._logical)
  138 #define os_kunmap_sgptr(ptr)
  139 #define os_set_sgptr(psg, ptr) (psg)->addr._logical = (ptr)
  140 
  141 /* timer */
  142 void *os_add_timer(void *osext, HPT_U32 microseconds, void (*proc)(void *), void *arg);
  143 void  os_del_timer(void *handle);
  144 void  os_request_timer(void * osext, HPT_U32 interval);
  145 HPT_TIME os_query_time(void);
  146 
  147 /* task */
  148 #define OS_SUPPORT_TASK
  149 
  150 typedef struct _OSM_TASK {
  151         struct _OSM_TASK *next;
  152         void (*func)(void *vbus, void *data);
  153         void *data;
  154 }
  155 OSM_TASK;
  156 
  157 void os_schedule_task(void *osext, OSM_TASK *task);
  158 
  159 /* misc */
  160 HPT_U32 os_get_stamp(void);
  161 void os_stallexec(HPT_U32 microseconds);
  162 
  163 #ifndef _SYS_LIBKERN_H_
  164 #define memcpy(dst, src, size) __builtin_memcpy((dst), (src), (size))
  165 #define memcmp(dst, src, size) __builtin_memcmp((dst), (src), (size))
  166 #define strcpy(dst, src) __builtin_strcpy((dst), (src))
  167 static __inline void * memset(void *dst, int c, unsigned long size)
  168 {
  169         char *p;
  170         for (p=(char*)dst; size; size--,p++) *p = c;
  171         return dst;
  172 }
  173 #endif
  174 
  175 #define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (HPT_U32)c)
  176 
  177 
  178 #define os_register_device(osext, target_id)
  179 #define os_unregister_device(osext, target_id)
  180 int os_query_remove_device(void *osext, int target_id);
  181 int os_revalidate_device(void *osext, int target_id);
  182 
  183 HPT_U8 os_get_vbus_seq(void *osext);
  184 
  185 /* debug support */
  186 int  os_printk(char *fmt, ...);
  187 
  188 #ifdef DBG
  189 extern int hpt_dbg_level;
  190 #define KdPrint(x)  do { if (hpt_dbg_level) os_printk x; } while (0)
  191 void __os_dbgbreak(const char *file, int line);
  192 #define os_dbgbreak() __os_dbgbreak(__FILE__, __LINE__)
  193 #define HPT_ASSERT(x) do { if (!(x)) os_dbgbreak(); } while (0)
  194 void os_check_stack(const char *location, int size);
  195 #define HPT_CHECK_STACK(size) os_check_stack(__FUNCTION__, (size))
  196 #else 
  197 #define KdPrint(x)
  198 #define HPT_ASSERT(x)
  199 #define HPT_CHECK_STACK(size)
  200 #endif
  201 
  202 #define OsPrint(x) do { os_printk x; } while (0)
  203 
  204 #endif

Cache object: 1d70f0b6472cf40e0d17810a3f204042


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