Changeset 2791fbb7 in mainline for uspace/drv/block/ata_bd/ata_bd.h
- Timestamp:
- 2024-05-16T16:17:49Z (8 months ago)
- Branches:
- master
- Children:
- 59c0f478
- Parents:
- 64cf7a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/ata_bd/ata_bd.h
r64cf7a3 r2791fbb7 36 36 #define __ATA_BD_H__ 37 37 38 #include <a sync.h>39 #include < bd_srv.h>38 #include <ata/ata.h> 39 #include <ata/ata_hw.h> 40 40 #include <ddf/driver.h> 41 41 #include <fibril_synch.h> 42 42 #include <stdbool.h> 43 #include <str.h>44 43 #include <stdint.h> 45 #include <stddef.h>46 #include "ata_hw.h"47 44 48 45 #define NAME "ata_bd" … … 54 51 int irq; /**< IRQ */ 55 52 } ata_hwres_t; 56 57 /** Timeout definitions. Unit is 10 ms. */58 enum ata_timeout {59 TIMEOUT_PROBE = 100, /* 1 s */60 TIMEOUT_BSY = 100, /* 1 s */61 TIMEOUT_DRDY = 1000 /* 10 s */62 };63 64 enum ata_dev_type {65 ata_reg_dev, /* Register device (no packet feature set support) */66 ata_pkt_dev /* Packet device (supports packet feature set). */67 };68 69 /** Register device block addressing mode. */70 enum rd_addr_mode {71 am_chs, /**< CHS block addressing */72 am_lba28, /**< LBA-28 block addressing */73 am_lba48 /**< LBA-48 block addressing */74 };75 76 /** Block coordinates */77 typedef struct {78 enum rd_addr_mode amode;79 80 union {81 /** CHS coordinates */82 struct {83 uint8_t sector;84 uint8_t cyl_lo;85 uint8_t cyl_hi;86 };87 /** LBA coordinates */88 struct {89 uint8_t c0;90 uint8_t c1;91 uint8_t c2;92 uint8_t c3;93 uint8_t c4;94 uint8_t c5;95 };96 };97 98 /** Lower 4 bits for device/head register */99 uint8_t h;100 } block_coord_t;101 102 /** ATA device state structure. */103 typedef struct {104 bool present;105 struct ata_ctrl *ctrl;106 struct ata_fun *afun;107 108 /** Device type */109 enum ata_dev_type dev_type;110 111 /** Addressing mode to use (if register device) */112 enum rd_addr_mode amode;113 114 /*115 * Geometry. Only valid if operating in CHS mode.116 */117 struct {118 unsigned heads;119 unsigned cylinders;120 unsigned sectors;121 } geom;122 123 uint64_t blocks;124 size_t block_size;125 126 char model[STR_BOUNDS(40) + 1];127 128 int disk_id;129 } disk_t;130 53 131 54 /** ATA controller */ … … 147 70 cap_irq_handle_t ihandle; 148 71 149 /** Per-disk state. */150 disk_t disk[MAX_DISKS];151 152 72 /** Synchronize controller access */ 153 73 fibril_mutex_t lock; 154 /** Synchronize access to irq_fired/irq_status */155 fibril_mutex_t irq_lock;156 /** Signalled by IRQ handler */157 fibril_condvar_t irq_cv;158 /** Set to true when interrupt occurs */159 bool irq_fired;160 74 /** Value of status register read by interrupt handler */ 161 75 uint8_t irq_status; 76 77 /** Libata ATA channel */ 78 ata_channel_t *channel; 79 struct ata_fun *fun[2]; 162 80 } ata_ctrl_t; 163 81 164 82 typedef struct ata_fun { 165 83 ddf_fun_t *fun; 166 disk_t *disk; 167 bd_srvs_t bds; 84 void *charg; 168 85 } ata_fun_t; 169 86 … … 172 89 extern errno_t ata_ctrl_gone(ata_ctrl_t *); 173 90 174 extern bd_ops_t ata_bd_ops;175 176 91 #endif 177 92
Note:
See TracChangeset
for help on using the changeset viewer.