| 1 | /*
|
|---|
| 2 | * kernel_init.c - kernel parallel initialization
|
|---|
| 3 | *
|
|---|
| 4 | * Authors : Mohamed Lamine Karaoui (2015)
|
|---|
| 5 | * Alain Greiner (2016,2017)
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright (c) Sorbonne Universites
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of ALMOS-MKH.
|
|---|
| 10 | *
|
|---|
| 11 | * ALMOS-MKH is free software; you can redistribute it and/or modify it
|
|---|
| 12 | * under the terms of the GNU General Public License as published by
|
|---|
| 13 | * the Free Software Foundation; version 2.0 of the License.
|
|---|
| 14 | *
|
|---|
| 15 | * ALMOS-MKH is distributed in the hope that it will be useful, but
|
|---|
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 18 | * General Public License for more details.
|
|---|
| 19 | *
|
|---|
| 20 | * You should have received a copy of the GNU General Public License
|
|---|
| 21 | * along with ALMOS-MKH; if not, write to the Free Software Foundation,
|
|---|
| 22 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|---|
| 23 | */
|
|---|
| 24 |
|
|---|
| 25 | #include <kernel_config.h>
|
|---|
| 26 | #include <errno.h>
|
|---|
| 27 | #include <hal_types.h>
|
|---|
| 28 | #include <hal_special.h>
|
|---|
| 29 | #include <hal_context.h>
|
|---|
| 30 | #include <barrier.h>
|
|---|
| 31 | #include <remote_barrier.h>
|
|---|
| 32 | #include <core.h>
|
|---|
| 33 | #include <list.h>
|
|---|
| 34 | #include <xlist.h>
|
|---|
| 35 | #include <xhtab.h>
|
|---|
| 36 | #include <thread.h>
|
|---|
| 37 | #include <scheduler.h>
|
|---|
| 38 | #include <kmem.h>
|
|---|
| 39 | #include <cluster.h>
|
|---|
| 40 | #include <string.h>
|
|---|
| 41 | #include <memcpy.h>
|
|---|
| 42 | #include <ppm.h>
|
|---|
| 43 | #include <page.h>
|
|---|
| 44 | #include <chdev.h>
|
|---|
| 45 | #include <boot_info.h>
|
|---|
| 46 | #include <dqdt.h>
|
|---|
| 47 | #include <dev_icu.h>
|
|---|
| 48 | #include <dev_mmc.h>
|
|---|
| 49 | #include <dev_dma.h>
|
|---|
| 50 | #include <dev_iob.h>
|
|---|
| 51 | #include <dev_ioc.h>
|
|---|
| 52 | #include <dev_txt.h>
|
|---|
| 53 | #include <dev_pic.h>
|
|---|
| 54 | #include <printk.h>
|
|---|
| 55 | #include <vfs.h>
|
|---|
| 56 | #include <devfs.h>
|
|---|
| 57 | #include <mapper.h>
|
|---|
| 58 |
|
|---|
| 59 | #define KERNEL_INIT_SYNCHRO 0xA5A5B5B5
|
|---|
| 60 |
|
|---|
| 61 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 62 | // All these global variables are replicated in all clusters.
|
|---|
| 63 | // They are initialised by the kernel_init() function.
|
|---|
| 64 | //
|
|---|
| 65 | // WARNING : The section names have been defined to control the base addresses of the
|
|---|
| 66 | // boot_info structure and the idle thread descriptors, through the kernel.ld script:
|
|---|
| 67 | // - the boot_info structure is built by the bootloader, and used by kernel_init.
|
|---|
| 68 | // it must be the first object in the kdata segment.
|
|---|
| 69 | // - the array of idle threads descriptors must be placed on the first page boundary after
|
|---|
| 70 | // the boot_info structure in the kdata segment.
|
|---|
| 71 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 72 |
|
|---|
| 73 | // This variable defines the local boot_info structure
|
|---|
| 74 | __attribute__((section(".kinfo")))
|
|---|
| 75 | boot_info_t boot_info;
|
|---|
| 76 |
|
|---|
| 77 | // This variable defines the "idle" threads descriptors array
|
|---|
| 78 | __attribute__((section(".kidle")))
|
|---|
| 79 | char idle_threads[CONFIG_THREAD_DESC_SIZE *
|
|---|
| 80 | CONFIG_MAX_LOCAL_CORES] CONFIG_PPM_PAGE_ALIGNED;
|
|---|
| 81 |
|
|---|
| 82 | // This variable defines the local cluster manager
|
|---|
| 83 | __attribute__((section(".kdata")))
|
|---|
| 84 | cluster_t cluster_manager CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 85 |
|
|---|
| 86 | // This variable defines the TXT0 kernel terminal
|
|---|
| 87 | __attribute__((section(".kdata")))
|
|---|
| 88 | chdev_t txt0_chdev CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 89 |
|
|---|
| 90 | // This variables define the kernel process0 descriptor
|
|---|
| 91 | __attribute__((section(".kdata")))
|
|---|
| 92 | process_t process_zero CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 93 |
|
|---|
| 94 | // This variable defines extended pointers on the distributed chdevs
|
|---|
| 95 | __attribute__((section(".kdata")))
|
|---|
| 96 | chdev_directory_t chdev_dir CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 97 |
|
|---|
| 98 | // This variable contains the input IRQ indexes for the IOPIC controller
|
|---|
| 99 | __attribute__((section(".kdata")))
|
|---|
| 100 | iopic_input_t iopic_input CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 101 |
|
|---|
| 102 | // This variable contains the input IRQ indexes for the LAPIC controller
|
|---|
| 103 | __attribute__((section(".kdata")))
|
|---|
| 104 | lapic_input_t lapic_input CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 105 |
|
|---|
| 106 | // This variable defines the local cluster identifier
|
|---|
| 107 | __attribute__((section(".kdata")))
|
|---|
| 108 | cxy_t local_cxy CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 109 |
|
|---|
| 110 | // This variable is used for CP0 cores synchronisation in kernel_init()
|
|---|
| 111 | __attribute__((section(".kdata")))
|
|---|
| 112 | remote_barrier_t global_barrier CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 113 |
|
|---|
| 114 | // This variable is used for local cores synchronisation in kernel_init()
|
|---|
| 115 | __attribute__((section(".kdata")))
|
|---|
| 116 | barrier_t local_barrier CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 117 |
|
|---|
| 118 | // This variable defines the array of supported File System contexts
|
|---|
| 119 | __attribute__((section(".kdata")))
|
|---|
| 120 | vfs_ctx_t fs_context[FS_TYPES_NR] CONFIG_CACHE_LINE_ALIGNED;
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 124 | // This function displays the ALMOS_MKH banner.
|
|---|
| 125 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 126 | static void print_banner( uint32_t nclusters , uint32_t ncores )
|
|---|
| 127 | {
|
|---|
| 128 | printk("\n"
|
|---|
| 129 | " _ __ __ _____ ______ __ __ _ __ _ _ \n"
|
|---|
| 130 | " /\\ | | | \\ / | / ___ \\ / _____| | \\ / | | | / / | | | | \n"
|
|---|
| 131 | " / \\ | | | \\/ | | / \\ | | / | \\/ | | |/ / | | | | \n"
|
|---|
| 132 | " / /\\ \\ | | | |\\ /| | | | | | | |_____ ___ | |\\ /| | | / | |___| | \n"
|
|---|
| 133 | " / /__\\ \\ | | | | \\/ | | | | | | \\_____ \\ |___| | | \\/ | | | \\ | ___ | \n"
|
|---|
| 134 | " / ______ \\ | | | | | | | | | | | | | | | | | |\\ \\ | | | | \n"
|
|---|
| 135 | " / / \\ \\ | |____ | | | | | \\___/ | _____/ | | | | | | | \\ \\ | | | | \n"
|
|---|
| 136 | " /_/ \\_\\ |______| |_| |_| \\_____/ |______/ |_| |_| |_| \\_\\ |_| |_| \n"
|
|---|
| 137 | "\n\n\t\t Advanced Locality Management Operating System / Multi Kernel Hybrid\n"
|
|---|
| 138 | "\n\n\t\t\t Version 0.0 : %d clusters / %d cores per cluster\n\n", nclusters , ncores );
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 143 | // This function initializes the TXT0 chdev descriptor, that is the "kernel terminal",
|
|---|
| 144 | // shared by all kernel instances for debug messages.
|
|---|
| 145 | // It is a global variable (replicated in all clusters), because this terminal is used
|
|---|
| 146 | // before the kmem allocator initialisation, but only the instance in cluster containing
|
|---|
| 147 | // the calling core is registered in the "chdev_dir" directory.
|
|---|
| 148 | // As this TXT0 chdev supports only the TXT_SYNC_WRITE command, we don't create
|
|---|
| 149 | // a server thread, we don't allocate a WTI, and we don't initialize the waiting queue.
|
|---|
| 150 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 151 | // @ info : pointer on the local boot-info structure.
|
|---|
| 152 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 153 | static void txt0_device_init( boot_info_t * info )
|
|---|
| 154 | {
|
|---|
| 155 | boot_device_t * dev_tbl; // pointer on array of devices in boot_info
|
|---|
| 156 | uint32_t dev_nr; // actual number of devices in this cluster
|
|---|
| 157 | xptr_t base; // remote pointer on segment base
|
|---|
| 158 | uint32_t func; // device functional index
|
|---|
| 159 | uint32_t impl; // device implementation index
|
|---|
| 160 | uint32_t i; // device index in dev_tbl
|
|---|
| 161 | uint32_t x; // X cluster coordinate
|
|---|
| 162 | uint32_t y; // Y cluster coordinate
|
|---|
| 163 | uint32_t channels; // number of channels
|
|---|
| 164 |
|
|---|
| 165 | // get number of peripherals and base of devices array from boot_info
|
|---|
| 166 | dev_nr = info->ext_dev_nr;
|
|---|
| 167 | dev_tbl = info->ext_dev;
|
|---|
| 168 |
|
|---|
| 169 | // loop on external peripherals to find TXT device
|
|---|
| 170 | for( i = 0 ; i < dev_nr ; i++ )
|
|---|
| 171 | {
|
|---|
| 172 | base = dev_tbl[i].base;
|
|---|
| 173 | func = FUNC_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 174 | impl = IMPL_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 175 | channels = dev_tbl[i].channels;
|
|---|
| 176 |
|
|---|
| 177 | if (func == DEV_FUNC_TXT )
|
|---|
| 178 | {
|
|---|
| 179 | assert( (channels > 0) , __FUNCTION__ ,
|
|---|
| 180 | "numner of TXT channels cannot be 0\n");
|
|---|
| 181 |
|
|---|
| 182 | // initializes TXT0 basic fields
|
|---|
| 183 | txt0_chdev.func = func;
|
|---|
| 184 | txt0_chdev.impl = impl;
|
|---|
| 185 | txt0_chdev.channel = 0;
|
|---|
| 186 | txt0_chdev.base = base;
|
|---|
| 187 | txt0_chdev.is_rx = false;
|
|---|
| 188 |
|
|---|
| 189 | // initializes lock
|
|---|
| 190 | remote_spinlock_init( XPTR( local_cxy , &txt0_chdev.wait_lock ) );
|
|---|
| 191 |
|
|---|
| 192 | // TXT specific initialisation:
|
|---|
| 193 | // no server thread & no IRQ routing for channel 0
|
|---|
| 194 | dev_txt_init( &txt0_chdev );
|
|---|
| 195 |
|
|---|
| 196 | // register the TXT0 in all chdev_dir[x][y] structures
|
|---|
| 197 | for( x = 0 ; x < info->x_size ; x++ )
|
|---|
| 198 | {
|
|---|
| 199 | for( y = 0 ; y < info->y_size ; y++ )
|
|---|
| 200 | {
|
|---|
| 201 | cxy_t cxy = (x<<info->y_width) + y;
|
|---|
| 202 | hal_remote_swd( XPTR( cxy , &chdev_dir.txt[0] ) ,
|
|---|
| 203 | XPTR( local_cxy , &txt0_chdev ) );
|
|---|
| 204 | }
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | kinit_dmsg("\n[INFO] %s created TXT0 chdev in cluster %x at cycle %d\n",
|
|---|
| 208 | __FUNCTION__ , local_cxy , (uint32_t)hal_time_stamp() );
|
|---|
| 209 | }
|
|---|
| 210 | } // end loop on devices
|
|---|
| 211 | } // end txt0_device_init()
|
|---|
| 212 |
|
|---|
| 213 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 214 | // This function allocates memory and initializes the chdev descriptors for the internal
|
|---|
| 215 | // peripherals contained in the local cluster, other than the LAPIC, as specified by
|
|---|
| 216 | // the boot_info, including the linking with the driver for the specified implementation.
|
|---|
| 217 | // The relevant entries in all copies of the devices directory are initialised.
|
|---|
| 218 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 219 | // @ info : pointer on the local boot-info structure.
|
|---|
| 220 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 221 | static void internal_devices_init( boot_info_t * info )
|
|---|
| 222 | {
|
|---|
| 223 | boot_device_t * dev_tbl; // pointer on array of internaldevices in boot_info
|
|---|
| 224 | uint32_t dev_nr; // actual number of devices in this cluster
|
|---|
| 225 | xptr_t base; // remote pointer on segment base
|
|---|
| 226 | uint32_t func; // device functionnal index
|
|---|
| 227 | uint32_t impl; // device implementation index
|
|---|
| 228 | uint32_t i; // device index in dev_tbl
|
|---|
| 229 | uint32_t x; // X cluster coordinate
|
|---|
| 230 | uint32_t y; // Y cluster coordinate
|
|---|
| 231 | uint32_t channels; // number of channels
|
|---|
| 232 | uint32_t channel; // channel index
|
|---|
| 233 | chdev_t * chdev_ptr; // local pointer on created chdev
|
|---|
| 234 |
|
|---|
| 235 | // get number of internal peripherals and base from boot_info
|
|---|
| 236 | dev_nr = info->int_dev_nr;
|
|---|
| 237 | dev_tbl = info->int_dev;
|
|---|
| 238 |
|
|---|
| 239 | // loop on internal peripherals
|
|---|
| 240 | for( i = 0 ; i < dev_nr ; i++ )
|
|---|
| 241 | {
|
|---|
| 242 | base = dev_tbl[i].base;
|
|---|
| 243 | channels = dev_tbl[i].channels;
|
|---|
| 244 | func = FUNC_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 245 | impl = IMPL_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 246 |
|
|---|
| 247 | //////////////////////////
|
|---|
| 248 | if( func == DEV_FUNC_MMC )
|
|---|
| 249 | {
|
|---|
| 250 | assert( (channels == 1) , __FUNCTION__ ,
|
|---|
| 251 | "MMC device must be single channel\n" );
|
|---|
| 252 |
|
|---|
| 253 | // create chdev in local cluster
|
|---|
| 254 | chdev_ptr = chdev_create( func,
|
|---|
| 255 | impl,
|
|---|
| 256 | 0, // channel
|
|---|
| 257 | false, // direction
|
|---|
| 258 | base );
|
|---|
| 259 |
|
|---|
| 260 | assert( (chdev_ptr != NULL) , __FUNCTION__ ,
|
|---|
| 261 | "cannot allocate memory for MMC chdev\n" );
|
|---|
| 262 |
|
|---|
| 263 | // make MMC specific initialisation
|
|---|
| 264 | dev_mmc_init( chdev_ptr );
|
|---|
| 265 |
|
|---|
| 266 | // set the MMC field in all chdev_dir[x][y] structures
|
|---|
| 267 | for( x = 0 ; x < info->x_size ; x++ )
|
|---|
| 268 | {
|
|---|
| 269 | for( y = 0 ; y < info->y_size ; y++ )
|
|---|
| 270 | {
|
|---|
| 271 | cxy_t cxy = (x<<info->y_width) + y;
|
|---|
| 272 | hal_remote_swd( XPTR( cxy , &chdev_dir.mmc[local_cxy] ),
|
|---|
| 273 | XPTR( local_cxy , chdev_ptr ) );
|
|---|
| 274 | }
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | if( local_cxy == 0 )
|
|---|
| 278 | kinit_dmsg("\n[INFO] %s created MMC chdev in cluster 0 at cycle %d\n",
|
|---|
| 279 | __FUNCTION__ , local_cxy , (uint32_t)hal_time_stamp() );
|
|---|
| 280 | }
|
|---|
| 281 | ///////////////////////////////
|
|---|
| 282 | else if( func == DEV_FUNC_DMA )
|
|---|
| 283 | {
|
|---|
| 284 | // create one chdev per channel in local cluster
|
|---|
| 285 | for( channel = 0 ; channel < channels ; channel++ )
|
|---|
| 286 | {
|
|---|
| 287 | // create chdev[channel] in local cluster
|
|---|
| 288 | chdev_ptr = chdev_create( func,
|
|---|
| 289 | impl,
|
|---|
| 290 | channel,
|
|---|
| 291 | false, // direction
|
|---|
| 292 | base );
|
|---|
| 293 |
|
|---|
| 294 | assert( (chdev_ptr != NULL) , __FUNCTION__ ,
|
|---|
| 295 | "cannot allocate memory for DMA chdev" );
|
|---|
| 296 |
|
|---|
| 297 | // make DMA specific initialisation
|
|---|
| 298 | dev_dma_init( chdev_ptr );
|
|---|
| 299 |
|
|---|
| 300 | // initialize only the DMA[channel] field in the local chdev_dir[x][y]
|
|---|
| 301 | // structure because the DMA device is not remotely accessible.
|
|---|
| 302 | chdev_dir.dma[channel] = XPTR( local_cxy , chdev_ptr );
|
|---|
| 303 |
|
|---|
| 304 | kinit_dmsg("\n[INFO] %s created DMA[%d] chdev in cluster 0 at cycle %d\n",
|
|---|
| 305 | __FUNCTION__ , channel , (uint32_t)hal_time_stamp() );
|
|---|
| 306 | }
|
|---|
| 307 | }
|
|---|
| 308 | }
|
|---|
| 309 | } // end internal_devices_init()
|
|---|
| 310 |
|
|---|
| 311 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 312 | // This function allocates memory and initializes the chdev descriptors for the
|
|---|
| 313 | // external (shared) peripherals other than the IOPIC, as specified by the boot_info,
|
|---|
| 314 | // including the dynamic linking with the driver for the specified implementation.
|
|---|
| 315 | // These chdev descriptors are distributed on all clusters, using a modulo on a global
|
|---|
| 316 | // index, identically computed in all clusters: In each cluster, the local CP0 core
|
|---|
| 317 | // computes the global index for all external chdevs, and creates only the chdevs that
|
|---|
| 318 | // must be placed in the local cluster.
|
|---|
| 319 | // The relevant entries in all copies of the devices directory are initialised.
|
|---|
| 320 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 321 | // @ info : pointer on the local boot-info structure.
|
|---|
| 322 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 323 | static void external_devices_init( boot_info_t * info )
|
|---|
| 324 | {
|
|---|
| 325 | boot_device_t * dev_tbl; // pointer on array of external devices in boot_info
|
|---|
| 326 | uint32_t dev_nr; // actual number of external devices
|
|---|
| 327 | xptr_t base; // remote pointer on segment base
|
|---|
| 328 | uint32_t func; // device functionnal index
|
|---|
| 329 | uint32_t impl; // device implementation index
|
|---|
| 330 | uint32_t i; // device index in dev_tbl
|
|---|
| 331 | uint32_t x; // X cluster coordinate
|
|---|
| 332 | uint32_t y; // Y cluster coordinate
|
|---|
| 333 | uint32_t channels; // number of channels
|
|---|
| 334 | uint32_t channel; // channel index
|
|---|
| 335 | uint32_t directions; // number of directions (1 or 2)
|
|---|
| 336 | uint32_t rx; // direction index (0 or 1)
|
|---|
| 337 | uint32_t first_channel; // used in loop on channels for TXT
|
|---|
| 338 | chdev_t * chdev; // local pointer on one channel_device descriptor
|
|---|
| 339 | uint32_t ext_chdev_gid; // global index of external chdev
|
|---|
| 340 |
|
|---|
| 341 | // get number of peripherals and base of devices array from boot_info
|
|---|
| 342 | dev_nr = info->ext_dev_nr;
|
|---|
| 343 | dev_tbl = info->ext_dev;
|
|---|
| 344 |
|
|---|
| 345 | // initializes global index (PIC is already placed in cluster 0
|
|---|
| 346 | ext_chdev_gid = 1;
|
|---|
| 347 |
|
|---|
| 348 | // loop on external peripherals
|
|---|
| 349 | for( i = 0 ; i < dev_nr ; i++ )
|
|---|
| 350 | {
|
|---|
| 351 | base = dev_tbl[i].base;
|
|---|
| 352 | channels = dev_tbl[i].channels;
|
|---|
| 353 | func = FUNC_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 354 | impl = IMPL_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 355 |
|
|---|
| 356 | // There is one chdev per direction for NIC
|
|---|
| 357 | if (func == DEV_FUNC_NIC) directions = 2;
|
|---|
| 358 | else directions = 1;
|
|---|
| 359 |
|
|---|
| 360 | // The TXT0 chdev has already been created
|
|---|
| 361 | if (func == DEV_FUNC_TXT) first_channel = 1;
|
|---|
| 362 | else first_channel = 0;
|
|---|
| 363 |
|
|---|
| 364 | // do nothing for RO, that does not require a device descriptor.
|
|---|
| 365 | if( func == DEV_FUNC_ROM ) continue;
|
|---|
| 366 |
|
|---|
| 367 | // do nothing for PIC, that is already initialized
|
|---|
| 368 | if( func == DEV_FUNC_PIC ) continue;
|
|---|
| 369 |
|
|---|
| 370 | // check PIC device initialized
|
|---|
| 371 | assert( (chdev_dir.pic != XPTR_NULL ) , __FUNCTION__ ,
|
|---|
| 372 | "PIC device must be initialized before other devices\n" );
|
|---|
| 373 |
|
|---|
| 374 | // check external device functionnal type
|
|---|
| 375 | assert( ( (func == DEV_FUNC_IOB) ||
|
|---|
| 376 | (func == DEV_FUNC_IOC) ||
|
|---|
| 377 | (func == DEV_FUNC_TXT) ||
|
|---|
| 378 | (func == DEV_FUNC_NIC) ||
|
|---|
| 379 | (func == DEV_FUNC_FBF) ) , __FUNCTION__ ,
|
|---|
| 380 | "undefined external peripheral type\n" );
|
|---|
| 381 |
|
|---|
| 382 | // loops on channels
|
|---|
| 383 | for( channel = first_channel ; channel < channels ; channel++ )
|
|---|
| 384 | {
|
|---|
| 385 | // loop on directions
|
|---|
| 386 | for( rx = 0 ; rx < directions ; rx++ )
|
|---|
| 387 | {
|
|---|
| 388 | // compute target cluster for chdev[func,channel,direction]
|
|---|
| 389 | uint32_t offset = ext_chdev_gid % ( info->x_size * info->y_size );
|
|---|
| 390 | uint32_t cx = offset / info->y_size;
|
|---|
| 391 | uint32_t cy = offset % info->y_size;
|
|---|
| 392 | uint32_t target_cxy = (cx<<info->y_width) + cy;
|
|---|
| 393 |
|
|---|
| 394 | // allocate and initialize a local chdev
|
|---|
| 395 | // if local cluster matches target cluster
|
|---|
| 396 | if( target_cxy == local_cxy )
|
|---|
| 397 | {
|
|---|
| 398 | chdev = chdev_create( func,
|
|---|
| 399 | impl,
|
|---|
| 400 | channel,
|
|---|
| 401 | rx, // direction
|
|---|
| 402 | base );
|
|---|
| 403 |
|
|---|
| 404 | assert( (chdev != NULL), __FUNCTION__ ,
|
|---|
| 405 | "cannot allocate external device" );
|
|---|
| 406 |
|
|---|
| 407 | // make device type specific initialisation
|
|---|
| 408 | if ( func == DEV_FUNC_IOB ) dev_iob_init( chdev );
|
|---|
| 409 | else if( func == DEV_FUNC_IOC ) dev_ioc_init( chdev );
|
|---|
| 410 | else if( func == DEV_FUNC_TXT ) dev_txt_init( chdev );
|
|---|
| 411 | else if( func == DEV_FUNC_NIC ) dev_nic_init( chdev );
|
|---|
| 412 | else if( func == DEV_FUNC_FBF ) dev_fbf_init( chdev );
|
|---|
| 413 |
|
|---|
| 414 | // all external (shared) devices are remotely accessible
|
|---|
| 415 | // initialize the replicated chdev_dir[x][y] structures
|
|---|
| 416 | // defining the extended pointers on chdev descriptors
|
|---|
| 417 | xptr_t * entry;
|
|---|
| 418 |
|
|---|
| 419 | if(func==DEV_FUNC_IOB ) entry = &chdev_dir.iob;
|
|---|
| 420 | if(func==DEV_FUNC_IOC ) entry = &chdev_dir.ioc[channel];
|
|---|
| 421 | if(func==DEV_FUNC_TXT ) entry = &chdev_dir.txt[channel];
|
|---|
| 422 | if(func==DEV_FUNC_FBF ) entry = &chdev_dir.fbf[channel];
|
|---|
| 423 | if((func==DEV_FUNC_NIC) && (rx==0)) entry = &chdev_dir.nic_tx[channel];
|
|---|
| 424 | if((func==DEV_FUNC_NIC) && (rx==1)) entry = &chdev_dir.nic_rx[channel];
|
|---|
| 425 |
|
|---|
| 426 | for( x = 0 ; x < info->x_size ; x++ )
|
|---|
| 427 | {
|
|---|
| 428 | for( y = 0 ; y < info->y_size ; y++ )
|
|---|
| 429 | {
|
|---|
| 430 | cxy_t cxy = (x<<info->y_width) + y;
|
|---|
| 431 | hal_remote_swd( XPTR( cxy , entry ),
|
|---|
| 432 | XPTR( local_cxy , chdev ) );
|
|---|
| 433 | }
|
|---|
| 434 | }
|
|---|
| 435 |
|
|---|
| 436 | kinit_dmsg("\n[INFO] %s create chdev %s[%d] in cluster %x at cycle %d\n",
|
|---|
| 437 | __FUNCTION__ , chdev_func_str( func ), channel,
|
|---|
| 438 | local_cxy , (uint32_t)hal_time_stamp() );
|
|---|
| 439 |
|
|---|
| 440 | } // end if match
|
|---|
| 441 |
|
|---|
| 442 | // increment chdev global index (matching or not)
|
|---|
| 443 | ext_chdev_gid++;
|
|---|
| 444 |
|
|---|
| 445 | } // end loop on directions
|
|---|
| 446 | } // end loop on channels
|
|---|
| 447 | } // end loop on devices
|
|---|
| 448 | } // end external_devices_init()
|
|---|
| 449 |
|
|---|
| 450 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 451 | // This function is called by CP0 in cluster 0 to allocate memory and initialize the PIC
|
|---|
| 452 | // device, namely the informations attached to the external IOPIC controller.
|
|---|
| 453 | // This initialisation must be done before other devices initialisation because the IRQ
|
|---|
| 454 | // routing infrastructure is required for internal and external devices initialisation.
|
|---|
| 455 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 456 | // @ info : pointer on the local boot-info structure.
|
|---|
| 457 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 458 | static void iopic_init( boot_info_t * info )
|
|---|
| 459 | {
|
|---|
| 460 | boot_device_t * dev_tbl; // pointer on boot_info external devices array
|
|---|
| 461 | uint32_t dev_nr; // actual number of external devices
|
|---|
| 462 | xptr_t base; // remote pointer on segment base
|
|---|
| 463 | uint32_t func; // device functionnal index
|
|---|
| 464 | uint32_t impl; // device implementation index
|
|---|
| 465 | uint32_t i; // device index in dev_tbl
|
|---|
| 466 | uint32_t x; // cluster X coordinate
|
|---|
| 467 | uint32_t y; // cluster Y coordinate
|
|---|
| 468 | bool_t found; // IOPIC found
|
|---|
| 469 | chdev_t * chdev; // pointer on PIC chdev descriptor
|
|---|
| 470 |
|
|---|
| 471 | // get number of external peripherals and base of array from boot_info
|
|---|
| 472 | dev_nr = info->ext_dev_nr;
|
|---|
| 473 | dev_tbl = info->ext_dev;
|
|---|
| 474 |
|
|---|
| 475 | // loop on external peripherals to get the IOPIC
|
|---|
| 476 | for( i = 0 , found = false ; i < dev_nr ; i++ )
|
|---|
| 477 | {
|
|---|
| 478 | func = FUNC_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 479 |
|
|---|
| 480 | if( func == DEV_FUNC_PIC )
|
|---|
| 481 | {
|
|---|
| 482 | base = dev_tbl[i].base;
|
|---|
| 483 | impl = IMPL_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 484 | found = true;
|
|---|
| 485 | break;
|
|---|
| 486 | }
|
|---|
| 487 | }
|
|---|
| 488 |
|
|---|
| 489 | assert( found , __FUNCTION__ , "PIC device not found\n" );
|
|---|
| 490 |
|
|---|
| 491 | // allocate and initialize the PIC chdev in local cluster
|
|---|
| 492 | chdev = chdev_create( func,
|
|---|
| 493 | impl,
|
|---|
| 494 | 0, // channel
|
|---|
| 495 | 0, // direction,
|
|---|
| 496 | base );
|
|---|
| 497 |
|
|---|
| 498 | assert( (chdev != NULL), __FUNCTION__ , "no memory for PIC chdev\n" );
|
|---|
| 499 |
|
|---|
| 500 | // make PIC device type specific initialisation
|
|---|
| 501 | dev_pic_init( chdev );
|
|---|
| 502 |
|
|---|
| 503 | // register extended pointer on PIC chdev in "chdev_dir" array in all clusters
|
|---|
| 504 | xptr_t * entry = &chdev_dir.pic;
|
|---|
| 505 |
|
|---|
| 506 | for( x = 0 ; x < info->x_size ; x++ )
|
|---|
| 507 | {
|
|---|
| 508 | for( y = 0 ; y < info->y_size ; y++ )
|
|---|
| 509 | {
|
|---|
| 510 | cxy_t cxy = (x<<info->y_width) + y;
|
|---|
| 511 | hal_remote_swd( XPTR( cxy , entry ) ,
|
|---|
| 512 | XPTR( local_cxy , chdev ) );
|
|---|
| 513 | }
|
|---|
| 514 | }
|
|---|
| 515 |
|
|---|
| 516 | // initialize the "iopic_input" structure
|
|---|
| 517 | // defining how external IRQs are connected to IOPIC
|
|---|
| 518 | uint32_t id;
|
|---|
| 519 | uint8_t valid;
|
|---|
| 520 | uint32_t type;
|
|---|
| 521 | uint8_t channel;
|
|---|
| 522 | uint8_t is_rx;
|
|---|
| 523 |
|
|---|
| 524 | for( id = 0 ; id < CONFIG_MAX_EXTERNAL_IRQS ; id++ )
|
|---|
| 525 | {
|
|---|
| 526 | valid = dev_tbl[i].irq[id].valid;
|
|---|
| 527 | type = dev_tbl[i].irq[id].dev_type;
|
|---|
| 528 | channel = dev_tbl[i].irq[id].channel;
|
|---|
| 529 | is_rx = dev_tbl[i].irq[id].is_rx;
|
|---|
| 530 |
|
|---|
| 531 | if( valid ) // only valid inputs are registered
|
|---|
| 532 | {
|
|---|
| 533 | uint32_t * index; // local pointer on one entry
|
|---|
| 534 | uint16_t func = FUNC_FROM_TYPE( type );
|
|---|
| 535 |
|
|---|
| 536 | if ( func == DEV_FUNC_TXT )
|
|---|
| 537 | index = &iopic_input.txt[channel];
|
|---|
| 538 | else if( func == DEV_FUNC_IOC )
|
|---|
| 539 | index = &iopic_input.ioc[channel];
|
|---|
| 540 | else if( (func == DEV_FUNC_NIC) && (is_rx == 0) )
|
|---|
| 541 | index = &iopic_input.nic_tx[channel];
|
|---|
| 542 | else if( (func == DEV_FUNC_NIC) && (is_rx != 0) )
|
|---|
| 543 | index = &iopic_input.nic_rx[channel];
|
|---|
| 544 | else if( func == DEV_FUNC_IOB )
|
|---|
| 545 | index = &iopic_input.iob;
|
|---|
| 546 | else
|
|---|
| 547 | assert( false , __FUNCTION__ , "illegal source device for IOPIC input" );
|
|---|
| 548 |
|
|---|
| 549 | // set entry in local structure
|
|---|
| 550 | *index = id;
|
|---|
| 551 | }
|
|---|
| 552 | }
|
|---|
| 553 |
|
|---|
| 554 | kinit_dmsg("\n[INFO] %s created PIC chdev in cluster %x at cycle %d\n",
|
|---|
| 555 | __FUNCTION__ , local_cxy , (uint32_t)hal_time_stamp() );
|
|---|
| 556 |
|
|---|
| 557 | } // end iopic_init()
|
|---|
| 558 |
|
|---|
| 559 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 560 | // This function is called by all CP0s in all cluster to complete the PIC device
|
|---|
| 561 | // initialisation, namely the informations attached to the LAPIC controller.
|
|---|
| 562 | // This initialisation must be done after the IOPIC initialisation, but before other
|
|---|
| 563 | // devices initialisation because the IRQ routing infrastructure is required for both
|
|---|
| 564 | // internal and external devices initialisation.
|
|---|
| 565 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 566 | // @ info : pointer on the local boot-info structure.
|
|---|
| 567 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 568 | static void lapic_init( boot_info_t * info )
|
|---|
| 569 | {
|
|---|
| 570 | boot_device_t * dev_tbl; // pointer on boot_info internal devices array
|
|---|
| 571 | uint32_t dev_nr; // number of internal devices
|
|---|
| 572 | uint32_t i; // device index in dev_tbl
|
|---|
| 573 | xptr_t base; // remote pointer on segment base
|
|---|
| 574 | uint32_t func; // device functionnal type in boot_info
|
|---|
| 575 | bool_t found; // LAPIC found
|
|---|
| 576 |
|
|---|
| 577 | // get number of internal peripherals and base
|
|---|
| 578 | dev_nr = info->int_dev_nr;
|
|---|
| 579 | dev_tbl = info->int_dev;
|
|---|
| 580 |
|
|---|
| 581 | // loop on internal peripherals to get the lapic device
|
|---|
| 582 | for( i = 0 , found = false ; i < dev_nr ; i++ )
|
|---|
| 583 | {
|
|---|
| 584 | func = FUNC_FROM_TYPE( dev_tbl[i].type );
|
|---|
| 585 |
|
|---|
| 586 | if( func == DEV_FUNC_ICU )
|
|---|
| 587 | {
|
|---|
| 588 | base = dev_tbl[i].base;
|
|---|
| 589 | found = true;
|
|---|
| 590 | break;
|
|---|
| 591 | }
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 | // if the LAPIC controller is not defined in the boot_info,
|
|---|
| 595 | // we simply don't initialize the PIC extensions in the kernel,
|
|---|
| 596 | // making the assumption that the LAPIC related informations
|
|---|
| 597 | // are hidden in the hardware specific PIC driver.
|
|---|
| 598 | if( found )
|
|---|
| 599 | {
|
|---|
| 600 | // initialise the PIC extensions for
|
|---|
| 601 | // the core descriptor and core manager extensions
|
|---|
| 602 | dev_pic_extend_init( (uint32_t *)GET_PTR( base ) );
|
|---|
| 603 |
|
|---|
| 604 | // initialize the "lapic_input" structure
|
|---|
| 605 | // defining how internal IRQs are connected to LAPIC
|
|---|
| 606 | uint32_t id;
|
|---|
| 607 | uint8_t valid;
|
|---|
| 608 | uint8_t channel;
|
|---|
| 609 | uint32_t func;
|
|---|
| 610 |
|
|---|
| 611 | for( id = 0 ; id < CONFIG_MAX_INTERNAL_IRQS ; id++ )
|
|---|
| 612 | {
|
|---|
| 613 | valid = dev_tbl[i].irq[id].valid;
|
|---|
| 614 | func = FUNC_FROM_TYPE( dev_tbl[i].irq[id].dev_type );
|
|---|
| 615 | channel = dev_tbl[i].irq[id].channel;
|
|---|
| 616 |
|
|---|
| 617 | if( valid ) // only valid local IRQs are registered
|
|---|
| 618 | {
|
|---|
| 619 | if ( func == DEV_FUNC_MMC ) lapic_input.mmc = id;
|
|---|
| 620 | else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id;
|
|---|
| 621 | else assert( false , __FUNCTION__ , "illegal source device for LAPIC input" );
|
|---|
| 622 | }
|
|---|
| 623 | }
|
|---|
| 624 | }
|
|---|
| 625 | } // end lapic_init()
|
|---|
| 626 |
|
|---|
| 627 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 628 | // This static function returns the identifiers of the calling core.
|
|---|
| 629 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 630 | // @ info : pointer on boot_info structure.
|
|---|
| 631 | // @ lid : [out] core local index in cluster.
|
|---|
| 632 | // @ cxy : [out] cluster identifier.
|
|---|
| 633 | // @ lid : [out] core global identifier (hardware).
|
|---|
| 634 | // @ return 0 if success / return EINVAL if not found.
|
|---|
| 635 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 636 | static error_t get_core_identifiers( boot_info_t * info,
|
|---|
| 637 | lid_t * lid,
|
|---|
| 638 | cxy_t * cxy,
|
|---|
| 639 | gid_t * gid )
|
|---|
| 640 | {
|
|---|
| 641 | uint32_t i;
|
|---|
| 642 | gid_t global_id;
|
|---|
| 643 |
|
|---|
| 644 | // get global identifier from hardware register
|
|---|
| 645 | global_id = hal_get_gid();
|
|---|
| 646 |
|
|---|
| 647 | // makes an associative search in boot_info to get (cxy,lid) from global_id
|
|---|
| 648 | for( i = 0 ; i < info->cores_nr ; i++ )
|
|---|
| 649 | {
|
|---|
| 650 | if( global_id == info->core[i].gid )
|
|---|
| 651 | {
|
|---|
| 652 | *lid = info->core[i].lid;
|
|---|
| 653 | *cxy = info->core[i].cxy;
|
|---|
| 654 | *gid = global_id;
|
|---|
| 655 | return 0;
|
|---|
| 656 | }
|
|---|
| 657 | }
|
|---|
| 658 | return EINVAL;
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 662 | // This function is the entry point for the kernel initialisation.
|
|---|
| 663 | // It is executed by all cores in all clusters, but only core[0], called CP0,
|
|---|
| 664 | // initializes the shared resources such as the cluster manager, or the local peripherals.
|
|---|
| 665 | // To comply with the multi-kernels paradigm, it accesses only local cluster memory, using
|
|---|
| 666 | // only information contained in the local boot_info_t structure, set by the bootloader.
|
|---|
| 667 | // Only CP0 in cluster 0 print the log messages.
|
|---|
| 668 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 669 | // @ info : pointer on the local boot-info structure.
|
|---|
| 670 | ///////////////////////////////////////////////////////////////////////////////////////////
|
|---|
| 671 | void kernel_init( boot_info_t * info )
|
|---|
| 672 | {
|
|---|
| 673 | lid_t core_lid = -1; // running core local index
|
|---|
| 674 | cxy_t core_cxy = -1; // running core cluster identifier
|
|---|
| 675 | gid_t core_gid; // running core hardware identifier
|
|---|
| 676 | cluster_t * cluster; // pointer on local cluster manager
|
|---|
| 677 | core_t * core; // pointer on running core descriptor
|
|---|
| 678 | thread_t * thread; // pointer on idle thread descriptor
|
|---|
| 679 |
|
|---|
| 680 | xptr_t vfs_root_inode_xp; // extended pointer on VFS root inode
|
|---|
| 681 | xptr_t devfs_dev_inode_xp; // extended pointer on DEVFS dev inode
|
|---|
| 682 | xptr_t devfs_external_inode_xp; // extended pointer on DEVFS external inode
|
|---|
| 683 | xptr_t devfs_internal_inode_xp; // extended pointer on DEVFS internal inode
|
|---|
| 684 |
|
|---|
| 685 | error_t error;
|
|---|
| 686 |
|
|---|
| 687 | cxy_t io_cxy = info->io_cxy;
|
|---|
| 688 |
|
|---|
| 689 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 690 | // STEP 0 : Each core get its core identifier from boot_info, and makes
|
|---|
| 691 | // a partial initialisation of its private idle thread descriptor.
|
|---|
| 692 | // CP0 initializes the "local_cxy" global variable.
|
|---|
| 693 | // CP0 in cluster IO initializes the TXT0 chdev to print log messages.
|
|---|
| 694 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 695 |
|
|---|
| 696 | error = get_core_identifiers( info,
|
|---|
| 697 | &core_lid,
|
|---|
| 698 | &core_cxy,
|
|---|
| 699 | &core_gid );
|
|---|
| 700 |
|
|---|
| 701 | // CP0 initializes cluster identifier
|
|---|
| 702 | if( core_lid == 0 ) local_cxy = info->cxy;
|
|---|
| 703 |
|
|---|
| 704 | // each core gets a pointer on its private idle thread descriptor
|
|---|
| 705 | thread = (thread_t *)( idle_threads + (core_lid * CONFIG_THREAD_DESC_SIZE) );
|
|---|
| 706 |
|
|---|
| 707 | // each core registers this thread pointer in hardware register
|
|---|
| 708 | hal_set_current_thread( thread );
|
|---|
| 709 |
|
|---|
| 710 | // each core initializes the idle thread "locks_root" and "xlocks_root" fields
|
|---|
| 711 | list_root_init( &thread->locks_root );
|
|---|
| 712 | xlist_root_init( XPTR( local_cxy , &thread->xlocks_root ) );
|
|---|
| 713 |
|
|---|
| 714 | // CP0 in I/O cluster initialises TXT0 chdev descriptor
|
|---|
| 715 | if( (core_lid == 0) && (core_cxy == io_cxy) ) txt0_device_init( info );
|
|---|
| 716 |
|
|---|
| 717 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 718 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 719 | (info->x_size * info->y_size) );
|
|---|
| 720 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 721 |
|
|---|
| 722 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 723 | kinit_dmsg("\n[INFO] %s exit barrier 0 at cycle %d : TXT0 initialized\n",
|
|---|
| 724 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 725 |
|
|---|
| 726 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 727 | // STEP 1 : all cores check its core identifier.
|
|---|
| 728 | // CP0 initializes the local cluster manager.
|
|---|
| 729 | // This includes the memory allocators.
|
|---|
| 730 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 731 |
|
|---|
| 732 | // all cores check identifiers
|
|---|
| 733 | if( error )
|
|---|
| 734 | {
|
|---|
| 735 | nolock_printk("\n[PANIC] in %s : illegal core identifiers"
|
|---|
| 736 | " gid = %x / cxy = %x / lid = %d\n",
|
|---|
| 737 | __FUNCTION__ , core_lid , core_cxy , core_lid );
|
|---|
| 738 | hal_core_sleep();
|
|---|
| 739 | }
|
|---|
| 740 |
|
|---|
| 741 | // CP0 initializes cluster manager
|
|---|
| 742 | if( core_lid == 0 )
|
|---|
| 743 | {
|
|---|
| 744 | error = cluster_init( info );
|
|---|
| 745 |
|
|---|
| 746 | if( error )
|
|---|
| 747 | {
|
|---|
| 748 | nolock_printk("\n[PANIC] in %s : cannot initialise cluster %x",
|
|---|
| 749 | __FUNCTION__ , local_cxy );
|
|---|
| 750 | hal_core_sleep();
|
|---|
| 751 | }
|
|---|
| 752 | }
|
|---|
| 753 |
|
|---|
| 754 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 755 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 756 | (info->x_size * info->y_size) );
|
|---|
| 757 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 758 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 759 |
|
|---|
| 760 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 761 | kinit_dmsg("\n[INFO] %s exit barrier 1 at cycle %d : clusters initialised\n",
|
|---|
| 762 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 763 |
|
|---|
| 764 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 765 | // STEP 2 : all CP0s initialize the process_zero descriptor.
|
|---|
| 766 | // CP0 in cluster 0 initialises the IOPIC device.
|
|---|
| 767 | // all CP0s complete the distibuted LAPIC initialization.
|
|---|
| 768 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 769 |
|
|---|
| 770 | // all cores get pointer on local cluster manager & core descriptor
|
|---|
| 771 | cluster = &cluster_manager;
|
|---|
| 772 | core = &cluster->core_tbl[core_lid];
|
|---|
| 773 |
|
|---|
| 774 | // all CP0s initialize the process_zero descriptor
|
|---|
| 775 | if( core_lid == 0 ) process_reference_init( &process_zero , 0 , XPTR_NULL );
|
|---|
| 776 |
|
|---|
| 777 | // CP0 in cluster 0 initializes the PIC chdev,
|
|---|
| 778 | if( (core_lid == 0) && (local_cxy == 0) ) iopic_init( info );
|
|---|
| 779 |
|
|---|
| 780 | // all CP0s initialize their local LAPIC extension,
|
|---|
| 781 | if( core_lid == 0 ) lapic_init( info );
|
|---|
| 782 |
|
|---|
| 783 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 784 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 785 | (info->x_size * info->y_size) );
|
|---|
| 786 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 787 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 788 |
|
|---|
| 789 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 790 | kinit_dmsg("\n[INFO] %s exit barrier 2 at cycle %d : PIC initialised\n",
|
|---|
| 791 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 792 |
|
|---|
| 793 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 794 | // STEP 3 : all CP0s initialize their local chdev descriptors
|
|---|
| 795 | // (both internal devices and external devices).
|
|---|
| 796 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 797 |
|
|---|
| 798 | // CP0 scan the internal (private) peripherals,
|
|---|
| 799 | // and allocates memory for the corresponding chdev descriptors.
|
|---|
| 800 | if( core_lid == 0 ) internal_devices_init( info );
|
|---|
| 801 |
|
|---|
| 802 |
|
|---|
| 803 | // All CP0s contribute to initialise external peripheral chdev descriptors.
|
|---|
| 804 | // Each CP0[cxy] scan the set of external (shared) peripherals (but the TXT0),
|
|---|
| 805 | // and allocates memory for the chdev descriptors that must be placed
|
|---|
| 806 | // on the (cxy) cluster according to the global index value.
|
|---|
| 807 |
|
|---|
| 808 | if( core_lid == 0 ) external_devices_init( info );
|
|---|
| 809 |
|
|---|
| 810 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 811 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 812 | (info->x_size * info->y_size) );
|
|---|
| 813 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 814 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 815 |
|
|---|
| 816 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 817 | kinit_dmsg("\n[INFO] %s exit barrier 3 at cycle %d : all chdev initialised\n",
|
|---|
| 818 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 819 |
|
|---|
| 820 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 821 | // STEP 4 : Alls cores initialize their private IDLE thread.
|
|---|
| 822 | // Only CP0 in cluster 0 creates the VFS root inode.
|
|---|
| 823 | // It access the boot device to initialize the file system context.
|
|---|
| 824 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 825 |
|
|---|
| 826 | // all cores create idle thread descriptor
|
|---|
| 827 | error = thread_kernel_init( thread,
|
|---|
| 828 | THREAD_IDLE,
|
|---|
| 829 | &thread_idle_func,
|
|---|
| 830 | NULL,
|
|---|
| 831 | core_lid );
|
|---|
| 832 | if( error )
|
|---|
| 833 | {
|
|---|
| 834 | nolock_printk("\n[PANIC] in %s : core[%x][%d] cannot initialize idle thread\n",
|
|---|
| 835 | __FUNCTION__ , local_cxy , core_lid );
|
|---|
| 836 | hal_core_sleep();
|
|---|
| 837 | }
|
|---|
| 838 |
|
|---|
| 839 | // all cores register idle thread in scheduler
|
|---|
| 840 | core->scheduler.idle = thread;
|
|---|
| 841 |
|
|---|
| 842 | // all core activate the idle thread
|
|---|
| 843 | thread_unblock( XPTR( local_cxy , thread ) , THREAD_BLOCKED_GLOBAL );
|
|---|
| 844 |
|
|---|
| 845 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 846 | {
|
|---|
| 847 | kinit_dmsg("\n[INFO] %s : created idle thread %x at cycle %d\n",
|
|---|
| 848 | __FUNCTION__ , thread , (uint32_t)hal_time_stamp());
|
|---|
| 849 | }
|
|---|
| 850 |
|
|---|
| 851 | // CPO in cluster 0 creates the VFS root
|
|---|
| 852 | if( (core_lid == 0) && (local_cxy == 0 ) )
|
|---|
| 853 | {
|
|---|
| 854 | vfs_root_inode_xp = XPTR_NULL;
|
|---|
| 855 |
|
|---|
| 856 | // File System must be FATFS in this implementation,
|
|---|
| 857 | // but other File System can be introduced here
|
|---|
| 858 | if( CONFIG_VFS_ROOT_IS_FATFS )
|
|---|
| 859 | {
|
|---|
| 860 | // 1. create FATFS context in cluster 0
|
|---|
| 861 | fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc();
|
|---|
| 862 |
|
|---|
| 863 | printk("\n@@@ %s extend = %x\n", __FUNCTION__ , fatfs_ctx );
|
|---|
| 864 |
|
|---|
| 865 | nolock_assert( (fatfs_ctx != NULL) , __FUNCTION__ ,
|
|---|
| 866 | "cannot create FATFS context in cluster 0\n" );
|
|---|
| 867 |
|
|---|
| 868 | // 2. access boot device to initialize FATFS context
|
|---|
| 869 | fatfs_ctx_init( fatfs_ctx );
|
|---|
| 870 |
|
|---|
| 871 | // 3. get various informations from FATFS context
|
|---|
| 872 | uint32_t root_dir_cluster = fatfs_ctx->root_dir_cluster;
|
|---|
| 873 | uint32_t cluster_size = fatfs_ctx->bytes_per_sector *
|
|---|
| 874 | fatfs_ctx->sectors_per_cluster;
|
|---|
| 875 | uint32_t total_clusters = fatfs_ctx->fat_sectors_count << 7;
|
|---|
| 876 |
|
|---|
| 877 | // 4. create VFS root inode in cluster 0
|
|---|
| 878 | error = vfs_inode_create( XPTR_NULL, // dentry_xp
|
|---|
| 879 | FS_TYPE_FATFS, // fs_type
|
|---|
| 880 | INODE_TYPE_DIR, // inode_type
|
|---|
| 881 | (void *)(intptr_t)root_dir_cluster, // extend
|
|---|
| 882 | 0, // attr
|
|---|
| 883 | 0, // rights
|
|---|
| 884 | 0, // uid
|
|---|
| 885 | 0, // gid
|
|---|
| 886 | &vfs_root_inode_xp ); // return
|
|---|
| 887 |
|
|---|
| 888 | nolock_assert( (error == 0) , __FUNCTION__ ,
|
|---|
| 889 | "cannot create VFS root inode\n" );
|
|---|
| 890 |
|
|---|
| 891 | // 5. initialize VFS context for FAT in cluster 0
|
|---|
| 892 | vfs_ctx_init( FS_TYPE_FATFS, // file system type
|
|---|
| 893 | 0, // attributes
|
|---|
| 894 | total_clusters,
|
|---|
| 895 | cluster_size,
|
|---|
| 896 | vfs_root_inode_xp, // VFS root
|
|---|
| 897 | fatfs_ctx ); // extend
|
|---|
| 898 | }
|
|---|
| 899 | else
|
|---|
| 900 | {
|
|---|
| 901 | nolock_printk("\n[PANIC] in %s : root FS must be FATFS\n", __FUNCTION__ );
|
|---|
| 902 | hal_core_sleep();
|
|---|
| 903 | }
|
|---|
| 904 |
|
|---|
| 905 | ///////////////////////////////@@@
|
|---|
| 906 | fatfs_ctx_display();
|
|---|
| 907 | ///////////////////////////////@@@
|
|---|
| 908 |
|
|---|
| 909 | // register VFS root inode in process_zero
|
|---|
| 910 | process_zero.vfs_root_xp = vfs_root_inode_xp;
|
|---|
| 911 | process_zero.vfs_cwd_xp = vfs_root_inode_xp;
|
|---|
| 912 | }
|
|---|
| 913 |
|
|---|
| 914 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 915 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 916 | (info->x_size * info->y_size) );
|
|---|
| 917 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 918 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 919 |
|
|---|
| 920 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 921 | kinit_dmsg("\n[INFO] %s exit barrier 4 at cycle %d : VFS OK in cluster 0\n",
|
|---|
| 922 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 923 |
|
|---|
| 924 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 925 | // STEP 5 : Other CP0s allocate memory for the selected FS context,
|
|---|
| 926 | // and initialise both the local FS context and the local VFS context
|
|---|
| 927 | // from values stored in cluster 0.
|
|---|
| 928 | // They get the VFS root inode extended pointer from cluster 0.
|
|---|
| 929 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 930 |
|
|---|
| 931 | if( (core_lid == 0) && (local_cxy != 0) )
|
|---|
| 932 | {
|
|---|
| 933 | // File System must be FATFS in this implementation,
|
|---|
| 934 | // but other File System can be introduced here
|
|---|
| 935 | if( CONFIG_VFS_ROOT_IS_FATFS )
|
|---|
| 936 | {
|
|---|
| 937 | // allocate memory for FATFS context
|
|---|
| 938 | fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc();
|
|---|
| 939 |
|
|---|
| 940 | nolock_assert( (fatfs_ctx != NULL) , __FUNCTION__ ,
|
|---|
| 941 | "cannot create FATFS context\n" );
|
|---|
| 942 |
|
|---|
| 943 | // get local pointer on VFS context for FATFS
|
|---|
| 944 | vfs_ctx_t * vfs_ctx = &fs_context[FS_TYPE_FATFS];
|
|---|
| 945 |
|
|---|
| 946 | // copy VFS context from cluster 0 to local cluster
|
|---|
| 947 | hal_remote_memcpy( XPTR( local_cxy , vfs_ctx ),
|
|---|
| 948 | XPTR( 0 , vfs_ctx ),
|
|---|
| 949 | sizeof(vfs_ctx_t) );
|
|---|
| 950 |
|
|---|
| 951 | // copy FATFS context from cluster 0 to local cluster
|
|---|
| 952 | hal_remote_memcpy( XPTR( local_cxy , fatfs_ctx ),
|
|---|
| 953 | XPTR( 0 , fatfs_ctx ),
|
|---|
| 954 | sizeof(fatfs_ctx_t) );
|
|---|
| 955 |
|
|---|
| 956 | // update extend field in local copy of VFS context
|
|---|
| 957 | vfs_ctx->extend = fatfs_ctx;
|
|---|
| 958 | }
|
|---|
| 959 |
|
|---|
| 960 | // get extended pointer on VFS root inode from cluster 0
|
|---|
| 961 | vfs_root_inode_xp = hal_remote_lwd( XPTR( 0 , process_zero.vfs_root_xp ) );
|
|---|
| 962 |
|
|---|
| 963 | // update local process_zero descriptor
|
|---|
| 964 | process_zero.vfs_root_xp = vfs_root_inode_xp;
|
|---|
| 965 | process_zero.vfs_cwd_xp = vfs_root_inode_xp;
|
|---|
| 966 | }
|
|---|
| 967 |
|
|---|
| 968 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 969 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 970 | (info->x_size * info->y_size) );
|
|---|
| 971 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 972 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 973 |
|
|---|
| 974 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 975 | kinit_dmsg("\n[INFO] %s exit barrier 5 at cycle %d : VFS OK in all clusters\n",
|
|---|
| 976 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 977 |
|
|---|
| 978 |
|
|---|
| 979 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 980 | // STEP 6 : CP0 in cluster IO makes the global DEVFS tree initialisation:
|
|---|
| 981 | // It creates the DEVFS directory "dev", and the DEVFS "external"
|
|---|
| 982 | // directory in cluster IO and mount these inodes into VFS.
|
|---|
| 983 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 984 |
|
|---|
| 985 | if( (core_lid == 0) && (local_cxy == io_cxy) )
|
|---|
| 986 | {
|
|---|
| 987 | // create "dev" and "external" directories.
|
|---|
| 988 | devfs_global_init( process_zero.vfs_root_xp,
|
|---|
| 989 | &devfs_dev_inode_xp,
|
|---|
| 990 | &devfs_external_inode_xp );
|
|---|
| 991 |
|
|---|
| 992 | // creates the DEVFS context in cluster IO
|
|---|
| 993 | devfs_ctx_t * devfs_ctx = devfs_ctx_alloc();
|
|---|
| 994 |
|
|---|
| 995 | nolock_assert( (devfs_ctx != NULL) , __FUNCTION__ ,
|
|---|
| 996 | "cannot create DEVFS context in cluster IO\n");
|
|---|
| 997 |
|
|---|
| 998 | // register DEVFS root and external directories
|
|---|
| 999 | devfs_ctx_init( devfs_ctx, devfs_dev_inode_xp, devfs_external_inode_xp );
|
|---|
| 1000 | }
|
|---|
| 1001 |
|
|---|
| 1002 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1003 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 1004 | (info->x_size * info->y_size) );
|
|---|
| 1005 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 1006 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1007 |
|
|---|
| 1008 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 1009 | kinit_dmsg("\n[INFO] %s exit barrier 6 at cycle %d : DEVFS OK in cluster IO\n",
|
|---|
| 1010 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 1011 |
|
|---|
| 1012 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1013 | // STEP 7 : All CP0s complete in parallel the DEVFS tree initialization.
|
|---|
| 1014 | // Each CP0 get the "dev" and "external" extended pointers from
|
|---|
| 1015 | // values stored in cluster IO.
|
|---|
| 1016 | // Then CP0 in cluster(i) creates the DEVFS "internal directory,
|
|---|
| 1017 | // and creates the pseudo-files for all chdevs in cluster (i).
|
|---|
| 1018 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1019 |
|
|---|
| 1020 | if( core_lid == 0 )
|
|---|
| 1021 | {
|
|---|
| 1022 | // get extended pointer on "extend" field of VFS context for DEVFS in cluster IO
|
|---|
| 1023 | xptr_t extend_xp = XPTR( io_cxy , &fs_context[FS_TYPE_DEVFS].extend );
|
|---|
| 1024 |
|
|---|
| 1025 | // get pointer on DEVFS context in cluster IO
|
|---|
| 1026 | devfs_ctx_t * devfs_ctx = hal_remote_lpt( extend_xp );
|
|---|
| 1027 |
|
|---|
| 1028 | devfs_dev_inode_xp = hal_remote_lwd( XPTR( io_cxy ,
|
|---|
| 1029 | &devfs_ctx->dev_inode_xp ) );
|
|---|
| 1030 | devfs_external_inode_xp = hal_remote_lwd( XPTR( io_cxy ,
|
|---|
| 1031 | &devfs_ctx->external_inode_xp ) );
|
|---|
| 1032 |
|
|---|
| 1033 | // populate DEVFS in all clusters
|
|---|
| 1034 | devfs_local_init( devfs_dev_inode_xp,
|
|---|
| 1035 | devfs_external_inode_xp,
|
|---|
| 1036 | &devfs_internal_inode_xp );
|
|---|
| 1037 | }
|
|---|
| 1038 |
|
|---|
| 1039 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1040 | if( core_lid == 0 ) remote_barrier( XPTR( io_cxy , &global_barrier ),
|
|---|
| 1041 | (info->x_size * info->y_size) );
|
|---|
| 1042 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 1043 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1044 |
|
|---|
| 1045 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 1046 | kinit_dmsg("\n[INFO] %s exit barrier 7 at cycle %d : DEVFS OK in all clusters\n",
|
|---|
| 1047 | __FUNCTION__, (uint32_t)hal_time_stamp());
|
|---|
| 1048 |
|
|---|
| 1049 | #if CONFIG_KINIT_DEBUG
|
|---|
| 1050 | vfs_display( vfs_root_inode_xp );
|
|---|
| 1051 | #endif
|
|---|
| 1052 |
|
|---|
| 1053 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1054 | // STEP 8 : CP0 in I/O cluster creates the first user process (process_init)
|
|---|
| 1055 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1056 |
|
|---|
| 1057 | if( (core_lid == 0) && (local_cxy == io_cxy) )
|
|---|
| 1058 | {
|
|---|
| 1059 | process_init_create();
|
|---|
| 1060 | }
|
|---|
| 1061 |
|
|---|
| 1062 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1063 | if( core_lid == 0 ) remote_barrier( XPTR( info->io_cxy , &global_barrier ),
|
|---|
| 1064 | (info->x_size * info->y_size) );
|
|---|
| 1065 | barrier_wait( &local_barrier , info->cores_nr );
|
|---|
| 1066 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1067 |
|
|---|
| 1068 | if( (core_lid == 0) && (local_cxy == 0) )
|
|---|
| 1069 | kinit_dmsg("\n[INFO] %s exit barrier 8 at cycle %d : process init created\n",
|
|---|
| 1070 | __FUNCTION__ , (uint32_t)hal_time_stamp() );
|
|---|
| 1071 |
|
|---|
| 1072 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1073 | // STEP 9 : CP0 in cluster 0 print banner
|
|---|
| 1074 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 1075 |
|
|---|
| 1076 | if( (core_lid == 0) && (local_cxy == io_cxy) )
|
|---|
| 1077 | {
|
|---|
| 1078 | print_banner( (info->x_size * info->y_size) , info->cores_nr );
|
|---|
| 1079 |
|
|---|
| 1080 | kinit_dmsg("\n\n*** memory fooprint of main kernet objects ***\n"
|
|---|
| 1081 | " - thread descriptor : %d bytes\n"
|
|---|
| 1082 | " - process descriptor : %d bytes\n"
|
|---|
| 1083 | " - cluster manager : %d bytes\n"
|
|---|
| 1084 | " - chdev descriptor : %d bytes\n"
|
|---|
| 1085 | " - core descriptor : %d bytes\n"
|
|---|
| 1086 | " - scheduler : %d bytes\n"
|
|---|
| 1087 | " - rpc fifo : %d bytes\n"
|
|---|
| 1088 | " - page descriptor : %d bytes\n"
|
|---|
| 1089 | " - mapper root : %d bytes\n"
|
|---|
| 1090 | " - ppm manager : %d bytes\n"
|
|---|
| 1091 | " - kcm manager : %d bytes\n"
|
|---|
| 1092 | " - khm manager : %d bytes\n"
|
|---|
| 1093 | " - vmm manager : %d bytes\n"
|
|---|
| 1094 | " - gpt root : %d bytes\n"
|
|---|
| 1095 | " - list item : %d bytes\n"
|
|---|
| 1096 | " - xlist item : %d bytes\n"
|
|---|
| 1097 | " - spinlock : %d bytes\n"
|
|---|
| 1098 | " - remote spinlock : %d bytes\n"
|
|---|
| 1099 | " - rwlock : %d bytes\n"
|
|---|
| 1100 | " - remote rwlock : %d bytes\n",
|
|---|
| 1101 | sizeof( thread_t ),
|
|---|
| 1102 | sizeof( process_t ),
|
|---|
| 1103 | sizeof( cluster_t ),
|
|---|
| 1104 | sizeof( chdev_t ),
|
|---|
| 1105 | sizeof( core_t ),
|
|---|
| 1106 | sizeof( scheduler_t ),
|
|---|
| 1107 | sizeof( rpc_fifo_t ),
|
|---|
| 1108 | sizeof( page_t ),
|
|---|
| 1109 | sizeof( mapper_t ),
|
|---|
| 1110 | sizeof( ppm_t ),
|
|---|
| 1111 | sizeof( kcm_t ),
|
|---|
| 1112 | sizeof( khm_t ),
|
|---|
| 1113 | sizeof( vmm_t ),
|
|---|
| 1114 | sizeof( gpt_t ),
|
|---|
| 1115 | sizeof( list_entry_t ),
|
|---|
| 1116 | sizeof( xlist_entry_t ),
|
|---|
| 1117 | sizeof( spinlock_t ),
|
|---|
| 1118 | sizeof( remote_spinlock_t ),
|
|---|
| 1119 | sizeof( rwlock_t ),
|
|---|
| 1120 | sizeof( remote_rwlock_t ));
|
|---|
| 1121 | }
|
|---|
| 1122 |
|
|---|
| 1123 | // each core activates its private PTI IRQ
|
|---|
| 1124 | dev_pic_enable_timer( CONFIG_SCHED_TICK_PERIOD );
|
|---|
| 1125 |
|
|---|
| 1126 | if( (core_lid == 0) && (local_cxy == io_cxy) )
|
|---|
| 1127 | thread_dmsg("\n[INFO] %s complete kernel init in cluster 0 at cycle %d\n"
|
|---|
| 1128 | __FUNCTION__ , (uint32_t)hal_time_stamp() )
|
|---|
| 1129 |
|
|---|
| 1130 | // each core jump to idle thread
|
|---|
| 1131 | thread_idle_func();
|
|---|
| 1132 | }
|
|---|
| 1133 |
|
|---|