Changeset b7fd2a0 in mainline for uspace/drv/block/ahci/ahci.c
- Timestamp:
- 2018-01-13T03:10:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/ahci/ahci.c
r36f0738 rb7fd2a0 109 109 } 110 110 111 static int get_sata_device_name(ddf_fun_t *, size_t, char *);112 static int get_num_blocks(ddf_fun_t *, uint64_t *);113 static int get_block_size(ddf_fun_t *, size_t *);114 static int read_blocks(ddf_fun_t *, uint64_t, size_t, void *);115 static int write_blocks(ddf_fun_t *, uint64_t, size_t, void *);116 117 static int ahci_identify_device(sata_dev_t *);118 static int ahci_set_highest_ultra_dma_mode(sata_dev_t *);119 static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);120 static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);111 static errno_t get_sata_device_name(ddf_fun_t *, size_t, char *); 112 static errno_t get_num_blocks(ddf_fun_t *, uint64_t *); 113 static errno_t get_block_size(ddf_fun_t *, size_t *); 114 static errno_t read_blocks(ddf_fun_t *, uint64_t, size_t, void *); 115 static errno_t write_blocks(ddf_fun_t *, uint64_t, size_t, void *); 116 117 static errno_t ahci_identify_device(sata_dev_t *); 118 static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *); 119 static errno_t ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t); 120 static errno_t ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t); 121 121 122 122 static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *); … … 124 124 static void ahci_ahci_hw_start(ahci_dev_t *); 125 125 126 static int ahci_dev_add(ddf_dev_t *);126 static errno_t ahci_dev_add(ddf_dev_t *); 127 127 128 128 static void ahci_get_model_name(uint16_t *, char *); … … 177 177 * 178 178 */ 179 static int get_sata_device_name(ddf_fun_t *fun,179 static errno_t get_sata_device_name(ddf_fun_t *fun, 180 180 size_t sata_dev_name_length, char *sata_dev_name) 181 181 { … … 193 193 * 194 194 */ 195 static int get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)195 static errno_t get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks) 196 196 { 197 197 sata_dev_t *sata = fun_sata_dev(fun); … … 208 208 * 209 209 */ 210 static int get_block_size(ddf_fun_t *fun, size_t *block_size)210 static errno_t get_block_size(ddf_fun_t *fun, size_t *block_size) 211 211 { 212 212 sata_dev_t *sata = fun_sata_dev(fun); … … 225 225 * 226 226 */ 227 static int read_blocks(ddf_fun_t *fun, uint64_t blocknum,227 static errno_t read_blocks(ddf_fun_t *fun, uint64_t blocknum, 228 228 size_t count, void *buf) 229 229 { … … 232 232 uintptr_t phys; 233 233 void *ibuf = AS_AREA_ANY; 234 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,234 errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 235 235 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); 236 236 if (rc != EOK) { … … 268 268 * 269 269 */ 270 static int write_blocks(ddf_fun_t *fun, uint64_t blocknum,270 static errno_t write_blocks(ddf_fun_t *fun, uint64_t blocknum, 271 271 size_t count, void *buf) 272 272 { … … 275 275 uintptr_t phys; 276 276 void *ibuf = AS_AREA_ANY; 277 int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,277 errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB, 278 278 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf); 279 279 if (rc != EOK) { … … 424 424 * 425 425 */ 426 static int ahci_identify_device(sata_dev_t *sata)426 static errno_t ahci_identify_device(sata_dev_t *sata) 427 427 { 428 428 if (sata->is_invalid_device) { … … 434 434 uintptr_t phys; 435 435 sata_identify_data_t *idata = AS_AREA_ANY; 436 int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,436 errno_t rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH, 437 437 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 438 438 (void *) &idata); … … 605 605 * 606 606 */ 607 static int ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)607 static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *sata) 608 608 { 609 609 if (sata->is_invalid_device) { … … 628 628 uintptr_t phys; 629 629 sata_identify_data_t *idata = AS_AREA_ANY; 630 int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,630 errno_t rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH, 631 631 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys, 632 632 (void *) &idata); … … 734 734 * 735 735 */ 736 static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)736 static errno_t ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum) 737 737 { 738 738 if (sata->is_invalid_device) { … … 822 822 * 823 823 */ 824 static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)824 static errno_t ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum) 825 825 { 826 826 if (sata->is_invalid_device) { … … 949 949 950 950 /* Allocate and init retfis structure. */ 951 int rc = dmamem_map_anonymous(size, DMAMEM_4GiB,951 errno_t rc = dmamem_map_anonymous(size, DMAMEM_4GiB, 952 952 AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb); 953 953 if (rc != EOK) … … 1038 1038 * 1039 1039 */ 1040 static int ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,1040 static errno_t ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev, 1041 1041 volatile ahci_port_t *port, unsigned int port_num) 1042 1042 { 1043 1043 ddf_fun_t *fun = NULL; 1044 int rc;1044 errno_t rc; 1045 1045 1046 1046 sata_dev_t *sata = ahci_sata_allocate(ahci, port); … … 1185 1185 1186 1186 int irq_cap; 1187 int rc = register_interrupt_handler(dev,1187 errno_t rc = register_interrupt_handler(dev, 1188 1188 hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct, &irq_cap); 1189 1189 if (rc != EOK) { … … 1255 1255 * 1256 1256 */ 1257 static int ahci_dev_add(ddf_dev_t *dev)1257 static errno_t ahci_dev_add(ddf_dev_t *dev) 1258 1258 { 1259 1259 ahci_dev_t *ahci = ahci_ahci_create(dev);
Note:
See TracChangeset
for help on using the changeset viewer.