Changeset 59c0f478 in mainline


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

Rename ata_bd → isa-ide

Files:
2 added
2 deleted
6 edited
5 moved

Legend:

Unmodified
Added
Removed
  • meson/arch/amd64/meson.build

    r2791fbb7 r59c0f478  
    6262        'drv/intctl/i8259',
    6363        'drv/platform/pc',
    64         'drv/block/ata_bd',
     64        'drv/block/isa-ide',
    6565        'drv/bus/pci/pciintel',
    6666        'drv/bus/isa',
     
    7676        'drv/audio/sb16',
    7777        'drv/block/ahci',
    78         'drv/block/ata_bd',
     78        'drv/block/isa-ide',
    7979        'drv/block/usbmast',
    8080        'drv/block/virtio-blk',
  • meson/arch/ia32/meson.build

    r2791fbb7 r59c0f478  
    6868        'drv/intctl/i8259',
    6969        'drv/platform/pc',
    70         'drv/block/ata_bd',
     70        'drv/block/isa-ide',
    7171        'drv/bus/pci/pciintel',
    7272        'drv/bus/isa',
     
    8282        'drv/audio/sb16',
    8383        'drv/block/ahci',
    84         'drv/block/ata_bd',
     84        'drv/block/isa-ide',
    8585        'drv/block/usbmast',
    8686        'drv/block/virtio-blk',
  • meson/arch/mips32/meson.build

    r2791fbb7 r59c0f478  
    6767                'drv/platform/malta',
    6868                'drv/intctl/i8259',
    69                 'drv/block/ata_bd',
     69                'drv/block/isa-ide',
    7070                'drv/bus/pci/pciintel',
    7171                'drv/bus/isa',
  • uspace/drv/block/isa-ide/isa-ide.c

    r2791fbb7 r59c0f478  
    2727 */
    2828
    29 /** @addtogroup ata_bd
     29/** @addtogroup isa-ide
    3030 * @{
    3131 */
     
    3333/**
    3434 * @file
    35  * @brief ISA ATA driver
     35 * @brief ISA IDE driver
    3636 *
    3737 * The driver services a single IDE channel.
     
    5252#include <errno.h>
    5353
    54 #include "ata_bd.h"
     54#include "isa-ide.h"
    5555#include "main.h"
    5656
    57 #define NAME       "ata_bd"
    58 
    59 static errno_t ata_bd_init_io(ata_ctrl_t *ctrl);
    60 static void ata_bd_fini_io(ata_ctrl_t *ctrl);
    61 static errno_t ata_bd_init_irq(ata_ctrl_t *ctrl);
    62 static void ata_bd_fini_irq(ata_ctrl_t *ctrl);
    63 static void ata_irq_handler(ipc_call_t *call, ddf_dev_t *dev);
    64 
    65 static void ata_write_data_16(void *, uint16_t *, size_t);
    66 static void ata_read_data_16(void *, uint16_t *, size_t);
    67 static void ata_write_cmd_8(void *, uint16_t, uint8_t);
    68 static uint8_t ata_read_cmd_8(void *, uint16_t);
    69 static void ata_write_ctl_8(void *, uint16_t, uint8_t);
    70 static uint8_t ata_read_ctl_8(void *, uint16_t);
    71 static errno_t ata_irq_enable(void *);
    72 static errno_t ata_irq_disable(void *);
    73 static errno_t ata_add_device(void *, unsigned, void *);
    74 static errno_t ata_remove_device(void *, unsigned);
    75 static void ata_msg_debug(void *, char *);
    76 static void ata_msg_note(void *, char *);
    77 static void ata_msg_warn(void *, char *);
    78 static void ata_msg_error(void *, char *);
    79 
    80 static const irq_pio_range_t ata_irq_ranges[] = {
     57static errno_t isa_ide_init_io(isa_ide_ctrl_t *ctrl);
     58static void isa_ide_fini_io(isa_ide_ctrl_t *ctrl);
     59static errno_t isa_ide_init_irq(isa_ide_ctrl_t *ctrl);
     60static void isa_ide_fini_irq(isa_ide_ctrl_t *ctrl);
     61static void isa_ide_irq_handler(ipc_call_t *call, ddf_dev_t *dev);
     62
     63static void isa_ide_write_data_16(void *, uint16_t *, size_t);
     64static void isa_ide_read_data_16(void *, uint16_t *, size_t);
     65static void isa_ide_write_cmd_8(void *, uint16_t, uint8_t);
     66static uint8_t isa_ide_read_cmd_8(void *, uint16_t);
     67static void isa_ide_write_ctl_8(void *, uint16_t, uint8_t);
     68static uint8_t isa_ide_read_ctl_8(void *, uint16_t);
     69static errno_t isa_ide_irq_enable(void *);
     70static errno_t isa_ide_irq_disable(void *);
     71static errno_t isa_ide_add_device(void *, unsigned, void *);
     72static errno_t isa_ide_remove_device(void *, unsigned);
     73static void isa_ide_msg_debug(void *, char *);
     74static void isa_ide_msg_note(void *, char *);
     75static void isa_ide_msg_warn(void *, char *);
     76static void isa_ide_msg_error(void *, char *);
     77
     78static const irq_pio_range_t isa_ide_irq_ranges[] = {
    8179        {
    8280                .base = 0,
     
    8583};
    8684
    87 /** ATA interrupt pseudo code. */
    88 static const irq_cmd_t ata_irq_cmds[] = {
     85/** IDE interrupt pseudo code. */
     86static const irq_cmd_t isa_ide_irq_cmds[] = {
    8987        {
    9088                .cmd = CMD_PIO_READ_8,
     
    9795};
    9896
    99 /** Initialize ATA controller. */
    100 errno_t ata_ctrl_init(ata_ctrl_t *ctrl, ata_hwres_t *res)
     97/** Initialize ISA IDE controller. */
     98errno_t isa_ide_ctrl_init(isa_ide_ctrl_t *ctrl, isa_ide_hwres_t *res)
    10199{
    102100        errno_t rc;
     
    104102        ata_params_t params;
    105103
    106         ddf_msg(LVL_DEBUG, "ata_ctrl_init()");
     104        ddf_msg(LVL_DEBUG, "isa_ide_ctrl_init()");
    107105
    108106        fibril_mutex_initialize(&ctrl->lock);
     
    115113
    116114        ddf_msg(LVL_DEBUG, "Init I/O");
    117         rc = ata_bd_init_io(ctrl);
     115        rc = isa_ide_init_io(ctrl);
    118116        if (rc != EOK)
    119117                return rc;
    120118
    121119        ddf_msg(LVL_DEBUG, "Init IRQ");
    122         rc = ata_bd_init_irq(ctrl);
     120        rc = isa_ide_init_irq(ctrl);
    123121        if (rc != EOK) {
    124122                ddf_msg(LVL_NOTE, "init IRQ failed");
     
    128126        irq_inited = true;
    129127
    130         ddf_msg(LVL_DEBUG, "ata_ctrl_init(): Initialize ATA channel");
     128        ddf_msg(LVL_DEBUG, "isa_ide_ctrl_init(): Initialize IDE channel");
    131129
    132130        params.arg = (void *)ctrl;
    133131        params.have_irq = (ctrl->irq >= 0) ? true : false;
    134         params.write_data_16 = ata_write_data_16;
    135         params.read_data_16 = ata_read_data_16;
    136         params.write_cmd_8 = ata_write_cmd_8;
    137         params.read_cmd_8 = ata_read_cmd_8;
    138         params.write_ctl_8 = ata_write_ctl_8;
    139         params.read_ctl_8 = ata_read_ctl_8;
    140         params.irq_enable = ata_irq_enable;
    141         params.irq_disable = ata_irq_disable;
    142         params.add_device = ata_add_device;
    143         params.remove_device = ata_remove_device;
    144         params.msg_debug = ata_msg_debug;
    145         params.msg_note = ata_msg_note;
    146         params.msg_warn = ata_msg_warn;
    147         params.msg_error = ata_msg_error;
     132        params.write_data_16 = isa_ide_write_data_16;
     133        params.read_data_16 = isa_ide_read_data_16;
     134        params.write_cmd_8 = isa_ide_write_cmd_8;
     135        params.read_cmd_8 = isa_ide_read_cmd_8;
     136        params.write_ctl_8 = isa_ide_write_ctl_8;
     137        params.read_ctl_8 = isa_ide_read_ctl_8;
     138        params.irq_enable = isa_ide_irq_enable;
     139        params.irq_disable = isa_ide_irq_disable;
     140        params.add_device = isa_ide_add_device;
     141        params.remove_device = isa_ide_remove_device;
     142        params.msg_debug = isa_ide_msg_debug;
     143        params.msg_note = isa_ide_msg_note;
     144        params.msg_warn = isa_ide_msg_warn;
     145        params.msg_error = isa_ide_msg_error;
    148146
    149147        rc = ata_channel_create(&params, &ctrl->channel);
     
    155153                goto error;
    156154
    157         ddf_msg(LVL_DEBUG, "ata_ctrl_init: DONE");
     155        ddf_msg(LVL_DEBUG, "isa_ide_ctrl_init: DONE");
    158156        return EOK;
    159157error:
    160158        if (irq_inited)
    161                 ata_bd_fini_irq(ctrl);
    162         ata_bd_fini_io(ctrl);
     159                isa_ide_fini_irq(ctrl);
     160        isa_ide_fini_io(ctrl);
    163161        return rc;
    164162}
    165163
    166 /** Remove ATA controller. */
    167 errno_t ata_ctrl_remove(ata_ctrl_t *ctrl)
    168 {
    169         errno_t rc;
    170 
    171         ddf_msg(LVL_DEBUG, ": ata_ctrl_remove()");
     164/** Remove ISA IDE controller. */
     165errno_t isa_ide_ctrl_remove(isa_ide_ctrl_t *ctrl)
     166{
     167        errno_t rc;
     168
     169        ddf_msg(LVL_DEBUG, ": isa_ide_ctrl_remove()");
    172170
    173171        fibril_mutex_lock(&ctrl->lock);
     
    179177        }
    180178
    181         ata_bd_fini_irq(ctrl);
    182         ata_bd_fini_io(ctrl);
     179        isa_ide_fini_irq(ctrl);
     180        isa_ide_fini_io(ctrl);
    183181        fibril_mutex_unlock(&ctrl->lock);
    184182
     
    186184}
    187185
    188 /** Surprise removal of ATA controller. */
    189 errno_t ata_ctrl_gone(ata_ctrl_t *ctrl)
    190 {
    191         errno_t rc;
    192 
    193         ddf_msg(LVL_DEBUG, "ata_ctrl_gone()");
     186/** Surprise removal of ISA IDE controller. */
     187errno_t isa_ide_ctrl_gone(isa_ide_ctrl_t *ctrl)
     188{
     189        errno_t rc;
     190
     191        ddf_msg(LVL_DEBUG, "isa_ide_ctrl_gone()");
    194192
    195193        fibril_mutex_lock(&ctrl->lock);
     
    201199        }
    202200
    203         ata_bd_fini_io(ctrl);
     201        isa_ide_fini_io(ctrl);
    204202        fibril_mutex_unlock(&ctrl->lock);
    205203
     
    208206
    209207/** Enable device I/O. */
    210 static errno_t ata_bd_init_io(ata_ctrl_t *ctrl)
     208static errno_t isa_ide_init_io(isa_ide_ctrl_t *ctrl)
    211209{
    212210        errno_t rc;
     
    232230
    233231/** Clean up device I/O. */
    234 static void ata_bd_fini_io(ata_ctrl_t *ctrl)
     232static void isa_ide_fini_io(isa_ide_ctrl_t *ctrl)
    235233{
    236234        (void) ctrl;
     
    239237
    240238/** Initialize IRQ. */
    241 static errno_t ata_bd_init_irq(ata_ctrl_t *ctrl)
     239static errno_t isa_ide_init_irq(isa_ide_ctrl_t *ctrl)
    242240{
    243241        irq_code_t irq_code;
     
    249247                return EOK;
    250248
    251         ranges = malloc(sizeof(ata_irq_ranges));
     249        ranges = malloc(sizeof(isa_ide_irq_ranges));
    252250        if (ranges == NULL)
    253251                return ENOMEM;
    254252
    255         cmds = malloc(sizeof(ata_irq_cmds));
     253        cmds = malloc(sizeof(isa_ide_irq_cmds));
    256254        if (cmds == NULL) {
    257255                free(cmds);
     
    259257        }
    260258
    261         memcpy(ranges, &ata_irq_ranges, sizeof(ata_irq_ranges));
     259        memcpy(ranges, &isa_ide_irq_ranges, sizeof(isa_ide_irq_ranges));
    262260        ranges[0].base = ctrl->cmd_physical;
    263         memcpy(cmds, &ata_irq_cmds, sizeof(ata_irq_cmds));
     261        memcpy(cmds, &isa_ide_irq_cmds, sizeof(isa_ide_irq_cmds));
    264262        cmds[0].addr = &ctrl->cmd->status;
    265263
    266         irq_code.rangecount = sizeof(ata_irq_ranges) / sizeof(irq_pio_range_t);
     264        irq_code.rangecount = sizeof(isa_ide_irq_ranges) / sizeof(irq_pio_range_t);
    267265        irq_code.ranges = ranges;
    268         irq_code.cmdcount = sizeof(ata_irq_cmds) / sizeof(irq_cmd_t);
     266        irq_code.cmdcount = sizeof(isa_ide_irq_cmds) / sizeof(irq_cmd_t);
    269267        irq_code.cmds = cmds;
    270268
    271269        ddf_msg(LVL_NOTE, "IRQ %d", ctrl->irq);
    272         rc = register_interrupt_handler(ctrl->dev, ctrl->irq, ata_irq_handler,
     270        rc = register_interrupt_handler(ctrl->dev, ctrl->irq, isa_ide_irq_handler,
    273271            &irq_code, &ctrl->ihandle);
    274272        if (rc != EOK) {
     
    288286
    289287/** Clean up IRQ. */
    290 static void ata_bd_fini_irq(ata_ctrl_t *ctrl)
     288static void isa_ide_fini_irq(isa_ide_ctrl_t *ctrl)
    291289{
    292290        errno_t rc;
     
    307305 * @param dev Device that caused the interrupt
    308306 */
    309 static void ata_irq_handler(ipc_call_t *call, ddf_dev_t *dev)
    310 {
    311         ata_ctrl_t *ctrl = (ata_ctrl_t *)ddf_dev_data_get(dev);
     307static void isa_ide_irq_handler(ipc_call_t *call, ddf_dev_t *dev)
     308{
     309        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
    312310        uint8_t status;
    313311        async_sess_t *parent_sess;
     
    322320/** Write the data register callback handler.
    323321 *
    324  * @param arg Argument (ata_ctrl_t *)
     322 * @param arg Argument (isa_ide_ctrl_t *)
    325323 * @param data Data
    326324 * @param nwords Number of words to write
    327325 */
    328 static void ata_write_data_16(void *arg, uint16_t *data, size_t nwords)
    329 {
    330         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     326static void isa_ide_write_data_16(void *arg, uint16_t *data, size_t nwords)
     327{
     328        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    331329        size_t i;
    332330
     
    337335/** Read the data register callback handler.
    338336 *
    339  * @param arg Argument (ata_ctrl_t *)
     337 * @param arg Argument (isa_ide_ctrl_t *)
    340338 * @param buf Destination buffer
    341339 * @param nwords Number of words to read
    342340 */
    343 static void ata_read_data_16(void *arg, uint16_t *buf, size_t nwords)
    344 {
    345         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     341static void isa_ide_read_data_16(void *arg, uint16_t *buf, size_t nwords)
     342{
     343        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    346344        size_t i;
    347345
     
    352350/** Write command register callback handler.
    353351 *
    354  * @param arg Argument (ata_ctrl_t *)
     352 * @param arg Argument (isa_ide_ctrl_t *)
    355353 * @param off Register offset
    356354 * @param value Value to write to command register
    357355 */
    358 static void ata_write_cmd_8(void *arg, uint16_t off, uint8_t value)
    359 {
    360         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     356static void isa_ide_write_cmd_8(void *arg, uint16_t off, uint8_t value)
     357{
     358        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    361359
    362360        pio_write_8(((ioport8_t *)ctrl->cmd) + off, value);
     
    365363/** Read command register callback handler.
    366364 *
    367  * @param arg Argument (ata_ctrl_t *)
     365 * @param arg Argument (isa_ide_ctrl_t *)
    368366 * @param off Register offset
    369367 * @return value Value read from command register
    370368 */
    371 static uint8_t ata_read_cmd_8(void *arg, uint16_t off)
    372 {
    373         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     369static uint8_t isa_ide_read_cmd_8(void *arg, uint16_t off)
     370{
     371        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    374372
    375373        return pio_read_8(((ioport8_t *)ctrl->cmd) + off);
     
    378376/** Write control register callback handler.
    379377 *
    380  * @param arg Argument (ata_ctrl_t *)
     378 * @param arg Argument (isa_ide_ctrl_t *)
    381379 * @param off Register offset
    382380 * @param value Value to write to control register
    383381 */
    384 static void ata_write_ctl_8(void *arg, uint16_t off, uint8_t value)
    385 {
    386         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     382static void isa_ide_write_ctl_8(void *arg, uint16_t off, uint8_t value)
     383{
     384        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    387385
    388386        pio_write_8(((ioport8_t *)ctrl->ctl) + off, value);
     
    391389/** Read control register callback handler.
    392390 *
    393  * @param arg Argument (ata_ctrl_t *)
     391 * @param arg Argument (isa_ide_ctrl_t *)
    394392 * @param off Register offset
    395393 * @return value Value read from control register
    396394 */
    397 static uint8_t ata_read_ctl_8(void *arg, uint16_t off)
    398 {
    399         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     395static uint8_t isa_ide_read_ctl_8(void *arg, uint16_t off)
     396{
     397        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    400398
    401399        return pio_read_8(((ioport8_t *)ctrl->ctl) + off);
     
    404402/** Enable IRQ callback handler
    405403 *
    406  * @param arg Argument (ata_ctrl_t *)
     404 * @param arg Argument (isa_ide_ctrl_t *)
    407405 * @return EOK on success or an error code
    408406 */
    409 static errno_t ata_irq_enable(void *arg)
    410 {
    411         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     407static errno_t isa_ide_irq_enable(void *arg)
     408{
     409        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    412410        async_sess_t *parent_sess;
    413411        errno_t rc;
     
    430428/** Disable IRQ callback handler
    431429 *
    432  * @param arg Argument (ata_ctrl_t *)
     430 * @param arg Argument (isa_ide_ctrl_t *)
    433431 * @return EOK on success or an error code
    434432 */
    435 static errno_t ata_irq_disable(void *arg)
    436 {
    437         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
     433static errno_t isa_ide_irq_disable(void *arg)
     434{
     435        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
    438436        async_sess_t *parent_sess;
    439437        errno_t rc;
     
    456454/** Add ATA device callback handler.
    457455 *
    458  * @param arg Argument (ata_ctrl_t *)
     456 * @param arg Argument (isa_ide_ctrl_t *)
    459457 * @param idx Device index
    460458 * $param charg Connection handler argument
    461459 * @return EOK on success or an error code
    462460 */
    463 static errno_t ata_add_device(void *arg, unsigned idx, void *charg)
    464 {
    465         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
    466         return ata_fun_create(ctrl, idx, charg);
     461static errno_t isa_ide_add_device(void *arg, unsigned idx, void *charg)
     462{
     463        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
     464        return isa_ide_fun_create(ctrl, idx, charg);
    467465}
    468466
    469467/** Remove ATA device callback handler.
    470468 *
    471  * @param arg Argument (ata_ctrl_t *)
     469 * @param arg Argument (isa_ide_ctrl_t *)
    472470 * @param idx Device index
    473471 * @return EOK on success or an error code
    474472 */
    475 static errno_t ata_remove_device(void *arg, unsigned idx)
    476 {
    477         ata_ctrl_t *ctrl = (ata_ctrl_t *)arg;
    478         return ata_fun_remove(ctrl, idx);
     473static errno_t isa_ide_remove_device(void *arg, unsigned idx)
     474{
     475        isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)arg;
     476        return isa_ide_fun_remove(ctrl, idx);
    479477}
    480478
    481479/** Debug message callback handler.
    482480 *
    483  * @param arg Argument (ata_ctrl_t *)
     481 * @param arg Argument (isa_ide_ctrl_t *)
    484482 * @param msg Message
    485483 */
    486 static void ata_msg_debug(void *arg, char *msg)
     484static void isa_ide_msg_debug(void *arg, char *msg)
    487485{
    488486        (void)arg;
     
    492490/** Notice message callback handler.
    493491 *
    494  * @param arg Argument (ata_ctrl_t *)
     492 * @param arg Argument (isa_ide_ctrl_t *)
    495493 * @param msg Message
    496494 */
    497 static void ata_msg_note(void *arg, char *msg)
     495static void isa_ide_msg_note(void *arg, char *msg)
    498496{
    499497        (void)arg;
     
    503501/** Warning message callback handler.
    504502 *
    505  * @param arg Argument (ata_ctrl_t *)
     503 * @param arg Argument (isa_ide_ctrl_t *)
    506504 * @param msg Message
    507505 */
    508 static void ata_msg_warn(void *arg, char *msg)
     506static void isa_ide_msg_warn(void *arg, char *msg)
    509507{
    510508        (void)arg;
     
    514512/** Error message callback handler.
    515513 *
    516  * @param arg Argument (ata_ctrl_t *)
     514 * @param arg Argument (isa_ide_ctrl_t *)
    517515 * @param msg Message
    518516 */
    519 static void ata_msg_error(void *arg, char *msg)
     517static void isa_ide_msg_error(void *arg, char *msg)
    520518{
    521519        (void)arg;
  • uspace/drv/block/isa-ide/isa-ide.h

    r2791fbb7 r59c0f478  
    2727 */
    2828
    29 /** @addtogroup ata_bd
     29/** @addtogroup isa-ide
    3030 * @{
    3131 */
    32 /** @file ATA driver definitions.
     32/** @file ISA IDE driver definitions.
    3333 */
    3434
    35 #ifndef __ATA_BD_H__
    36 #define __ATA_BD_H__
     35#ifndef ISA_IDE_H
     36#define ISA_IDE_H
    3737
    3838#include <ata/ata.h>
     
    4343#include <stdint.h>
    4444
    45 #define NAME "ata_bd"
     45#define NAME "isa-ide"
    4646
    47 /** ATA hardware resources */
     47/** ISA IDE hardware resources */
    4848typedef struct {
    4949        uintptr_t cmd;  /**< Command block base address. */
    5050        uintptr_t ctl;  /**< Control block base address. */
    5151        int irq;        /**< IRQ */
    52 } ata_hwres_t;
     52} isa_ide_hwres_t;
    5353
    54 /** ATA controller */
    55 typedef struct ata_ctrl {
     54/** ISA IDE controller */
     55typedef struct isa_ide_ctrl {
    5656        /** DDF device */
    5757        ddf_dev_t *dev;
     
    7777        /** Libata ATA channel */
    7878        ata_channel_t *channel;
    79         struct ata_fun *fun[2];
    80 } ata_ctrl_t;
     79        struct isa_ide_fun *fun[2];
     80} isa_ide_ctrl_t;
    8181
    82 typedef struct ata_fun {
     82typedef struct isa_ide_fun {
    8383        ddf_fun_t *fun;
    8484        void *charg;
    85 } ata_fun_t;
     85} isa_ide_fun_t;
    8686
    87 extern errno_t ata_ctrl_init(ata_ctrl_t *, ata_hwres_t *);
    88 extern errno_t ata_ctrl_remove(ata_ctrl_t *);
    89 extern errno_t ata_ctrl_gone(ata_ctrl_t *);
     87extern errno_t isa_ide_ctrl_init(isa_ide_ctrl_t *, isa_ide_hwres_t *);
     88extern errno_t isa_ide_ctrl_remove(isa_ide_ctrl_t *);
     89extern errno_t isa_ide_ctrl_gone(isa_ide_ctrl_t *);
    9090
    9191#endif
  • 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
  • uspace/drv/block/isa-ide/main.h

    r2791fbb7 r59c0f478  
    2727 */
    2828
    29 /** @addtogroup ata_bd
     29/** @addtogroup isa-ide
    3030 * @{
    3131 */
    32 /** @file ATA driver main module
     32/** @file ISA IDE driver main module
    3333 */
    3434
    35 #ifndef __ATA_MAIN_H__
    36 #define __ATA_MAIN_H__
     35#ifndef MAIN_H
     36#define MAIN_H
    3737
    38 #include "ata_bd.h"
     38#include "isa-ide.h"
    3939
    40 extern errno_t ata_fun_create(ata_ctrl_t *, unsigned, void *);
    41 extern errno_t ata_fun_remove(ata_ctrl_t *, unsigned);
    42 extern errno_t ata_fun_unbind(ata_ctrl_t *, unsigned);
     40extern errno_t isa_ide_fun_create(isa_ide_ctrl_t *, unsigned, void *);
     41extern errno_t isa_ide_fun_remove(isa_ide_ctrl_t *, unsigned);
     42extern errno_t isa_ide_fun_unbind(isa_ide_ctrl_t *, unsigned);
    4343
    4444#endif
  • uspace/drv/block/isa-ide/meson.build

    r2791fbb7 r59c0f478  
    11#
    2 # Copyright (c) 2013 Jiri Svoboda
     2# Copyright (c) 2024 Jiri Svoboda
    33# All rights reserved.
    44#
     
    2828
    2929deps = [ 'ata', 'scsi' ]
    30 src = files('ata_bd.c', 'main.c')
     30src = files('isa-ide.c', 'main.c')
  • uspace/drv/bus/isa/isa.dev

    r2791fbb7 r59c0f478  
    5252
    5353ata-c1:
    54         match 100 isa/ata_bd
     54        match 100 isa/ide
    5555        io_range 0x1f0 8
    5656        io_range 0x3f0 8
     
    5858
    5959ata-c2:
    60         match 100 isa/ata_bd
     60        match 100 isa/ide
    6161        io_range 0x170 8
    6262        io_range 0x370 8
  • uspace/drv/meson.build

    r2791fbb7 r59c0f478  
    3333        'root/virt',
    3434        'block/ahci',
    35         'block/ata_bd',
    3635        'block/ddisk',
     36        'block/isa-ide',
    3737        'block/usbmast',
    3838        'block/virtio-blk',
  • uspace/lib/ata/include/ata/ata.h

    r2791fbb7 r59c0f478  
    4444#include <stddef.h>
    4545#include "ata_hw.h"
    46 
    47 #define NAME "ata_bd"
    4846
    4947struct ata_device;
Note: See TracChangeset for help on using the changeset viewer.