| 1 | /* | 
|---|
| 2 | * hal_ppm.h - Generic Physical Page Manager API definition. | 
|---|
| 3 | * | 
|---|
| 4 | * Authors  Alain Greiner (2016,2017) | 
|---|
| 5 | *          Maxime Villard (2017) | 
|---|
| 6 | * | 
|---|
| 7 | * Copyright (c) UPMC 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 | #ifndef _HAL_PPM_H_ | 
|---|
| 26 | #define _HAL_PPM_H_ | 
|---|
| 27 |  | 
|---|
| 28 | #include <hal_types.h> | 
|---|
| 29 | #include <boot_info.h> | 
|---|
| 30 |  | 
|---|
| 31 | ///////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | //           Generic Physical Page Table API (implementation in hal_ppm.c) | 
|---|
| 33 | // | 
|---|
| 34 | // Any arch-specific implementation must implement this API. | 
|---|
| 35 | ///////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 36 |  | 
|---|
| 37 | /****  Forward declarations  ****/ | 
|---|
| 38 |  | 
|---|
| 39 | struct page_s; | 
|---|
| 40 |  | 
|---|
| 41 |  | 
|---|
| 42 | /**************************************************************************************** | 
|---|
| 43 | * This function initializes the Physical Memory Manager in a given cluster. | 
|---|
| 44 | * It allocates physical memory to store the physical page descriptors | 
|---|
| 45 | * array (ppm_tbl), and initializes it using the <pages_nr> field in boot_info. | 
|---|
| 46 | * As the physical memory allocator is not available yet, this physical memory is | 
|---|
| 47 | * allocated on top of the kernel code, using the <pages_offset> field in boot_info. | 
|---|
| 48 | * The pages containing the kernel code, and the pages marked as <reserved> by the | 
|---|
| 49 | * boot-loader in the boot_info structure are removed from the free-lists. | 
|---|
| 50 | **************************************************************************************** | 
|---|
| 51 | * @ info       : pointer on the boot_info structure. | 
|---|
| 52 | * @ return 0 if success / return ENOMEM if failure. | 
|---|
| 53 | ***************************************************************************************/ | 
|---|
| 54 | error_t hal_ppm_init( boot_info_t * info ); | 
|---|
| 55 |  | 
|---|
| 56 | #endif  /* HAL_PPM_H_ */ | 
|---|