Changeset 53145c7 in rtems-libbsd


Ignore:
Timestamp:
09/03/18 12:21:14 (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
59951a9
Parents:
0653b1d
git-author:
Sebastian Huber <sebastian.huber@…> (09/03/18 12:21:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/13/19 12:03:49)
Message:

NVME(4): Port to RTEMS

Update #3821.

Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • buildset/default.ini

    r0653b1d r53145c7  
    5353netinet6 = on
    5454netipsec = off
     55nvme = on
    5556opencrypto = on
    5657pci = on
  • freebsd/sys/dev/nvme/nvme.c

    r0653b1d r53145c7  
    7474SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL);
    7575
     76#ifndef __rtems__
    7677static void
    7778nvme_uninit(void)
     
    8182
    8283SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL);
     84#endif /* __rtems__ */
    8385
    8486int
  • freebsd/sys/dev/nvme/nvme_ctrlr.c

    r0653b1d r53145c7  
    6262        qpair = &ctrlr->adminq;
    6363        qpair->id = 0;
     64#ifndef __rtems__
    6465        qpair->cpu = CPU_FFS(&cpuset_domain[ctrlr->domain]) - 1;
    6566        qpair->domain = ctrlr->domain;
     67#endif /* __rtems__ */
    6668
    6769        num_entries = NVME_ADMIN_ENTRIES;
     
    147149                 */
    148150                qpair->id = i + 1;
     151#ifndef __rtems__
    149152                if (ctrlr->num_io_queues > 1) {
    150153                        /* Find number of CPUs served by this queue. */
     
    158161                        qpair->domain = ctrlr->domain;
    159162                }
     163#endif /* __rtems__ */
    160164
    161165                /*
     
    173177                 */
    174178                if (ctrlr->num_io_queues > 1)
     179#ifndef __rtems__
    175180                        bus_bind_intr(ctrlr->dev, qpair->res, qpair->cpu);
     181#else /* __rtems__ */
     182                        bus_bind_intr(ctrlr->dev, qpair->res, QP(ctrlr, i));
     183#endif /* __rtems__ */
    176184        }
    177185
     
    10111019        struct nvme_request     *req;
    10121020        struct mtx              *mtx;
     1021#ifndef __rtems__
    10131022        struct buf              *buf = NULL;
     1023#endif /* __rtems__ */
    10141024        int                     ret = 0;
    10151025        vm_offset_t             addr, end;
     
    10331043                        return EIO;
    10341044                }
     1045#ifndef __rtems__
    10351046                if (is_user_buffer) {
    10361047                        /*
     
    10501061                            nvme_pt_done, pt);
    10511062                } else
     1063#endif /* __rtems__ */
    10521064                        req = nvme_allocate_request_vaddr(pt->buf, pt->len,
    10531065                            nvme_pt_done, pt);
     
    10821094        mtx_unlock(mtx);
    10831095
     1096#ifndef __rtems__
    10841097err:
    10851098        if (buf != NULL) {
     
    10871100                PRELE(curproc);
    10881101        }
     1102#endif /* __rtems__ */
    10891103
    10901104        return (ret);
     
    11421156
    11431157        mtx_init(&ctrlr->lock, "nvme ctrlr lock", NULL, MTX_DEF);
     1158#ifndef __rtems__
    11441159        if (bus_get_domain(dev, &ctrlr->domain) != 0)
    11451160                ctrlr->domain = 0;
     1161#endif /* __rtems__ */
    11461162
    11471163        cap_hi = nvme_mmio_read_4(ctrlr, cap_hi);
  • freebsd/sys/dev/nvme/nvme_ns.c

    r0653b1d r53145c7  
    5050#include "nvme_private.h"
    5151
     52#ifndef __rtems__
    5253static void             nvme_bio_child_inbed(struct bio *parent, int bio_error);
    5354static void             nvme_bio_child_done(void *arg,
     
    6465                                          struct bio *bp,
    6566                                          uint32_t alignment);
     67#endif /* __rtems__ */
    6668
    6769static int
     
    7779
    7880        switch (cmd) {
     81#ifndef __rtems__
    7982        case NVME_IO_TEST:
    8083        case NVME_BIO_TEST:
    8184                nvme_ns_test(ns, cmd, arg);
    8285                break;
     86#endif /* __rtems__ */
    8387        case NVME_PASSTHROUGH_CMD:
    8488                pt = (struct nvme_pt_command *)arg;
     
    126130}
    127131
     132#ifndef __rtems__
    128133static void
    129134nvme_ns_strategy_done(void *arg, const struct nvme_completion *cpl)
     
    162167
    163168}
     169#endif /* __rtems__ */
    164170
    165171static struct cdevsw nvme_ns_cdevsw = {
    166172        .d_version =    D_VERSION,
    167173        .d_flags =      D_DISK,
     174#ifndef __rtems__
    168175        .d_read =       physread,
    169176        .d_write =      physwrite,
     177#endif /* __rtems__ */
    170178        .d_open =       nvme_ns_open,
    171179        .d_close =      nvme_ns_close,
     180#ifndef __rtems__
    172181        .d_strategy =   nvme_ns_strategy,
     182#endif /* __rtems__ */
    173183        .d_ioctl =      nvme_ns_ioctl
    174184};
     
    241251}
    242252
     253#ifndef __rtems__
    243254static void
    244255nvme_ns_bio_done(void *arg, const struct nvme_completion *status)
     
    497508        return (err);
    498509}
     510#endif /* __rtems__ */
    499511
    500512int
  • freebsd/sys/dev/nvme/nvme_ns_cmd.c

    r0653b1d r53145c7  
    5353}
    5454
     55#ifndef __rtems__
    5556int
    5657nvme_ns_cmd_read_bio(struct nvme_namespace *ns, struct bio *bp,
     
    7475        return (0);
    7576}
     77#endif /* __rtems__ */
    7678
    7779int
     
    9496}
    9597
     98#ifndef __rtems__
    9699int
    97100nvme_ns_cmd_write_bio(struct nvme_namespace *ns, struct bio *bp,
     
    114117        return (0);
    115118}
     119#endif /* __rtems__ */
    116120
    117121int
  • freebsd/sys/dev/nvme/nvme_pci.c

    r0653b1d r53145c7  
    263263        device_t        dev;
    264264        int             force_intx, num_io_queues, per_cpu_io_queues;
     265#ifndef __rtems__
    265266        int             min_cpus_per_ioq;
     267#endif /* __rtems__ */
    266268        int             num_vectors_requested, num_vectors_allocated;
    267269
     
    285287                num_io_queues = 1;
    286288
     289#ifndef __rtems__
    287290        min_cpus_per_ioq = smp_threads_per_core;
    288291        TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq);
     
    291294                    max(1, mp_ncpus / min_cpus_per_ioq));
    292295        }
     296#endif /* __rtems__ */
    293297
    294298        num_io_queues = min(num_io_queues, pci_msix_count(dev) - 1);
  • freebsd/sys/dev/nvme/nvme_private.h

    r0653b1d r53145c7  
    169169
    170170        uint64_t                        *prp;
     171#ifndef __rtems__
    171172        bus_addr_t                      prp_bus_addr;
     173#else /* __rtems__ */
     174        uint64_t                        prp_bus_addr;
     175#endif /* __rtems__ */
    172176};
    173177
     
    176180        struct nvme_controller  *ctrlr;
    177181        uint32_t                id;
     182#ifndef __rtems__
    178183        int                     domain;
    179184        int                     cpu;
     185#endif /* __rtems__ */
    180186
    181187        uint16_t                vector;
     
    241247
    242248        struct mtx              lock;
     249#ifndef __rtems__
    243250        int                     domain;
     251#endif /* __rtems__ */
    244252        uint32_t                ready_timeout_in_ms;
    245253        uint32_t                quirks;
  • freebsd/sys/dev/nvme/nvme_qpair.c

    r0653b1d r53145c7  
    710710                goto out;
    711711        }
     712#ifndef __rtems__
    712713        bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain);
     714#endif /* __rtems__ */
    713715
    714716        if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem,
     
    944946
    945947        if (req->timeout)
     948#ifndef __rtems__
    946949                callout_reset_on(&tr->timer, ctrlr->timeout_period * hz,
    947950                    nvme_timeout, tr, qpair->cpu);
     951#else /* __rtems__ */
     952                callout_reset_on(&tr->timer, ctrlr->timeout_period * hz,
     953                    nvme_timeout, tr, -1);
     954#endif /* __rtems__ */
    948955
    949956        /* Copy the command from the tracker to the submission queue. */
     
    10741081                nvme_qpair_submit_tracker(tr->qpair, tr);
    10751082                break;
     1083#ifndef __rtems__
    10761084        case NVME_REQUEST_BIO:
    10771085                KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size,
     
    10931101                            "bus_dmamap_load_ccb returned 0x%x!\n", err);
    10941102                break;
     1103#endif /* __rtems__ */
    10951104        default:
    10961105                panic("unknown nvme request type 0x%x\n", req->type);
  • freebsd/sys/sys/malloc.h

    r0653b1d r53145c7  
    186186            __malloc_like __result_use_check __alloc_size(1) __alloc_align(7);
    187187void    free(void *addr, struct malloc_type *type);
     188#ifndef __rtems__
    188189void    free_domain(void *addr, struct malloc_type *type);
     190#else /* __rtems__ */
     191#define free_domain(addr, type) free(addr, type)
     192#endif /* __rtems__ */
    189193#ifndef __rtems__
    190194void    *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like
     
    251255})
    252256
     257#ifndef __rtems__
    253258void    *malloc_domainset(size_t size, struct malloc_type *type,
    254259            struct domainset *ds, int flags) __malloc_like __result_use_check
    255260            __alloc_size(1);
     261#else /* __rtems__ */
     262#define malloc_domainset(size, type, ds, flags) malloc(size, type, flags)
     263#endif /* __rtems__ */
    256264void    *mallocarray(size_t nmemb, size_t size, struct malloc_type *type,
    257265            int flags) __malloc_like __result_use_check
Note: See TracChangeset for help on using the changeset viewer.