Changeset 81b9d3e in mainline


Ignore:
Timestamp:
2017-10-05T19:09:34Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
82cbf8c6
Parents:
84eb4edd (diff), c188c62 (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 CUDA DDF conversion.

Files:
2 added
6 edited
4 moved

Legend:

Unmodified
Added
Removed
  • boot/arch/ppc32/Makefile.inc

    r84eb4edd r81b9d3e  
    4444RD_DRVS_ESSENTIAL += \
    4545        platform/mac \
     46        bus/adb/cuda_adb \
    4647        bus/pci/pciintel \
    4748        bus/usb/ohci \
  • uspace/Makefile

    r84eb4edd r81b9d3e  
    134134        srv/hid/output \
    135135        srv/hid/remcons \
    136         srv/hw/bus/cuda_adb \
    137136        srv/hw/char/s3c24xx_uart \
    138137        srv/hw/irc/apic \
     
    148147        drv/block/ata_bd \
    149148        drv/block/ddisk \
     149        drv/bus/adb/cuda_adb \
    150150        drv/bus/isa \
    151151        drv/bus/pci/pciintel \
  • uspace/app/init/init.c

    r84eb4edd r81b9d3e  
    342342        srv_start("/srv/icp-ic");
    343343        srv_start("/srv/obio");
    344         srv_start("/srv/cuda_adb");
    345344        srv_start("/srv/s3c24xx_uart");
    346345        srv_start("/srv/s3c24xx_ts");
  • uspace/drv/bus/adb/cuda_adb/Makefile

    r84eb4edd r81b9d3e  
    2828
    2929USPACE_PREFIX = ../../../..
     30LIBS = $(LIBDRV_PREFIX)/libdrv.a
     31EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    3032BINARY = cuda_adb
    3133
    3234SOURCES = \
    33         cuda_adb.c
     35        cuda_adb.c \
     36        main.c
    3437
    3538include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/bus/adb/cuda_adb/cuda_adb.c

    r84eb4edd r81b9d3e  
    3737 */
    3838
     39#include <assert.h>
     40#include <ddf/driver.h>
     41#include <ddf/log.h>
     42#include <ddi.h>
     43#include <errno.h>
     44#include <ipc/adb.h>
     45#include <libarch/ddi.h>
     46#include <stdbool.h>
     47#include <stddef.h>
     48#include <sysinfo.h>
     49#include <stdint.h>
    3950#include <stdio.h>
    4051#include <stdlib.h>
    41 #include <stddef.h>
    42 #include <stdint.h>
    43 #include <stdbool.h>
    44 #include <ddi.h>
    45 #include <libarch/ddi.h>
    46 #include <loc.h>
    47 #include <sysinfo.h>
    48 #include <errno.h>
    49 #include <ipc/adb.h>
    50 #include <assert.h>
     52
    5153#include "cuda_adb.h"
    5254#include "cuda_hw.h"
     
    5456#define NAME  "cuda_adb"
    5557
    56 static void cuda_connection(ipc_callid_t, ipc_call_t *, void *);
    57 static int cuda_init(cuda_instance_t *);
     58static void cuda_dev_connection(ipc_callid_t, ipc_call_t *, void *);
     59static int cuda_init(cuda_t *);
    5860static void cuda_irq_handler(ipc_callid_t, ipc_call_t *, void *);
    5961
    60 static void cuda_irq_listen(cuda_instance_t *);
    61 static void cuda_irq_receive(cuda_instance_t *);
    62 static void cuda_irq_rcv_end(cuda_instance_t *, void *, size_t *);
    63 static void cuda_irq_send_start(cuda_instance_t *);
    64 static void cuda_irq_send(cuda_instance_t *);
    65 
    66 static void cuda_packet_handle(cuda_instance_t *, uint8_t *, size_t);
    67 static void cuda_send_start(cuda_instance_t *);
    68 static void cuda_autopoll_set(cuda_instance_t *, bool);
    69 
    70 static void adb_packet_handle(cuda_instance_t *, uint8_t *, size_t, bool);
     62static void cuda_irq_listen(cuda_t *);
     63static void cuda_irq_receive(cuda_t *);
     64static void cuda_irq_rcv_end(cuda_t *, void *, size_t *);
     65static void cuda_irq_send_start(cuda_t *);
     66static void cuda_irq_send(cuda_t *);
     67
     68static void cuda_packet_handle(cuda_t *, uint8_t *, size_t);
     69static void cuda_send_start(cuda_t *);
     70static void cuda_autopoll_set(cuda_t *, bool);
     71
     72static void adb_packet_handle(cuda_t *, uint8_t *, size_t, bool);
    7173
    7274static irq_pio_range_t cuda_ranges[] = {
    7375        {
    7476                .base = 0,
    75                 .size = sizeof(cuda_t)
     77                .size = sizeof(cuda_regs_t)
    7678        }
    7779};
     
    107109};
    108110
    109 int main(int argc, char *argv[])
    110 {
    111         service_id_t service_id;
    112         cuda_instance_t cinst;
     111static int cuda_dev_create(cuda_t *cuda, const char *name, adb_dev_t **rdev)
     112{
     113        adb_dev_t *dev = NULL;
     114        ddf_fun_t *fun;
    113115        int rc;
    114         int i;
    115 
    116         printf(NAME ": VIA-CUDA Apple Desktop Bus driver\n");
    117        
    118         for (i = 0; i < ADB_MAX_ADDR; ++i) {
    119                 cinst.adb_dev[i].client_sess = NULL;
    120                 cinst.adb_dev[i].service_id = 0;
    121         }
    122 
    123         async_set_fallback_port_handler(cuda_connection, &cinst);
    124         rc = loc_server_register(NAME);
    125         if (rc < 0) {
    126                 printf(NAME ": Unable to register server.\n");
     116
     117        fun = ddf_fun_create(cuda->dev, fun_exposed, name);
     118        if (fun == NULL) {
     119                ddf_msg(LVL_ERROR, "Failed creating function '%s'.", name);
     120                rc = ENOMEM;
     121                goto error;
     122        }
     123
     124        dev = ddf_fun_data_alloc(fun, sizeof(adb_dev_t));
     125        if (dev == NULL) {
     126                ddf_msg(LVL_ERROR, "Failed allocating memory for '%s'.", name);
     127                rc = ENOMEM;
     128                goto error;
     129        }
     130
     131        dev->fun = fun;
     132        list_append(&dev->lcuda, &cuda->devs);
     133
     134        ddf_fun_set_conn_handler(fun, cuda_dev_connection);
     135
     136        rc = ddf_fun_bind(fun);
     137        if (rc != EOK) {
     138                ddf_msg(LVL_ERROR, "Failed binding function '%s'.", name);
     139                goto error;
     140        }
     141
     142        *rdev = dev;
     143        return EOK;
     144error:
     145        if (fun != NULL)
     146                ddf_fun_destroy(fun);
     147        return rc;
     148}
     149
     150int cuda_add(cuda_t *cuda, cuda_res_t *res)
     151{
     152        adb_dev_t *kbd = NULL;
     153        adb_dev_t *mouse = NULL;
     154        int rc;
     155
     156        cuda->phys_base = res->base;
     157
     158        rc = cuda_dev_create(cuda, "kbd", &kbd);
     159        if (rc != EOK)
     160                goto error;
     161
     162        rc = cuda_dev_create(cuda, "mouse", &mouse);
     163        if (rc != EOK)
     164                goto error;
     165
     166        cuda->addr_dev[2] = kbd;
     167        cuda->addr_dev[8] = kbd;
     168
     169        cuda->addr_dev[9] = mouse;
     170
     171        rc = cuda_init(cuda);
     172        if (rc != EOK) {
     173                ddf_msg(LVL_ERROR, "Failed initializing CUDA hardware.");
    127174                return rc;
    128175        }
    129176
    130         rc = loc_service_register("adb/kbd", &service_id);
    131         if (rc != EOK) {
    132                 printf(NAME ": Unable to register service %s.\n", "adb/kbd");
    133                 return rc;
    134         }
    135 
    136         cinst.adb_dev[2].service_id = service_id;
    137         cinst.adb_dev[8].service_id = service_id;
    138 
    139         rc = loc_service_register("adb/mouse", &service_id);
    140         if (rc != EOK) {
    141                 printf(NAME ": Unable to register service %s.\n", "adb/mouse");
    142                 return rc;
    143         }
    144 
    145         cinst.adb_dev[9].service_id = service_id;
    146 
    147         if (cuda_init(&cinst) < 0) {
    148                 printf("cuda_init() failed\n");
    149                 return 1;
    150         }
    151 
    152         task_retval(0);
    153         async_manager();
    154 
    155         return 0;
    156 }
    157 
    158 /** Character device connection handler */
    159 static void cuda_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    160 {
     177        return EOK;
     178error:
     179        return rc;
     180}
     181
     182int cuda_remove(cuda_t *cuda)
     183{
     184        return ENOTSUP;
     185}
     186
     187int cuda_gone(cuda_t *cuda)
     188{
     189        return ENOTSUP;
     190}
     191
     192/** Device connection handler */
     193static void cuda_dev_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     194{
     195        adb_dev_t *dev = (adb_dev_t *) ddf_fun_data_get((ddf_fun_t *) arg);
    161196        ipc_callid_t callid;
    162197        ipc_call_t call;
    163198        sysarg_t method;
    164         service_id_t dsid;
    165         cuda_instance_t *cuda = (cuda_instance_t *) arg;
    166         int dev_addr, i;
    167 
    168         /* Get the device handle. */
    169         dsid = IPC_GET_ARG2(*icall);
    170 
    171         /* Determine which disk device is the client connecting to. */
    172         dev_addr = -1;
    173         for (i = 0; i < ADB_MAX_ADDR; i++) {
    174                 if (cuda->adb_dev[i].service_id == dsid)
    175                         dev_addr = i;
    176         }
    177 
    178         if (dev_addr < 0) {
    179                 async_answer_0(iid, EINVAL);
    180                 return;
    181         }
    182199
    183200        /* Answer the IPC_M_CONNECT_ME_TO call. */
     
    187204                callid = async_get_call(&call);
    188205                method = IPC_GET_IMETHOD(call);
    189                
     206
    190207                if (!method) {
    191208                        /* The other side has hung up. */
     
    193210                        return;
    194211                }
    195                
     212
    196213                async_sess_t *sess =
    197214                    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
    198215                if (sess != NULL) {
    199                         if (cuda->adb_dev[dev_addr].client_sess == NULL) {
    200                                 cuda->adb_dev[dev_addr].client_sess = sess;
    201                                
    202                                 /*
    203                                  * A hack so that we send the data to the session
    204                                  * regardless of which address the device is on.
    205                                  */
    206                                 for (i = 0; i < ADB_MAX_ADDR; ++i) {
    207                                         if (cuda->adb_dev[i].service_id == dsid)
    208                                                 cuda->adb_dev[i].client_sess = sess;
    209                                 }
    210                                
    211                                 async_answer_0(callid, EOK);
    212                         } else
    213                                 async_answer_0(callid, ELIMIT);
    214                 } else
     216                        dev->client_sess = sess;
     217                        async_answer_0(callid, EOK);
     218                } else {
    215219                        async_answer_0(callid, EINVAL);
    216         }
    217 }
    218 
    219 static int cuda_init(cuda_instance_t *cuda)
    220 {
    221         if (sysinfo_get_value("cuda.address.physical", &(cuda->cuda_physical)) != EOK)
    222                 return -1;
    223        
     220                }
     221        }
     222}
     223
     224static int cuda_init(cuda_t *cuda)
     225{
     226        int rc;
     227
    224228        void *vaddr;
    225         if (pio_enable((void *) cuda->cuda_physical, sizeof(cuda_t), &vaddr) != 0)
    226                 return -1;
    227        
     229        rc = pio_enable((void *) cuda->phys_base, sizeof(cuda_regs_t),
     230            &vaddr);
     231        if (rc != EOK)
     232                return rc;
     233
    228234        cuda->regs = vaddr;
    229235        cuda->xstate = cx_listen;
     
    236242        pio_write_8(&cuda->regs->ier, IER_CLR | ALL_INT);
    237243
    238         cuda_irq_code.ranges[0].base = (uintptr_t) cuda->cuda_physical;
    239         cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) cuda->cuda_physical)->ifr;
     244        cuda_irq_code.ranges[0].base = (uintptr_t) cuda->phys_base;
     245        cuda_irq_code.cmds[0].addr = (void *) &((cuda_regs_t *)
     246            cuda->phys_base)->ifr;
    240247        async_irq_subscribe(10, cuda_irq_handler, cuda, &cuda_irq_code);
    241248
     
    247254        cuda_autopoll_set(cuda, true);
    248255
    249         return 0;
     256        return EOK;
    250257}
    251258
     
    253260{
    254261        uint8_t rbuf[CUDA_RCV_BUF_SIZE];
    255         cuda_instance_t *cuda = (cuda_instance_t *)arg;
     262        cuda_t *cuda = (cuda_t *)arg;
    256263        size_t len;
    257264        bool handle;
     
    280287                break;
    281288        }
    282        
     289
    283290        /* Lower IFR.SR_INT so that CUDA can generate next int by raising it. */
    284291        pio_write_8(&cuda->regs->ifr, SR_INT);
     
    297304 * @param cuda CUDA instance
    298305 */
    299 static void cuda_irq_listen(cuda_instance_t *cuda)
     306static void cuda_irq_listen(cuda_t *cuda)
    300307{
    301308        uint8_t b = pio_read_8(&cuda->regs->b);
    302        
     309
    303310        if ((b & TREQ) != 0) {
    304                 printf("cuda_irq_listen: no TREQ?!\n");
    305                 return;
    306         }
    307        
     311                ddf_msg(LVL_WARN, "cuda_irq_listen: no TREQ?!");
     312                return;
     313        }
     314
    308315        pio_write_8(&cuda->regs->b, b & ~TIP);
    309316        cuda->xstate = cx_receive;
     
    316323 * @param cuda CUDA instance
    317324 */
    318 static void cuda_irq_receive(cuda_instance_t *cuda)
     325static void cuda_irq_receive(cuda_t *cuda)
    319326{
    320327        uint8_t data = pio_read_8(&cuda->regs->sr);
    321328        if (cuda->bidx < CUDA_RCV_BUF_SIZE)
    322329                cuda->rcv_buf[cuda->bidx++] = data;
    323        
     330
    324331        uint8_t b = pio_read_8(&cuda->regs->b);
    325        
     332
    326333        if ((b & TREQ) == 0) {
    327334                pio_write_8(&cuda->regs->b, b ^ TACK);
     
    341348 * @param len Place to store length of received packet
    342349 */
    343 static void cuda_irq_rcv_end(cuda_instance_t *cuda, void *buf, size_t *len)
     350static void cuda_irq_rcv_end(cuda_t *cuda, void *buf, size_t *len)
    344351{
    345352        uint8_t b = pio_read_8(&cuda->regs->b);
    346        
     353
    347354        if ((b & TREQ) == 0) {
    348355                cuda->xstate = cx_receive;
     
    352359                cuda_send_start(cuda);
    353360        }
    354        
     361
    355362        memcpy(buf, cuda->rcv_buf, cuda->bidx);
    356363        *len = cuda->bidx;
     
    364371 * @param cuda CUDA instance
    365372 */
    366 static void cuda_irq_send_start(cuda_instance_t *cuda)
     373static void cuda_irq_send_start(cuda_t *cuda)
    367374{
    368375        uint8_t b;
     
    394401 * @param cuda CUDA instance
    395402 */
    396 static void cuda_irq_send(cuda_instance_t *cuda)
     403static void cuda_irq_send(cuda_t *cuda)
    397404{
    398405        if (cuda->bidx < cuda->snd_bytes) {
     
    416423}
    417424
    418 static void cuda_packet_handle(cuda_instance_t *cuda, uint8_t *data, size_t len)
     425static void cuda_packet_handle(cuda_t *cuda, uint8_t *data, size_t len)
    419426{
    420427        if (data[0] != PT_ADB)
     
    426433}
    427434
    428 static void adb_packet_handle(cuda_instance_t *cuda, uint8_t *data,
    429     size_t size, bool autopoll)
     435static void adb_packet_handle(cuda_t *cuda, uint8_t *data, size_t size,
     436    bool autopoll)
    430437{
    431438        uint8_t dev_addr;
    432439        uint8_t reg_no;
    433440        uint16_t reg_val;
     441        adb_dev_t *dev;
    434442        unsigned i;
    435443
     
    438446
    439447        if (size != 3) {
    440                 printf("unrecognized packet, size=%zu\n", size);
     448                ddf_msg(LVL_WARN, "Unrecognized packet, size=%zu", size);
    441449                for (i = 0; i < size; ++i) {
    442                         printf(" 0x%02x", data[i]);
     450                        ddf_msg(LVL_WARN, " 0x%02x", data[i]);
    443451                }
    444                 putchar('\n');
    445452                return;
    446453        }
    447454
    448455        if (reg_no != 0) {
    449                 printf("unrecognized packet, size=%zu\n", size);
     456                ddf_msg(LVL_WARN, "Unrecognized packet, size=%zu", size);
    450457                for (i = 0; i < size; ++i) {
    451                         printf(" 0x%02x", data[i]);
     458                        ddf_msg(LVL_WARN, " 0x%02x", data[i]);
    452459                }
    453                 putchar('\n');
    454460                return;
    455461        }
     
    457463        reg_val = ((uint16_t) data[1] << 8) | (uint16_t) data[2];
    458464
    459         if (cuda->adb_dev[dev_addr].client_sess == NULL)
    460                 return;
    461 
    462         async_exch_t *exch =
    463             async_exchange_begin(cuda->adb_dev[dev_addr].client_sess);
     465        ddf_msg(LVL_DEBUG, "Received ADB packet for device address %d",
     466            dev_addr);
     467        dev = cuda->addr_dev[dev_addr];
     468        if (dev == NULL)
     469                return;
     470
     471        async_exch_t *exch = async_exchange_begin(dev->client_sess);
    464472        async_msg_1(exch, ADB_REG_NOTIF, reg_val);
    465473        async_exchange_end(exch);
    466474}
    467475
    468 static void cuda_autopoll_set(cuda_instance_t *cuda, bool enable)
     476static void cuda_autopoll_set(cuda_t *cuda, bool enable)
    469477{
    470478        cuda->snd_buf[0] = PT_CUDA;
     
    477485}
    478486
    479 static void cuda_send_start(cuda_instance_t *cuda)
     487static void cuda_send_start(cuda_t *cuda)
    480488{
    481489        assert(cuda->xstate == cx_listen);
  • uspace/drv/bus/adb/cuda_adb/cuda_adb.h

    r84eb4edd r81b9d3e  
    3737#define CUDA_ADB_H_
    3838
     39#include <adt/list.h>
    3940#include <async.h>
     41#include <ddf/driver.h>
    4042#include <fibril_synch.h>
    41 #include <stddef.h>
     43#include <loc.h>
    4244#include <stdint.h>
    4345#include "cuda_hw.h"
     
    5658
    5759typedef struct {
    58         service_id_t service_id;
     60        uintptr_t base;
     61        int irq;
     62} cuda_res_t;
     63
     64/** ADB bus device */
     65typedef struct {
     66        ddf_fun_t *fun;
    5967        async_sess_t *client_sess;
     68        link_t lcuda;
     69        struct cuda *cuda;
    6070} adb_dev_t;
    6171
    62 typedef struct {
    63         struct cuda *regs;
    64         uintptr_t cuda_physical;
     72/** CUDA ADB bus */
     73typedef struct cude {
     74        struct cuda_regs *regs;
     75        uintptr_t phys_base;
     76        ddf_dev_t *dev;
    6577
    6678        uint8_t rcv_buf[CUDA_RCV_BUF_SIZE];
     
    7183        fibril_mutex_t dev_lock;
    7284
    73         adb_dev_t adb_dev[ADB_MAX_ADDR];
    74 } cuda_instance_t;
     85        list_t devs;
     86        adb_dev_t *addr_dev[ADB_MAX_ADDR];
     87} cuda_t;
     88
     89extern int cuda_add(cuda_t *, cuda_res_t *);
     90extern int cuda_remove(cuda_t *);
     91extern int cuda_gone(cuda_t *);
    7592
    7693#endif
  • uspace/drv/bus/adb/cuda_adb/cuda_hw.h

    r84eb4edd r81b9d3e  
    3939#include <stdint.h>
    4040
    41 typedef struct cuda {
     41typedef struct cuda_regs {
    4242        uint8_t b;
    4343        uint8_t pad0[0x1ff];
     
    8787        uint8_t anh;
    8888        uint8_t pad15[0x1ff];
    89 } cuda_t;
     89} cuda_regs_t;
    9090
    9191/** B register fields */
  • uspace/drv/platform/mac/mac.c

    r84eb4edd r81b9d3e  
    11/*
    22 * Copyright (c) 2011 Martin Decky
     3 * Copyright (c) 2017 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    4041#include <errno.h>
    4142#include <ops/hw_res.h>
     43#include <ops/pio_window.h>
    4244#include <stdio.h>
     45#include <sysinfo.h>
    4346
    4447#define NAME  "mac"
     
    4649typedef struct {
    4750        hw_resource_list_t hw_resources;
     51        pio_window_t pio_window;
    4852} mac_fun_t;
     53
     54static hw_resource_t adb_res[] = {
     55        {
     56                .type = IO_RANGE,
     57                .res.io_range = {
     58                        .address = 0,
     59                        .size = 0x2000,
     60                        .relative = true,
     61                        .endianness = BIG_ENDIAN
     62                }
     63        },
     64        {
     65                .type = INTERRUPT,
     66                .res.interrupt = {
     67                        .irq = 0 /* patched at run time */
     68                }
     69        },
     70};
     71
     72static mac_fun_t adb_data = {
     73        .hw_resources = {
     74                sizeof(adb_res) / sizeof(adb_res[0]),
     75                adb_res
     76        },
     77        .pio_window = {
     78                .io = {
     79                        .base = 0, /* patched at run time */
     80                        .size = 0x2000
     81                }
     82        }
     83};
    4984
    5085static hw_resource_t pci_conf_regs[] = {
     
    79114
    80115/** Obtain function soft-state from DDF function node */
    81 static mac_fun_t *mac_fun(ddf_fun_t *fnode)
    82 {
    83         return ddf_fun_data_get(fnode);
     116static mac_fun_t *mac_fun(ddf_fun_t *ddf_fun)
     117{
     118        return ddf_fun_data_get(ddf_fun);
     119}
     120
     121static pio_window_t *mac_get_pio_window(ddf_fun_t *ddf_fun)
     122{
     123        mac_fun_t *fun = mac_fun(ddf_fun);
     124        return &fun->pio_window;
    84125}
    85126
     
    88129{
    89130        ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     131        printf("mac: Adding new function '%s'.\n", name);
    90132       
    91133        ddf_fun_t *fnode = NULL;
     
    114156        }
    115157       
     158        printf("mac: Added new function '%s' (str=%s).\n", name, str_match_id);
    116159        return true;
    117160       
     
    135178static int mac_dev_add(ddf_dev_t *dev)
    136179{
     180        int rc;
     181        uintptr_t cuda_physical;
     182        sysarg_t cuda_inr;
    137183#if 0
    138184        /* Register functions */
    139         if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data))
    140                 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform.");
     185        if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) {
     186                ddf_msg(LVL_ERROR, "Failed to add PCI function for Mac platform.");
     187                return EIO;
     188        }
    141189#else
    142190        (void)pci_data;
    143         (void)mac_add_fun;
    144191#endif
    145        
     192        rc = sysinfo_get_value("cuda.address.physical", &cuda_physical);
     193        if (rc != EOK)
     194                return EIO;
     195        rc = sysinfo_get_value("cuda.inr", &cuda_inr);
     196        if (rc != EOK)
     197                return EIO;
     198
     199        adb_data.pio_window.io.base = cuda_physical;
     200        adb_res[1].res.interrupt.irq = cuda_inr;
     201
     202        if (!mac_add_fun(dev, "adb", "cuda_adb", &adb_data)) {
     203                ddf_msg(LVL_ERROR, "Failed to add ADB function for Mac platform.");
     204                return EIO;
     205        }
     206
    146207        return EOK;
    147208}
     
    173234}
    174235
     236static pio_window_ops_t fun_pio_window_ops = {
     237        .get_pio_window = &mac_get_pio_window
     238};
     239
    175240static hw_res_ops_t fun_hw_res_ops = {
    176241        .get_resource_list = &mac_get_resources,
     
    183248        ddf_log_init(NAME);
    184249        mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
     250        mac_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
    185251        return ddf_driver_main(&mac_driver);
    186252}
  • uspace/srv/hid/input/port/adb.c

    r84eb4edd r81b9d3e  
    6262        kbd_dev = kdev;
    6363       
    64         const char *dev = "adb/kbd";
     64        const char *dev = "devices/\\hw\\adb\\kbd";
    6565        service_id_t service_id;
    66         int rc = loc_service_get_id(dev, &service_id, 0);
     66        int rc = loc_service_get_id(dev, &service_id, IPC_FLAG_BLOCKING);
    6767        if (rc != EOK)
    6868                return rc;
  • uspace/srv/hid/input/port/adb_mouse.c

    r84eb4edd r81b9d3e  
    7575static int adb_port_init(mouse_dev_t *mdev)
    7676{
    77         const char *dev = "adb/mouse";
     77        const char *dev = "devices/\\hw\\adb\\mouse";
    7878       
    7979        mouse_dev = mdev;
    8080       
    8181        service_id_t service_id;
    82         int rc = loc_service_get_id(dev, &service_id, 0);
     82        int rc = loc_service_get_id(dev, &service_id, IPC_FLAG_BLOCKING);
    8383        if (rc != EOK)
    8484                return rc;
Note: See TracChangeset for help on using the changeset viewer.