Changeset 59c0f478 in mainline for uspace/drv/block/isa-ide/main.c


Ignore:
Timestamp:
2024-05-16T18:20:35Z (9 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
646849b3
Parents:
2791fbb7
Message:

Rename ata_bd → isa-ide

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/isa-ide/main.c

    r2791fbb7 r59c0f478  
    2727 */
    2828
    29 /** @addtogroup ata_bd
     29/** @addtogroup isa-ide
    3030 * @{
    3131 */
     
    4242#include <device/hw_res_parsed.h>
    4343
    44 #include "ata_bd.h"
     44#include "isa-ide.h"
    4545#include "main.h"
    4646
    47 static errno_t ata_dev_add(ddf_dev_t *dev);
    48 static errno_t ata_dev_remove(ddf_dev_t *dev);
    49 static errno_t ata_dev_gone(ddf_dev_t *dev);
    50 static errno_t ata_fun_online(ddf_fun_t *fun);
    51 static errno_t ata_fun_offline(ddf_fun_t *fun);
    52 
    53 static void ata_bd_connection(ipc_call_t *, void *);
     47static errno_t isa_ide_dev_add(ddf_dev_t *dev);
     48static errno_t isa_ide_dev_remove(ddf_dev_t *dev);
     49static errno_t isa_ide_dev_gone(ddf_dev_t *dev);
     50static errno_t isa_ide_fun_online(ddf_fun_t *fun);
     51static errno_t isa_ide_fun_offline(ddf_fun_t *fun);
     52
     53static void isa_ide_connection(ipc_call_t *, void *);
    5454
    5555static driver_ops_t driver_ops = {
    56         .dev_add = &ata_dev_add,
    57         .dev_remove = &ata_dev_remove,
    58         .dev_gone = &ata_dev_gone,
    59         .fun_online = &ata_fun_online,
    60         .fun_offline = &ata_fun_offline
     56        .dev_add = &isa_ide_dev_add,
     57        .dev_remove = &isa_ide_dev_remove,
     58        .dev_gone = &isa_ide_dev_gone,
     59        .fun_online = &isa_ide_fun_online,
     60        .fun_offline = &isa_ide_fun_offline
    6161};
    6262
    63 static driver_t ata_driver = {
     63static driver_t isa_ide_driver = {
    6464        .name = NAME,
    6565        .driver_ops = &driver_ops
    6666};
    6767
    68 static errno_t ata_get_res(ddf_dev_t *dev, ata_hwres_t *ata_res)
     68static errno_t ata_get_res(ddf_dev_t *dev, isa_ide_hwres_t *ata_res)
    6969{
    7070        async_sess_t *parent_sess;
     
    121121 * @return     EOK on success or an error code.
    122122 */
    123 static errno_t ata_dev_add(ddf_dev_t *dev)
    124 {
    125         ata_ctrl_t *ctrl;
    126         ata_hwres_t res;
     123static errno_t isa_ide_dev_add(ddf_dev_t *dev)
     124{
     125        isa_ide_ctrl_t *ctrl;
     126        isa_ide_hwres_t res;
    127127        errno_t rc;
    128128
     
    133133        }
    134134
    135         ctrl = ddf_dev_data_alloc(dev, sizeof(ata_ctrl_t));
     135        ctrl = ddf_dev_data_alloc(dev, sizeof(isa_ide_ctrl_t));
    136136        if (ctrl == NULL) {
    137137                ddf_msg(LVL_ERROR, "Failed allocating soft state.");
     
    142142        ctrl->dev = dev;
    143143
    144         rc = ata_ctrl_init(ctrl, &res);
     144        rc = isa_ide_ctrl_init(ctrl, &res);
    145145        if (rc == ENOENT)
    146146                goto error;
     
    157157}
    158158
    159 static char *ata_fun_name(unsigned idx)
     159static char *isa_ide_fun_name(unsigned idx)
    160160{
    161161        char *fun_name;
     
    167167}
    168168
    169 errno_t ata_fun_create(ata_ctrl_t *ctrl, unsigned idx, void *charg)
     169errno_t isa_ide_fun_create(isa_ide_ctrl_t *ctrl, unsigned idx, void *charg)
    170170{
    171171        errno_t rc;
    172172        char *fun_name = NULL;
    173173        ddf_fun_t *fun = NULL;
    174         ata_fun_t *afun = NULL;
     174        isa_ide_fun_t *ifun = NULL;
    175175        bool bound = false;
    176176
    177         fun_name = ata_fun_name(idx);
     177        fun_name = isa_ide_fun_name(idx);
    178178        if (fun_name == NULL) {
    179179                ddf_msg(LVL_ERROR, "Out of memory.");
     
    190190
    191191        /* Allocate soft state */
    192         afun = ddf_fun_data_alloc(fun, sizeof(ata_fun_t));
    193         if (afun == NULL) {
     192        ifun = ddf_fun_data_alloc(fun, sizeof(isa_ide_fun_t));
     193        if (ifun == NULL) {
    194194                ddf_msg(LVL_ERROR, "Failed allocating softstate.");
    195195                rc = ENOMEM;
     
    197197        }
    198198
    199         afun->fun = fun;
    200         afun->charg = charg;
     199        ifun->fun = fun;
     200        ifun->charg = charg;
    201201
    202202        /* Set up a connection handler. */
    203         ddf_fun_set_conn_handler(fun, ata_bd_connection);
     203        ddf_fun_set_conn_handler(fun, isa_ide_connection);
    204204
    205205        rc = ddf_fun_bind(fun);
     
    232232}
    233233
    234 errno_t ata_fun_remove(ata_ctrl_t *ctrl, unsigned idx)
     234errno_t isa_ide_fun_remove(isa_ide_ctrl_t *ctrl, unsigned idx)
    235235{
    236236        errno_t rc;
    237237        char *fun_name;
    238         ata_fun_t *afun = ctrl->fun[idx];
    239 
    240         fun_name = ata_fun_name(idx);
     238        isa_ide_fun_t *ifun = ctrl->fun[idx];
     239
     240        fun_name = isa_ide_fun_name(idx);
    241241        if (fun_name == NULL) {
    242242                ddf_msg(LVL_ERROR, "Out of memory.");
     
    245245        }
    246246
    247         ddf_msg(LVL_DEBUG, "ata_fun_remove(%p, '%s')", afun, fun_name);
    248         rc = ddf_fun_offline(afun->fun);
     247        ddf_msg(LVL_DEBUG, "isa_ide_fun_remove(%p, '%s')", ifun, fun_name);
     248        rc = ddf_fun_offline(ifun->fun);
    249249        if (rc != EOK) {
    250250                ddf_msg(LVL_ERROR, "Error offlining function '%s'.", fun_name);
     
    252252        }
    253253
    254         rc = ddf_fun_unbind(afun->fun);
     254        rc = ddf_fun_unbind(ifun->fun);
    255255        if (rc != EOK) {
    256256                ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
     
    258258        }
    259259
    260         ddf_fun_destroy(afun->fun);
     260        ddf_fun_destroy(ifun->fun);
    261261        free(fun_name);
    262262        return EOK;
     
    267267}
    268268
    269 errno_t ata_fun_unbind(ata_ctrl_t *ctrl, unsigned idx)
     269errno_t isa_ide_fun_unbind(isa_ide_ctrl_t *ctrl, unsigned idx)
    270270{
    271271        errno_t rc;
    272272        char *fun_name;
    273         ata_fun_t *afun = ctrl->fun[idx];
    274 
    275         fun_name = ata_fun_name(idx);
     273        isa_ide_fun_t *ifun = ctrl->fun[idx];
     274
     275        fun_name = isa_ide_fun_name(idx);
    276276        if (fun_name == NULL) {
    277277                ddf_msg(LVL_ERROR, "Out of memory.");
     
    280280        }
    281281
    282         ddf_msg(LVL_DEBUG, "ata_fun_unbind(%p, '%s')", afun, fun_name);
    283         rc = ddf_fun_unbind(afun->fun);
     282        ddf_msg(LVL_DEBUG, "isa_ide_fun_unbind(%p, '%s')", ifun, fun_name);
     283        rc = ddf_fun_unbind(ifun->fun);
    284284        if (rc != EOK) {
    285285                ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
     
    287287        }
    288288
    289         ddf_fun_destroy(afun->fun);
     289        ddf_fun_destroy(ifun->fun);
    290290        free(fun_name);
    291291        return EOK;
     
    296296}
    297297
    298 static errno_t ata_dev_remove(ddf_dev_t *dev)
    299 {
    300         ata_ctrl_t *ctrl = (ata_ctrl_t *)ddf_dev_data_get(dev);
    301 
    302         ddf_msg(LVL_DEBUG, "ata_dev_remove(%p)", dev);
    303 
    304         return ata_ctrl_remove(ctrl);
    305 }
    306 
    307 static errno_t ata_dev_gone(ddf_dev_t *dev)
    308 {
    309         ata_ctrl_t *ctrl = (ata_ctrl_t *)ddf_dev_data_get(dev);
    310 
    311         ddf_msg(LVL_DEBUG, "ata_dev_gone(%p)", dev);
    312 
    313         return ata_ctrl_gone(ctrl);
    314 }
    315 
    316 static errno_t ata_fun_online(ddf_fun_t *fun)
    317 {
    318         ddf_msg(LVL_DEBUG, "ata_fun_online()");
     298static errno_t isa_ide_dev_remove(ddf_dev_t *dev)
     299{
     300        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
     301
     302        ddf_msg(LVL_DEBUG, "isa_ide_dev_remove(%p)", dev);
     303
     304        return isa_ide_ctrl_remove(ctrl);
     305}
     306
     307static errno_t isa_ide_dev_gone(ddf_dev_t *dev)
     308{
     309        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
     310
     311        ddf_msg(LVL_DEBUG, "isa_ide_dev_gone(%p)", dev);
     312
     313        return isa_ide_ctrl_gone(ctrl);
     314}
     315
     316static errno_t isa_ide_fun_online(ddf_fun_t *fun)
     317{
     318        ddf_msg(LVL_DEBUG, "isa_ide_fun_online()");
    319319        return ddf_fun_online(fun);
    320320}
    321321
    322 static errno_t ata_fun_offline(ddf_fun_t *fun)
    323 {
    324         ddf_msg(LVL_DEBUG, "ata_fun_offline()");
     322static errno_t isa_ide_fun_offline(ddf_fun_t *fun)
     323{
     324        ddf_msg(LVL_DEBUG, "isa_ide_fun_offline()");
    325325        return ddf_fun_offline(fun);
    326326}
    327327
    328 static void ata_bd_connection(ipc_call_t *icall, void *arg)
    329 {
    330         ata_fun_t *afun;
    331 
    332         afun = (ata_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
    333         ata_connection(icall, afun->charg);
     328static void isa_ide_connection(ipc_call_t *icall, void *arg)
     329{
     330        isa_ide_fun_t *ifun;
     331
     332        ifun = (isa_ide_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
     333        ata_connection(icall, ifun->charg);
    334334}
    335335
    336336int main(int argc, char *argv[])
    337337{
    338         printf(NAME ": HelenOS ATA(PI) device driver\n");
     338        printf(NAME ": HelenOS ISA IDE device driver\n");
    339339        ddf_log_init(NAME);
    340         return ddf_driver_main(&ata_driver);
     340        return ddf_driver_main(&isa_ide_driver);
    341341}
    342342
Note: See TracChangeset for help on using the changeset viewer.