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/osfmk/i386/machine_routines.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) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /*
   26  * @OSF_COPYRIGHT@
   27  */
   28 
   29 #ifndef _I386_MACHINE_ROUTINES_H_
   30 #define _I386_MACHINE_ROUTINES_H_
   31 
   32 #include <mach/mach_types.h>
   33 #include <mach/boolean.h>
   34 #include <kern/kern_types.h>
   35 #include <pexpert/pexpert.h>
   36 
   37 #include <sys/appleapiopts.h>
   38 
   39 /* Interrupt handling */
   40 
   41 /* Initialize Interrupts */
   42 void    ml_init_interrupt(void);
   43 
   44 /* Get Interrupts Enabled */
   45 boolean_t ml_get_interrupts_enabled(void);
   46 
   47 /* Set Interrupts Enabled */
   48 boolean_t ml_set_interrupts_enabled(boolean_t enable);
   49 
   50 /* Check if running at interrupt context */
   51 boolean_t ml_at_interrupt_context(void);
   52 
   53 /* Generate a fake interrupt */
   54 void ml_cause_interrupt(void);
   55 
   56 void ml_get_timebase(unsigned long long *timestamp);
   57 
   58 /* Type for the Time Base Enable function */
   59 typedef void (*time_base_enable_t)(cpu_id_t cpu_id, boolean_t enable);
   60 
   61 /* Type for the IPI Hander */
   62 typedef void (*ipi_handler_t)(void);
   63 
   64 /* Struct for ml_processor_register */
   65 struct ml_processor_info {
   66         cpu_id_t                        cpu_id;
   67         boolean_t                       boot_cpu;
   68         vm_offset_t                     start_paddr;
   69         boolean_t                       supports_nap;
   70         unsigned long           l2cr_value;
   71         time_base_enable_t      time_base_enable;
   72 };
   73 
   74 typedef struct ml_processor_info ml_processor_info_t;
   75 
   76 /* Register a processor */
   77 kern_return_t ml_processor_register(
   78         cpu_id_t cpu_id,
   79         uint32_t lapic_id,
   80         processor_t *processor,
   81         ipi_handler_t *ipi_handler,
   82         boolean_t boot_cpu);
   83 
   84 /* Initialize Interrupts */
   85 void ml_install_interrupt_handler(
   86     void *nub,
   87     int source,
   88     void *target,
   89     IOInterruptHandler handler,
   90     void *refCon);
   91 
   92 #ifdef __APPLE_API_UNSTABLE
   93 vm_offset_t
   94 ml_static_ptovirt(
   95         vm_offset_t);
   96 
   97 /* PCI config cycle probing */
   98 boolean_t ml_probe_read(
   99         vm_offset_t paddr,
  100         unsigned int *val);
  101 boolean_t ml_probe_read_64(
  102         addr64_t paddr,
  103         unsigned int *val);
  104 
  105 /* Read physical address byte */
  106 unsigned int ml_phys_read_byte(
  107         vm_offset_t paddr);
  108 unsigned int ml_phys_read_byte_64(
  109         addr64_t paddr);
  110 
  111 /* Read physical address half word */
  112 unsigned int ml_phys_read_half(
  113         vm_offset_t paddr);
  114 unsigned int ml_phys_read_half_64(
  115         addr64_t paddr);
  116 
  117 /* Read physical address word*/
  118 unsigned int ml_phys_read(
  119         vm_offset_t paddr);
  120 unsigned int ml_phys_read_64(
  121         addr64_t paddr);
  122 unsigned int ml_phys_read_word(
  123         vm_offset_t paddr);
  124 unsigned int ml_phys_read_word_64(
  125         addr64_t paddr);
  126 
  127 /* Read physical address double word */
  128 unsigned long long ml_phys_read_double(
  129         vm_offset_t paddr);
  130 unsigned long long ml_phys_read_double_64(
  131         addr64_t paddr);
  132 
  133 /* Write physical address byte */
  134 void ml_phys_write_byte(
  135         vm_offset_t paddr, unsigned int data);
  136 void ml_phys_write_byte_64(
  137         addr64_t paddr, unsigned int data);
  138 
  139 /* Write physical address half word */
  140 void ml_phys_write_half(
  141         vm_offset_t paddr, unsigned int data);
  142 void ml_phys_write_half_64(
  143         addr64_t paddr, unsigned int data);
  144 
  145 /* Write physical address word */
  146 void ml_phys_write(
  147         vm_offset_t paddr, unsigned int data);
  148 void ml_phys_write_64(
  149         addr64_t paddr, unsigned int data);
  150 void ml_phys_write_word(
  151         vm_offset_t paddr, unsigned int data);
  152 void ml_phys_write_word_64(
  153         addr64_t paddr, unsigned int data);
  154 
  155 /* Write physical address double word */
  156 void ml_phys_write_double(
  157         vm_offset_t paddr, unsigned long long data);
  158 void ml_phys_write_double_64(
  159         addr64_t paddr, unsigned long long data);
  160 
  161 void ml_static_mfree(
  162         vm_offset_t,
  163         vm_size_t);
  164 
  165 /* virtual to physical on wired pages */
  166 vm_offset_t ml_vtophys(
  167         vm_offset_t vaddr);
  168 
  169 /* Struct for ml_cpu_get_info */
  170 struct ml_cpu_info {
  171         unsigned long           vector_unit;
  172         unsigned long           cache_line_size;
  173         unsigned long           l1_icache_size;
  174         unsigned long           l1_dcache_size;
  175         unsigned long           l2_settings;
  176         unsigned long           l2_cache_size;
  177         unsigned long           l3_settings;
  178         unsigned long           l3_cache_size;
  179 };
  180 
  181 typedef struct ml_cpu_info ml_cpu_info_t;
  182 
  183 /* Get processor info */
  184 void ml_cpu_get_info(ml_cpu_info_t *cpu_info);
  185 
  186 #endif /* __APPLE_API_UNSTABLE */
  187 
  188 #ifdef __APPLE_API_PRIVATE
  189 #if     defined(PEXPERT_KERNEL_PRIVATE) || defined(MACH_KERNEL_PRIVATE)
  190 /* IO memory map services */
  191 
  192 /* Map memory map IO space */
  193 vm_offset_t ml_io_map(
  194         vm_offset_t phys_addr, 
  195         vm_size_t size);
  196 
  197 /* boot memory allocation */
  198 vm_offset_t ml_static_malloc(
  199         vm_size_t size);
  200 
  201 #endif /* PEXPERT_KERNEL_PRIVATE || MACH_KERNEL_PRIVATE  */
  202 
  203 /* Zero bytes starting at a physical address */
  204 void bzero_phys(
  205         addr64_t phys_address,
  206         uint32_t length);
  207 
  208 #ifdef  MACH_KERNEL_PRIVATE 
  209 
  210 void machine_idle(void);
  211 
  212 void machine_signal_idle(
  213         processor_t processor);
  214 #endif /* MACH_KERNEL_PRIVATE */
  215 
  216 void ml_thread_policy(
  217         thread_t thread,
  218         unsigned policy_id,
  219         unsigned policy_info);
  220 
  221 #define MACHINE_GROUP                                   0x00000001
  222 #define MACHINE_NETWORK_GROUP                   0x10000000
  223 #define MACHINE_NETWORK_WORKLOOP                0x00000001
  224 #define MACHINE_NETWORK_NETISR                  0x00000002
  225 
  226 /* Initialize the maximum number of CPUs */
  227 void ml_init_max_cpus(
  228         unsigned long max_cpus);
  229 
  230 /* Return the maximum number of CPUs set by ml_init_max_cpus() */
  231 int ml_get_max_cpus(
  232         void);
  233 
  234 #endif /* __APPLE_API_PRIVATE */
  235 
  236 #endif /* _I386_MACHINE_ROUTINES_H_ */

Cache object: 976927bc611483d3fb3d9aebb2f1369a


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