| [1] | 1 | /* | 
|---|
 | 2 |  * boot_info.h - informations passed by the bootloader to the kernel in each cluster. | 
|---|
 | 3 |  * | 
|---|
| [50] | 4 |  * Author  Alain Greiner (june 2016,2017) | 
|---|
| [1] | 5 |  * | 
|---|
 | 6 |  * Copyright (c) UPMC Sorbonne Universites | 
|---|
 | 7 |  * | 
|---|
 | 8 |  * This file is part of ALMOS-MKH | 
|---|
 | 9 |  * | 
|---|
 | 10 |  * ALMOS-kernel 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-kernel 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-kernel; if not, write to the Free Software Foundation, | 
|---|
 | 21 |  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 
|---|
 | 22 |  */ | 
|---|
 | 23 |  | 
|---|
 | 24 | #ifndef _BOOT_INFO_H_ | 
|---|
 | 25 | #define _BOOT_INFO_H_ | 
|---|
 | 26 |  | 
|---|
 | 27 | #include <hal_types.h> | 
|---|
| [13] | 28 | #include <kernel_config.h> | 
|---|
| [1] | 29 |  | 
|---|
 | 30 | /********************************************************************************************* | 
|---|
 | 31 |  * Boot-Info binary file signature | 
|---|
 | 32 |  ********************************************************************************************/ | 
|---|
 | 33 |  | 
|---|
| [6] | 34 | #define BOOT_INFO_SIGNATURE    0x12344321 | 
|---|
| [1] | 35 |  | 
|---|
 | 36 | /********************************************************************************************* | 
|---|
 | 37 |  * This structure defines the mapping between the hard-wired core identifier, | 
|---|
 | 38 |  * and the composite index (cluster_identifier , local index). | 
|---|
 | 39 |  ********************************************************************************************/ | 
|---|
 | 40 |  | 
|---|
 | 41 | typedef struct boot_core_s | 
|---|
 | 42 | { | 
|---|
 | 43 |     gid_t    gid;                     /*! hardware identifier                               */ | 
|---|
 | 44 |     lid_t    lid;                     /*! local index in cluster                            */ | 
|---|
 | 45 |     cxy_t    cxy;                     /*! cluster identifier                                */ | 
|---|
 | 46 | } | 
|---|
 | 47 | boot_core_t; | 
|---|
 | 48 |  | 
|---|
 | 49 | /********************************************************************************************* | 
|---|
 | 50 |  * This structure defines the hardware connexion from one source device (identified by | 
|---|
 | 51 |  * the tuple (dev_type/channel/is_rx), to a PIC or XCU component (input IRQ index). | 
|---|
 | 52 |  ********************************************************************************************/ | 
|---|
 | 53 |  | 
|---|
 | 54 | typedef struct boot_irq_s  | 
|---|
 | 55 | { | 
|---|
 | 56 |     uint32_t    dev_type;             /*! source device functionnal type                    */ | 
|---|
 | 57 |     uint8_t     channel;              /*! source device channel index                       */ | 
|---|
 | 58 |     uint8_t     is_rx;                /*! source device direction                           */ | 
|---|
 | 59 |     uint8_t     valid;                /*! Boolean :input IRQ connected                      */ | 
|---|
 | 60 |     uint8_t     reserved;             /*! padding                                           */ | 
|---|
 | 61 | }  | 
|---|
 | 62 | boot_irq_t;  | 
|---|
 | 63 |  | 
|---|
 | 64 | /********************************************************************************************* | 
|---|
 | 65 |  * This structure defines all informations associated to a device in a given cluster. | 
|---|
 | 66 |  * There is one device descriptor per peripheral channel. | 
|---|
 | 67 |  ********************************************************************************************/ | 
|---|
 | 68 |  | 
|---|
 | 69 | typedef struct boot_device_s | 
|---|
 | 70 | { | 
|---|
| [6] | 71 |     uint64_t    base;                 /*! segment physical base address                     */ | 
|---|
| [1] | 72 |     uint32_t    type;                 /*! peripheral type (func | impl)                     */ | 
|---|
 | 73 |     uint32_t    channels;             /*! number of channels                                */ | 
|---|
 | 74 |     uint32_t    param0;               /*! semantic depends on peripherat type               */ | 
|---|
 | 75 |     uint32_t    param1;               /*! semantic depends on peripherat type               */ | 
|---|
 | 76 |     uint32_t    param2;               /*! semantic depends on peripherat type               */ | 
|---|
 | 77 |     uint32_t    param3;               /*! semantic depends on peripherat type               */ | 
|---|
 | 78 |     uint32_t    irqs;                 /*! number of input IRQs                              */ | 
|---|
 | 79 |     boot_irq_t  irq[32];              /*! array of input IRQS (PIC and ICU only)            */ | 
|---|
 | 80 | } | 
|---|
 | 81 | boot_device_t; | 
|---|
 | 82 |  | 
|---|
 | 83 | /********************************************************************************************* | 
|---|
| [50] | 84 |  * This structure defines a reserved zone in the physical address space of a given cluster. | 
|---|
 | 85 |  * A reserved zone is described as a set of contiguous small pages (4 Kbytes) covering the | 
|---|
 | 86 |  * reserved zone, that must be considered already allocated. | 
|---|
 | 87 |  ********************************************************************************************/ | 
|---|
 | 88 |  | 
|---|
 | 89 | typedef struct boot_rsvd_s | 
|---|
 | 90 | { | 
|---|
 | 91 |     ppn_t      first_page;            /*! first physical page index in cluster              */  | 
|---|
 | 92 |     uint32_t   npages;                /*! number of small pages                             */ | 
|---|
 | 93 | } | 
|---|
 | 94 | boot_rsvd_t; | 
|---|
 | 95 |  | 
|---|
 | 96 | /********************************************************************************************* | 
|---|
| [1] | 97 |  * This structure defines the interface between the boot-loader and the kernel. | 
|---|
 | 98 |  * In each cluster, the boot core build a local boot_info_t structure containing | 
|---|
 | 99 |  * both global (trans-clusters) informations, and cluster specific informations. | 
|---|
 | 100 |  ********************************************************************************************/ | 
|---|
 | 101 |  | 
|---|
 | 102 | typedef struct boot_info_s | 
|---|
 | 103 | { | 
|---|
| [6] | 104 |     uint32_t      signature;                     /*! boot info signature                    */ | 
|---|
| [1] | 105 |  | 
|---|
 | 106 |     // global platform parameters | 
|---|
 | 107 |  | 
|---|
| [6] | 108 |         uint32_t      paddr_width;                   /*! number of bits in physical address     */ | 
|---|
 | 109 |     uint32_t      x_width;                       /*! number of bits to code X coordinate    */ | 
|---|
 | 110 |     uint32_t      y_width;                       /*! number of bits to code Y coordinate    */ | 
|---|
 | 111 |         uint32_t      x_size;                        /*! number of cluster in a row             */ | 
|---|
 | 112 |         uint32_t      y_size;                        /*! number of cluster in a column          */ | 
|---|
 | 113 |         uint32_t      io_cxy;                        /*! IO cluster identifier                  */ | 
|---|
| [1] | 114 |  | 
|---|
| [6] | 115 |     // shared resources | 
|---|
| [1] | 116 |  | 
|---|
| [6] | 117 |     uint32_t      ext_dev_nr;                    /*! number of external peripherals         */ | 
|---|
 | 118 |     boot_device_t ext_dev[CONFIG_MAX_EXT_DEV];   /*! array of external peripherals          */ | 
|---|
| [1] | 119 |  | 
|---|
| [6] | 120 |     // private resources (per cluster) | 
|---|
 | 121 |  | 
|---|
 | 122 |         uint32_t      cxy;                           /*! cluster identifier                     */ | 
|---|
 | 123 |         uint32_t      cores_nr;                      /*! number of local cores in               */ | 
|---|
 | 124 |     boot_core_t   core[CONFIG_MAX_LOCAL_CORES];  /*! array of core descriptors              */   | 
|---|
| [50] | 125 |     uint32_t      rsvd_nr;                       /*! number of reserved zones               */ | 
|---|
 | 126 |     boot_rsvd_t   rsvd[CONFIG_PPM_MAX_RSVD];     /*! array of reserved zones                */ | 
|---|
| [13] | 127 |         boot_device_t dev_icu;                       /*! embedded ICU peripheral                */ | 
|---|
 | 128 |         boot_device_t dev_mmc;                       /*! embedded MMC peripheral                */ | 
|---|
 | 129 |         boot_device_t dev_dma;                       /*! embedded DMA peripheral                */ | 
|---|
 | 130 |  | 
|---|
| [50] | 131 |     uint32_t      pages_offset;                  /*! first free page index (after kernel)   */ | 
|---|
 | 132 |     uint32_t      pages_nr;                      /*! total number of physical pages in RAM  */ | 
|---|
| [6] | 133 |  | 
|---|
| [1] | 134 |     // kernel segments | 
|---|
 | 135 |  | 
|---|
| [50] | 136 |     intptr_t      kernel_code_start;             /*! kernel code base paddr                 */ | 
|---|
 | 137 |     intptr_t      kernel_code_end;               /*! kernel code last paddr (excluded)      */ | 
|---|
 | 138 |     intptr_t      kernel_data_start;             /*! kernel data base paddr                 */ | 
|---|
 | 139 |     intptr_t      kernel_data_end;               /*! kernel data last paddr (excluded)      */ | 
|---|
| [1] | 140 | } | 
|---|
 | 141 | boot_info_t; | 
|---|
 | 142 |  | 
|---|
 | 143 | #endif  /* _BOOT_INFO_H_ */ | 
|---|