[557] | 1 | /* |
---|
| 2 | * cluster_info.h - An array in cluster descriptor describing the whole mesh |
---|
| 3 | * |
---|
| 4 | * Authors Nicolas Phan (2018) |
---|
| 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #ifndef _CLUSTER_INFO_H_ |
---|
| 25 | #define _CLUSTER_INFO_H_ |
---|
| 26 | |
---|
| 27 | #include <hal_kernel_types.h> |
---|
| 28 | #include <kernel_config.h> |
---|
| 29 | #include <hard_config.h> |
---|
| 30 | |
---|
| 31 | /* |
---|
| 32 | * cluster_info[] is an array contained in each cluster descriptor and giving |
---|
| 33 | * information about all clusters. It enables each cluster to access various |
---|
| 34 | * information about all the other clusters. |
---|
| 35 | * |
---|
| 36 | * This array is present in the boot_info structured and thus initialized |
---|
| 37 | * in boot_info_init(). Then it is copied from the boot_info structure to |
---|
| 38 | * each cluster descriptor (cluster_t structure) by each cluster. |
---|
| 39 | * |
---|
| 40 | * Every entry of cluster_info[] is a bitfield giving various info about |
---|
| 41 | * the working state of the cluster, incating whether things work or not. |
---|
| 42 | * |
---|
| 43 | * In the bitfield, LSBs 0 to 'NB_TOTAL_PROCS - 1' indicate if |
---|
| 44 | * the cores work or not. |
---|
| 45 | * The MSB indicates if the cluster is active (is not a hole in the mesh) |
---|
| 46 | * then the second MSB indicate if it's the IO cluster, etc. |
---|
| 47 | */ |
---|
| 48 | |
---|
| 49 | #define CINFO_ACTIVE 0x8000 // if the current cluster contains cores |
---|
| 50 | #define CINFO_IS_IO 0x4000 // if the current cluster is the io cluster |
---|
| 51 | /* |
---|
| 52 | #define CINFO_RAM_OK 0x2000 // if the current cluster has working RAM |
---|
| 53 | #define CINFO_XCU_OK 0x1000 // if the current cluster has working XCU |
---|
| 54 | // A mask with the NB_TOTAL_PROCS least significant bits at 1 |
---|
| 55 | #define CINFO_CORES_MASK ((1 << NB_TOTAL_PROCS) - 1) |
---|
| 56 | // This mask, when assigned to a cluster_info[] entry, indicates that the cluster |
---|
| 57 | // is fully functionnal and all of its cores work |
---|
| 58 | #define CINFO_CLUSTER_OK (CINFO_ACTIVE | CINFO_RAM_OK | CINFO_XCU_OK | CINFO_CORES_MASK) |
---|
| 59 | */ |
---|
| 60 | |
---|
| 61 | /****************************************************************************************** |
---|
| 62 | * This function indicates if a given cluster is active (contains cores) |
---|
| 63 | ****************************************************************************************** |
---|
| 64 | * @ cluster_info : The cluster_info[] entry corresponding to the target cluster |
---|
| 65 | * @ return -1 if error, =0 if the cluster is empty or 1 if the cluster has at least 1 core |
---|
| 66 | *****************************************************************************************/ |
---|
| 67 | int cluster_info_is_active( uint16_t cluster_info ); |
---|
| 68 | |
---|
| 69 | /****************************************************************************************** |
---|
| 70 | * This function indicates if a given cluster is active (has cores) and functionnal (works) |
---|
| 71 | ****************************************************************************************** |
---|
| 72 | * @ cluster_info : The cluster_info[] entry corresponding to the target cluster |
---|
| 73 | * @ return -1 if error, =0 if the cluster is faulty or >0 if the core is working |
---|
| 74 | *****************************************************************************************/ |
---|
| 75 | // int cluster_info_cluster_ok( uint16_t cluster_info ); |
---|
| 76 | |
---|
| 77 | /****************************************************************************************** |
---|
| 78 | * This function indicates if a specific core is working in the given cluster |
---|
| 79 | ****************************************************************************************** |
---|
| 80 | * @ cluster_info : The cluster_info[] entry corresponding to the target cluster |
---|
| 81 | * @ n : The lid of the core of interest |
---|
| 82 | * @ return -1 if error, 0 if the core is faulty or >0 if the core is working |
---|
| 83 | *****************************************************************************************/ |
---|
| 84 | // int cluster_info_core_ok( uint16_t cluster_info, int n ); |
---|
| 85 | |
---|
| 86 | #endif |
---|