Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/ahci/ahci.c

    rb7fd2a0 r01c3bb4  
    109109        }
    110110
    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);
     111static int get_sata_device_name(ddf_fun_t *, size_t, char *);
     112static int get_num_blocks(ddf_fun_t *, uint64_t *);
     113static int get_block_size(ddf_fun_t *, size_t *);
     114static int read_blocks(ddf_fun_t *, uint64_t, size_t, void *);
     115static int write_blocks(ddf_fun_t *, uint64_t, size_t, void *);
     116
     117static int ahci_identify_device(sata_dev_t *);
     118static int ahci_set_highest_ultra_dma_mode(sata_dev_t *);
     119static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
     120static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
    121121
    122122static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *);
     
    124124static void ahci_ahci_hw_start(ahci_dev_t *);
    125125
    126 static errno_t ahci_dev_add(ddf_dev_t *);
     126static int ahci_dev_add(ddf_dev_t *);
    127127
    128128static void ahci_get_model_name(uint16_t *, char *);
     
    177177 *
    178178 */
    179 static errno_t get_sata_device_name(ddf_fun_t *fun,
     179static int get_sata_device_name(ddf_fun_t *fun,
    180180    size_t sata_dev_name_length, char *sata_dev_name)
    181181{
     
    193193 *
    194194 */
    195 static errno_t get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
     195static int get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
    196196{
    197197        sata_dev_t *sata = fun_sata_dev(fun);
     
    208208 *
    209209 */
    210 static errno_t get_block_size(ddf_fun_t *fun, size_t *block_size)
     210static int get_block_size(ddf_fun_t *fun, size_t *block_size)
    211211{
    212212        sata_dev_t *sata = fun_sata_dev(fun);
     
    225225 *
    226226 */
    227 static errno_t read_blocks(ddf_fun_t *fun, uint64_t blocknum,
     227static int read_blocks(ddf_fun_t *fun, uint64_t blocknum,
    228228    size_t count, void *buf)
    229229{
     
    232232        uintptr_t phys;
    233233        void *ibuf = AS_AREA_ANY;
    234         errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
     234        int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
    235235            AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
    236236        if (rc != EOK) {
     
    268268 *
    269269 */
    270 static errno_t write_blocks(ddf_fun_t *fun, uint64_t blocknum,
     270static int write_blocks(ddf_fun_t *fun, uint64_t blocknum,
    271271    size_t count, void *buf)
    272272{
     
    275275        uintptr_t phys;
    276276        void *ibuf = AS_AREA_ANY;
    277         errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
     277        int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
    278278            AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
    279279        if (rc != EOK) {
     
    424424 *
    425425 */
    426 static errno_t ahci_identify_device(sata_dev_t *sata)
     426static int ahci_identify_device(sata_dev_t *sata)
    427427{
    428428        if (sata->is_invalid_device) {
     
    434434        uintptr_t phys;
    435435        sata_identify_data_t *idata = AS_AREA_ANY;
    436         errno_t rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
     436        int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
    437437            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
    438438            (void *) &idata);
     
    605605 *
    606606 */
    607 static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)
     607static int ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)
    608608{
    609609        if (sata->is_invalid_device) {
     
    628628        uintptr_t phys;
    629629        sata_identify_data_t *idata = AS_AREA_ANY;
    630         errno_t rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
     630        int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
    631631            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
    632632            (void *) &idata);
     
    734734 *
    735735 */
    736 static errno_t ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
     736static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
    737737{
    738738        if (sata->is_invalid_device) {
     
    822822 *
    823823 */
    824 static errno_t ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
     824static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
    825825{
    826826        if (sata->is_invalid_device) {
     
    949949       
    950950        /* Allocate and init retfis structure. */
    951         errno_t rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
     951        int rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
    952952            AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb);
    953953        if (rc != EOK)
     
    10381038 *
    10391039 */
    1040 static errno_t ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,
     1040static int ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,
    10411041    volatile ahci_port_t *port, unsigned int port_num)
    10421042{
    10431043        ddf_fun_t *fun = NULL;
    1044         errno_t rc;
     1044        int rc;
    10451045       
    10461046        sata_dev_t *sata = ahci_sata_allocate(ahci, port);
     
    11841184        ct.ranges = ahci_ranges;
    11851185       
    1186         int irq_cap;
    1187         errno_t rc = register_interrupt_handler(dev,
    1188             hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct, &irq_cap);
    1189         if (rc != EOK) {
     1186        int irq_cap = register_interrupt_handler(dev,
     1187            hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct);
     1188        if (irq_cap < 0) {
    11901189                ddf_msg(LVL_ERROR, "Failed registering interrupt handler.");
    11911190                goto error_register_interrupt_handler;
    11921191        }
    11931192       
    1194         rc = hw_res_enable_interrupt(ahci->parent_sess,
     1193        int rc = hw_res_enable_interrupt(ahci->parent_sess,
    11951194            hw_res_parsed.irqs.irqs[0]);
    11961195        if (rc != EOK) {
     
    12551254 *
    12561255 */
    1257 static errno_t ahci_dev_add(ddf_dev_t *dev)     
     1256static int ahci_dev_add(ddf_dev_t *dev)
    12581257{
    12591258        ahci_dev_t *ahci = ahci_ahci_create(dev);
Note: See TracChangeset for help on using the changeset viewer.