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/ppc/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-2004 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * The contents of this file constitute Original Code as defined in and
    7  * are subject to the Apple Public Source License Version 1.1 (the
    8  * "License").  You may not use this file except in compliance with the
    9  * License.  Please obtain a copy of the License at
   10  * http://www.apple.com/publicsource and read it before using this file.
   11  * 
   12  * This Original Code and all software distributed under the License are
   13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
   17  * License for the specific language governing rights and limitations
   18  * under the License.
   19  * 
   20  * @APPLE_LICENSE_HEADER_END@
   21  */
   22 /*
   23  * @OSF_COPYRIGHT@
   24  */
   25 
   26 #ifndef _PPC_MACHINE_ROUTINES_H_
   27 #define _PPC_MACHINE_ROUTINES_H_
   28 
   29 #include <mach/mach_types.h>
   30 #include <mach/boolean.h>
   31 #include <kern/kern_types.h>
   32 #include <pexpert/pexpert.h>
   33 
   34 /* Get Interrupts Enabled */
   35 extern boolean_t        ml_get_interrupts_enabled(
   36                                                 void);
   37 
   38 /* Set Interrupts Enabled */
   39 extern boolean_t        ml_set_interrupts_enabled(
   40                                                 boolean_t                               enable);
   41 
   42 /* Check if running at interrupt context */
   43 extern boolean_t        ml_at_interrupt_context(
   44                                                 void);
   45 
   46 #ifdef KERNEL_PRIVATE
   47 
   48 /* Generate a fake interrupt */
   49 extern void                     ml_cause_interrupt(
   50                                                 void);
   51 
   52 /* Type for the IPI Hander */
   53 typedef void (*ipi_handler_t)(void);
   54 
   55 /* Type for the Time Base Enable function */
   56 typedef void (*time_base_enable_t)(cpu_id_t cpu_id, boolean_t enable);
   57 
   58 /* enables (or disables) the processor nap mode the function returns the previous value*/
   59 extern boolean_t        ml_enable_nap(
   60                                                 int                                             target_cpu,
   61                                                 boolean_t                               nap_enabled);
   62 
   63 /* Put the processor to sleep */
   64 extern void                     ml_ppc_sleep(
   65                                                 void);
   66 
   67 extern void                     ml_get_timebase(
   68                                                 unsigned long long              *timstamp);
   69 
   70 extern int                      ml_enable_cache_level(
   71                                                 int                                             cache_level,
   72                                                 int                                             enable);
   73 
   74 extern void                     ml_static_mfree(
   75                                                 vm_offset_t                             vaddr,
   76                                                 vm_size_t                               size);
   77         
   78 /* Init Interrupts */
   79 extern void                     ml_install_interrupt_handler(
   80                                                 void                                    *nub,
   81                                                 int                                             source,
   82                                                 void                                    *target,
   83                                                 IOInterruptHandler              handler,
   84                                                 void                                    *refCon);
   85                
   86 extern vm_offset_t              ml_static_ptovirt(
   87                                                         vm_offset_t                     paddr);
   88 
   89 /* virtual to physical on wired pages */
   90 extern vm_offset_t              ml_vtophys(
   91                                                         vm_offset_t                     vaddr);
   92 
   93 /* PCI config cycle probing */
   94 extern boolean_t                ml_probe_read(
   95                                                         vm_offset_t                     paddr,
   96                                                         unsigned int            *val);
   97 
   98 extern boolean_t                ml_probe_read_64(
   99                                                         addr64_t                        paddr,
  100                                                         unsigned int            *val);
  101 
  102 /* Read physical address byte */
  103 extern unsigned int             ml_phys_read_byte(
  104                                                         vm_offset_t                     paddr);
  105 
  106 extern unsigned int             ml_phys_read_byte_64(
  107                                                         addr64_t                        paddr);
  108 
  109 /* Read physical address half word */
  110 extern unsigned int             ml_phys_read_half(
  111                                                         vm_offset_t                     paddr);
  112 
  113 extern unsigned int             ml_phys_read_half_64(
  114                                                         addr64_t                        paddr);
  115 
  116 /* Read physical address word*/
  117 extern unsigned int             ml_phys_read(
  118                                                         vm_offset_t                     paddr);
  119 
  120 extern unsigned int             ml_phys_read_64(
  121                                                         addr64_t                        paddr);
  122 
  123 extern unsigned int             ml_phys_read_word(
  124                                                         vm_offset_t                     paddr);
  125 
  126 extern unsigned int             ml_phys_read_word_64(
  127                                                         addr64_t                        paddr);
  128 
  129 /* Read physical address double word */
  130 extern unsigned long long ml_phys_read_double(
  131                                                         vm_offset_t                     paddr);
  132 
  133 extern unsigned long long ml_phys_read_double_64(
  134                                                         addr64_t                        paddr);
  135 
  136 /* Write physical address byte */
  137 extern void                             ml_phys_write_byte(
  138                                                         vm_offset_t                     paddr,
  139                                                         unsigned        int             data);
  140 
  141 extern void                             ml_phys_write_byte_64(
  142                                                                 addr64_t                paddr,
  143                                                                 unsigned int    data);
  144 
  145 /* Write physical address half word */
  146 extern void                             ml_phys_write_half(
  147                                                         vm_offset_t                     paddr,
  148                                                         unsigned int            data);
  149 
  150 extern void                             ml_phys_write_half_64(
  151                                                         addr64_t                        paddr,
  152                                                         unsigned int            data);
  153 
  154 /* Write physical address word */
  155 extern void                             ml_phys_write(
  156                                                         vm_offset_t                     paddr,
  157                                                         unsigned int            data);
  158 
  159 extern void                             ml_phys_write_64(
  160                                                         addr64_t                        paddr,
  161                                                         unsigned int            data);
  162 
  163 extern void                             ml_phys_write_word(
  164                                                         vm_offset_t                     paddr,
  165                                                         unsigned int            data);
  166 
  167 extern void                             ml_phys_write_word_64(
  168                                                         addr64_t                        paddr,
  169                                                         unsigned int            data);
  170 
  171 /* Write physical address double word */
  172 extern void                              ml_phys_write_double(
  173                                                         vm_offset_t                     paddr,
  174                                                         unsigned long long      data);
  175 
  176 extern void                             ml_phys_write_double_64(
  177                                                         addr64_t paddr,
  178                                                         unsigned long long       data);
  179 
  180 /* Struct for ml_processor_register */
  181 struct ml_processor_info {
  182         cpu_id_t                        cpu_id;
  183         boolean_t                       boot_cpu;
  184         vm_offset_t                     start_paddr;
  185         boolean_t                       supports_nap;
  186         unsigned long                   l2cr_value;
  187         time_base_enable_t              time_base_enable;
  188         uint32_t                        power_mode_0;
  189         uint32_t                        power_mode_1;
  190 };
  191 
  192 typedef struct ml_processor_info ml_processor_info_t;
  193 
  194 /* Register a processor */
  195 extern kern_return_t    ml_processor_register(
  196                                                         ml_processor_info_t *ml_processor_info,
  197                                                         processor_t                     *processor,
  198                                                         ipi_handler_t           *ipi_handler);
  199 
  200 /* Zero bytes starting at a physical address */
  201 extern void                             bzero_phys(
  202                                                         addr64_t                        phys_address,
  203                                                         uint32_t                        length);
  204 
  205 #endif /* KERNEL_PRIVATE */
  206 
  207 #ifdef  XNU_KERNEL_PRIVATE
  208 #if     defined(PEXPERT_KERNEL_PRIVATE) || defined(MACH_KERNEL_PRIVATE)
  209 
  210 /* Map memory map IO space */
  211 extern vm_offset_t              ml_io_map(
  212                                                         vm_offset_t                     phys_addr, 
  213                                                         vm_size_t                       size);
  214 
  215 /* boot memory allocation */
  216 extern vm_offset_t              ml_static_malloc(
  217                                                         vm_size_t                       size);
  218 
  219 #endif /* PEXPERT_KERNEL_PRIVATE || MACH_KERNEL_PRIVATE */
  220 
  221 #if     defined(BSD_KERNEL_PRIVATE) || defined(MACH_KERNEL_PRIVATE)
  222 
  223 extern int                              set_be_bit(
  224                                                         void);
  225 
  226 extern int                              clr_be_bit(
  227                                                         void);
  228 
  229 extern int                              be_tracing(
  230                                                         void);
  231 
  232 #endif /* BSD_KERNEL_PRIVATE || MACH_KERNEL_PRIVATE */
  233 
  234 #ifdef  MACH_KERNEL_PRIVATE
  235 extern void                             ml_init_interrupt(
  236                                                         void);
  237 
  238 extern void                             cacheInit(
  239                                                         void);
  240 
  241 extern void                             cacheDisable(
  242                                                         void);
  243 
  244 extern void                             ml_init_lock_timeout(
  245                                                         void);
  246 
  247 void ml_ppc_do_sleep(void);
  248 
  249 #endif /* MACH_KERNEL_PRIVATE */
  250 #endif /* XNU_KERNEL_PRIVATE */
  251 
  252 #ifdef  KERNEL_PRIVATE
  253 extern void             ml_thread_policy(
  254                                 thread_t        thread,
  255                                 unsigned        policy_id,
  256                                 unsigned        policy_info);
  257 
  258 #define MACHINE_GROUP                           0x00000001
  259 #define MACHINE_NETWORK_GROUP           0x10000000 
  260 #define MACHINE_NETWORK_WORKLOOP        0x00000001
  261 #define MACHINE_NETWORK_NETISR          0x00000002
  262 
  263 /* Initialize the maximum number of CPUs */
  264 extern void                             ml_init_max_cpus(
  265                                                         unsigned int            max_cpus);
  266 
  267 /* Return the maximum number of CPUs set by ml_init_max_cpus() */
  268 extern unsigned int             ml_get_max_cpus(
  269                                                         void);
  270 
  271 extern void                     ml_cpu_up(void);
  272 extern void                     ml_cpu_down(void);
  273 
  274 /* Struct for ml_cpu_get_info */
  275 struct ml_cpu_info {
  276         unsigned long           vector_unit;
  277         unsigned long           cache_line_size;
  278         unsigned long           l1_icache_size;
  279         unsigned long           l1_dcache_size;
  280         unsigned long           l2_settings;
  281         unsigned long           l2_cache_size;
  282         unsigned long           l3_settings;
  283         unsigned long           l3_cache_size;
  284 };
  285 
  286 typedef struct ml_cpu_info ml_cpu_info_t;
  287 
  288 /* Get processor info */
  289 extern void                             ml_cpu_get_info(
  290                                                         ml_cpu_info_t           *ml_cpu_info);
  291 
  292 extern void                             ml_set_processor_speed(
  293                                                         unsigned long           speed);
  294 extern void                             ml_set_processor_speed_slave(
  295                                                         unsigned long           speed);
  296 extern void                             ml_set_processor_speed_dpll(
  297                                                         unsigned long           speed);
  298 extern void                             ml_set_processor_speed_dfs(
  299                                                         unsigned long           speed);
  300 extern void                             ml_set_processor_speed_powertune(
  301                                                         unsigned long           speed);
  302 
  303 extern void                             ml_set_processor_voltage(
  304                                                         unsigned long           voltage);
  305 
  306 extern unsigned int             ml_scom_write(
  307                                                         uint32_t                        reg,
  308                                                         uint64_t                        data);
  309 
  310 extern unsigned int             ml_scom_read(
  311                                                         uint32_t                        reg,
  312                                                         uint64_t                        *data);
  313 
  314 extern uint32_t                 ml_hdec_ratio(void);
  315 
  316 #endif /* KERNEL_PRIVATE */
  317 
  318 #endif /* _PPC_MACHINE_ROUTINES_H_ */

Cache object: c48c70eae958f656de015b7ec7dc4ce2


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