Changeset 215
- Timestamp:
- Jul 17, 2017, 1:41:13 PM (7 years ago)
- Location:
- trunk/hal/x86_64
- Files:
-
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_drivers.c
r213 r215 27 27 #include <soclib_tty.h> 28 28 #include <soclib_xcu.h> 29 #include <ioc_ata.h> 29 30 #include <pic_apic.h> 30 31 … … 72 73 void hal_drivers_ioc_init(chdev_t *dev) 73 74 { 74 soclib_bdv_init(dev);75 ioc_ata_init(dev); 75 76 } 76 77 -
trunk/hal/x86_64/drivers/ioc_ata.c
r211 r215 1 1 /* 2 * soclib_bdv.c - soclib simple block device driver implementation. 3 * 4 * Author Alain Greiner (2016) 5 * 6 * Copyright (c) UPMC Sorbonne Universites 2 * ioc_ata.c - ATA driver implementation 3 * 4 * Copyright (c) 2017 Maxime Villard 7 5 * 8 6 * This file is part of ALMOS-MKH. 9 7 * 10 * ALMOS-MKH .is free software; you can redistribute it and/or modify it8 * ALMOS-MKH is free software; you can redistribute it and/or modify it 11 9 * under the terms of the GNU General Public License as published by 12 10 * the Free Software Foundation; version 2.0 of the License. 13 11 * 14 * ALMOS-MKH .is distributed in the hope that it will be useful, but12 * ALMOS-MKH is distributed in the hope that it will be useful, but 15 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 18 16 * 19 17 * 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,18 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 21 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 20 */ … … 24 22 #include <chdev.h> 25 23 #include <dev_ioc.h> 26 #include < soclib_bdv.h>24 #include <hal_drivers.h> 27 25 #include <thread.h> 28 26 #include <spinlock.h> … … 176 174 /* -------------------------------------------------------------------------- */ 177 175 178 void soclib_bdv_init(chdev_t *chdev) 179 { 180 chdev->cmd = &soclib_bdv_cmd; 181 chdev->isr = &soclib_bdv_isr; 176 static void ioc_ata_cmd(xptr_t th_xp); 177 static void ioc_ata_isr(chdev_t *chdev); 178 179 void ioc_ata_init(chdev_t *chdev) 180 { 181 chdev->cmd = &ioc_ata_cmd; 182 chdev->isr = &ioc_ata_isr; 182 183 ata_init(); 183 184 } 184 185 185 void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp)186 static void ioc_ata_cmd(xptr_t th_xp) 186 187 { 187 188 uint32_t cmd_type; // IOC_READ / IOC_WRITE / IOC_SYNC_READ … … 216 217 } 217 218 218 void __attribute__ ((noinline)) soclib_bdv_isr( chdev_t * chdev)219 static void ioc_ata_isr(chdev_t *chdev) 219 220 { 220 221 x86_panic((char *)__func__); -
trunk/hal/x86_64/drivers/ioc_ata.h
r207 r215 1 1 /* 2 * soclib_bdv.h - SOCLIB_BDV (simple block device) driver definition.2 * ioc_ata.c - ATA driver definitions 3 3 * 4 * Author Alain Greiner 5 * 6 * Copyright (c) UPMC Sorbonne Universites 4 * Copyright (c) 2017 Maxime Villard 7 5 * 8 6 * This file is part of ALMOS-MKH. … … 22 20 */ 23 21 24 #ifndef _ SOCLIB_BDV_H_25 #define _ SOCLIB_BDV_H_22 #ifndef _IOC_ATA_H_ 23 #define _IOC_ATA_H_ 26 24 27 25 #include <chdev.h> 28 26 #include <hal_types.h> 29 27 30 /******************************************************************************************** 31 * This driver supports the SocLib VciBlockDevice component, that is a simgle channel, 32 * block oriented, external storage controler, supporting only one I/O transaction, 33 * at a given time. 34 *******************************************************************************************/ 28 void ioc_ata_init(chdev_t *chdev); 35 29 36 /******************************************************************************************** 37 * SOCLIB_BDV registers offset 38 *******************************************************************************************/ 39 40 enum SoclibBlockDeviceRegisters 41 { 42 BDV_BUFFER_REG = 0, 43 BDV_LBA_REG = 1, 44 BDV_COUNT_REG = 2, 45 BDV_OP_REG = 3, 46 BDV_STATUS_REG = 4, 47 BDV_IRQ_ENABLE_REG = 5, 48 BDV_SIZE_REG = 6, 49 BDV_BLOCK_SIZE_REG = 7, 50 BDV_BUFFER_EXT_REG = 8, 51 }; 52 53 /******************************************************************************************** 54 * SOCLIB_BDV status values 55 *******************************************************************************************/ 56 57 #define BDV_IDLE 0 58 #define BDV_BUSY 1 59 #define BDV_READ_SUCCESS 2 60 #define BDV_WRITE_SUCCESS 3 61 #define BDV_READ_ERROR 4 62 #define BDV_WRITE_ERROR 5 63 #define BDV_ERROR 6 64 65 /******************************************************************************************** 66 * SOCLIB_BDV operations 67 *******************************************************************************************/ 68 69 #define BDV_OP_NOP 0 70 #define BDV_OP_READ 1 71 #define BDV_OP_WRITE 2 72 73 /******************************************************************************************** 74 * This function access the SOCLIB_BDV hardware registers to get the block size and the 75 * number of blocks, and initialises the "extension" field of the IOC device descriptor. 76 ******************************************************************************************** 77 * @ chdev : local pointer on the generic IOC chdev descriptor. 78 *******************************************************************************************/ 79 extern void soclib_bdv_init( chdev_t * chdev ); 80 81 /******************************************************************************************** 82 * This function is called by the server thread associated to the IOC device. 83 * It decode the IOC device command embedded in the calling thread descriptor, 84 * (format defined in the dev_ioc.h file) and starts execution of this generic command, 85 * accessing the relevant SOCLIB_BDV hardware registers. 86 * Then it blocks on the THREAD_BLOCKED_DEV_ISR and deschedule, because the SOCLIB_BDV 87 * device cannot register several commands. It is re-activated by the ISR signaling the 88 * I/O operation completion. 89 ******************************************************************************************** 90 * @ thread_xp : extended pointer on the client thread. 91 *******************************************************************************************/ 92 extern void soclib_bdv_cmd( xptr_t thread_xp ); 93 94 /******************************************************************************************** 95 * This Interrupt Service Routine is executed when the IRQ signaling the completion of 96 * an IOC command is received by a core. It acknowledge the IRQ by accessing the proper 97 * SOCLIB_BDV register, unblock the client thread, and unblock the server thread that 98 * can starts execution of a new command if the waiting queue is not emppty. 99 ******************************************************************************************** 100 * @ chdev : local pointer on the generic IOC device descriptor. 101 *******************************************************************************************/ 102 extern void soclib_bdv_isr( chdev_t * chdev ); 103 104 105 #endif /* _BLOCK_H_ */ 30 #endif /* _IOC_ATA_ */
Note: See TracChangeset
for help on using the changeset viewer.