1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13#include <config.h>
14#include <smp/lock.h>
15
16#ifdef ENABLE_SMP_SUPPORT
17
18clh_lock_t big_kernel_lock ALIGN(L1_CACHE_LINE_SIZE);
19
20BOOT_CODE void
21clh_lock_init(void)
22{
23    for (int i = 0; i < CONFIG_MAX_NUM_NODES; i++) {
24        big_kernel_lock.node_owners[i].node = &big_kernel_lock.nodes[i];
25    }
26
27    /* Initialize the CLH head */
28    big_kernel_lock.nodes[CONFIG_MAX_NUM_NODES].value = CLHState_Granted;
29    big_kernel_lock.head = &big_kernel_lock.nodes[CONFIG_MAX_NUM_NODES];
30}
31
32#endif /* ENABLE_SMP_SUPPORT */
33