Changeset 6843a9c in mainline for uspace/drv/bus/isa/isa.c


Ignore:
Timestamp:
2012-06-29T13:02:14Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
722912e
Parents:
ba72f2b (diff), 0bbd13e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Trivial conflicts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    rba72f2b r6843a9c  
    5252#include <dirent.h>
    5353#include <fcntl.h>
     54#include <ipc/irc.h>
     55#include <ipc/services.h>
     56#include <sysinfo.h>
     57#include <ns.h>
    5458#include <sys/stat.h>
    5559#include <ipc/irc.h>
     
    6266#include <ops/hw_res.h>
    6367
    64 #include <devman.h>
    65 #include <ipc/devman.h>
    6668#include <device/hw_res.h>
    6769
    68 #include "dma_controller.h"
     70#include "i8237.h"
    6971
    7072#define NAME "isa"
     
    146148
    147149static int isa_dma_channel_fun_setup(ddf_fun_t *fnode,
    148     unsigned channel, uint32_t pa, uint16_t size, uint8_t mode)
     150    unsigned int channel, uint32_t pa, uint16_t size, uint8_t mode)
    149151{
    150152        assert(fnode);
     
    152154        const hw_resource_list_t *res = &isa_fun->hw_resources;
    153155        assert(res);
    154         const int ch = channel;
     156       
     157        const unsigned int ch = channel;
    155158        for (size_t i = 0; i < res->count; ++i) {
    156                 if ((res->resources[i].type == DMA_CHANNEL_16 &&
    157                     res->resources[i].res.dma_channel.dma16 == ch) ||
    158                     (res->resources[i].type == DMA_CHANNEL_8 &&
    159                     res->resources[i].res.dma_channel.dma8 == ch)) {
     159                if (((res->resources[i].type == DMA_CHANNEL_16) &&
     160                    (res->resources[i].res.dma_channel.dma16 == ch)) ||
     161                    ((res->resources[i].type == DMA_CHANNEL_8) &&
     162                    (res->resources[i].res.dma_channel.dma8 == ch))) {
    160163                        return dma_setup_channel(channel, pa, size, mode);
    161164                }
    162165        }
     166       
    163167        return EINVAL;
    164168}
     
    172176static ddf_dev_ops_t isa_fun_ops;
    173177
    174 static int isa_add_device(ddf_dev_t *dev);
     178static int isa_dev_add(ddf_dev_t *dev);
    175179static int isa_dev_remove(ddf_dev_t *dev);
    176180static int isa_fun_online(ddf_fun_t *fun);
     
    179183/** The isa device driver's standard operations */
    180184static driver_ops_t isa_ops = {
    181         .add_device = &isa_add_device,
     185        .dev_add = &isa_dev_add,
    182186        .dev_remove = &isa_dev_remove,
    183187        .fun_online = &isa_fun_online,
     
    198202
    199203        isa_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(isa_fun_t));
    200         if (fun == NULL)
     204        if (fun == NULL) {
     205                ddf_fun_destroy(fnode);
    201206                return NULL;
     207        }
    202208
    203209        fibril_mutex_initialize(&fun->mutex);
     
    344350        size_t count = fun->hw_resources.count;
    345351        hw_resource_t *resources = fun->hw_resources.resources;
    346 
     352       
    347353        if (count < ISA_MAX_HW_RES) {
    348                 if (dma > 0 && dma < 4) {
     354                if ((dma > 0) && (dma < 4)) {
    349355                        resources[count].type = DMA_CHANNEL_8;
    350356                        resources[count].res.dma_channel.dma8 = dma;
    351 
     357                       
    352358                        fun->hw_resources.count++;
    353359                        ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
    354360                            fun->fnode->name);
     361                       
    355362                        return;
    356363                }
    357364
    358                 if (dma > 4 && dma < 8) {
     365                if ((dma > 4) && (dma < 8)) {
    359366                        resources[count].type = DMA_CHANNEL_16;
    360367                        resources[count].res.dma_channel.dma16 = dma;
    361 
     368                       
    362369                        fun->hw_resources.count++;
    363370                        ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
    364371                            fun->fnode->name);
     372                       
    365373                        return;
    366374                }
    367 
     375               
    368376                ddf_msg(LVL_WARN, "Skipped dma 0x%x for function %s", dma,
    369377                    fun->fnode->name);
     
    396404
    397405        val = skip_spaces(val);
    398         irq = (int)strtol(val, &end, 0x10);
     406        irq = (int) strtol(val, &end, 10);
    399407
    400408        if (val != end)
     
    404412static void fun_parse_dma(isa_fun_t *fun, char *val)
    405413{
    406         int dma = 0;
     414        unsigned int dma = 0;
    407415        char *end = NULL;
    408 
     416       
    409417        val = skip_spaces(val);
    410         dma = (int)strtol(val, &end, 10);
    411 
     418        dma = (unsigned int) strtol(val, &end, 10);
     419       
    412420        if (val != end)
    413421                isa_fun_set_dma(fun, dma);
     
    589597}
    590598
    591 static int isa_add_device(ddf_dev_t *dev)
     599static int isa_dev_add(ddf_dev_t *dev)
    592600{
    593601        isa_bus_t *isa;
    594602
    595         ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d",
     603        ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d",
    596604            (int) dev->handle);
    597605
Note: See TracChangeset for help on using the changeset viewer.