Changeset b9f1585 in mainline


Ignore:
Timestamp:
2019-01-03T06:53:22Z (5 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
043d464f
Parents:
b4a4ad94 (diff), 7acd787 (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 upstream changes

Files:
9 added
17 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rb4a4ad94 rb9f1585  
    130130uspace/app/nic/nic
    131131uspace/app/nterm/nterm
     132uspace/app/pci/pci
    132133uspace/app/perf/perf
    133134uspace/app/ping/ping
  • abi/include/abi/ipc/interfaces.h

    rb4a4ad94 rb9f1585  
    183183            FOURCC_COMPACT('v', 'b', 'd', ' ') | IFACE_EXCHANGE_SERIALIZE,
    184184        INTERFACE_IPC_TEST =
    185             FOURCC_COMPACT('i', 'p', 'c', 't') | IFACE_EXCHANGE_SERIALIZE
     185            FOURCC_COMPACT('i', 'p', 'c', 't') | IFACE_EXCHANGE_SERIALIZE,
     186        INTERFACE_PCI =
     187            FOURCC_COMPACT('p', 'c', 'i', ' ') | IFACE_EXCHANGE_SERIALIZE
    186188} iface_t;
    187189
  • boot/Makefile.common

    rb4a4ad94 rb9f1585  
    206206        netecho \
    207207        nterm \
     208        pci \
    208209        ping \
    209210        pkg \
  • boot/arch/arm32/src/mm.c

    rb4a4ad94 rb9f1585  
    9999 *
    100100 * Memory areas used for I/O are excluded from caching.
    101  * At the moment caching is enabled only on GTA02.
    102101 *
    103102 * @param section       The section number.
     
    171170{
    172171        /*
    173          * Create 1:1 virtual-physical mapping.
    174          * Physical memory on BBxM a BBone starts at 2GB
    175          * boundary, icp has a memory mirror at 2GB.
    176          * (ARM Integrator Core Module User guide ch. 6.3,  p. 6-7)
    177          * gta02 somehow works (probably due to limited address size),
    178          * s3c2442b manual ch. 5, p.5-1:
    179          * "Address space: 128Mbytes per bank (total 1GB/8 banks)"
    180          */
    181         for (pfn_t page = 0; page < PTL0_ENTRIES; ++page)
    182                 init_ptl0_section(&boot_pt[page], page);
     172         * Our goal is to create page tables that serve two purposes:
     173         *
     174         * 1. Allow the loader to run in identity-mapped virtual memory and use
     175         *    I/O devices (e.g. an UART for logging).
     176         * 2. Allow the kernel to start running in virtual memory from addresses
     177         *    above 2G.
     178         *
     179         * The matters are slightly complicated by the different locations of
     180         * physical memory and I/O devices on the various boards that we
     181         * support. We see two cases (but other are still possible):
     182         *
     183         * a) Both RAM and I/O is in memory below 2G
     184         *    For instance, this is the case of GTA02, Integrator/CP
     185         *    and RaspberryPi
     186         * b) RAM starts at 2G and I/O devices are below 2G
     187         *    For example, this is the case of BeagleBone and BeagleBoard XM
     188         *
     189         * This leads to two possible setups of boot page tables:
     190         *
     191         * A) To arrange for a), split the virtual address space into two
     192         *    halves, both identity-mapping the first 2G of physical address
     193         *    space.
     194         * B) To accommodate b), create one larger virtual address space
     195         *    identity-mapping the entire physical address space.
     196         */
     197
     198        for (pfn_t page = 0; page < PTL0_ENTRIES; page++) {
     199                pfn_t frame = page;
     200                if (BOOT_BASE < 0x80000000UL && page >= PTL0_ENTRIES / 2)
     201                        frame -= PTL0_ENTRIES / 2;
     202                init_ptl0_section(&boot_pt[page], frame);
     203        }
    183204
    184205        /*
  • boot/arch/ia64/src/main.c

    rb4a4ad94 rb9f1585  
    9494                    cur += md_size) {
    9595                        efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;
     96                        memmap_item_t *o = NULL;
     97
     98                        if (items)
     99                                o = &memmap[items - 1];
    96100
    97101                        switch ((efi_memory_type_t) md->type) {
     102                        case EFI_LOADER_CODE:
     103                        case EFI_LOADER_DATA:
     104                        case EFI_BOOT_SERVICES_CODE:
     105                        case EFI_BOOT_SERVICES_DATA:
    98106                        case EFI_CONVENTIONAL_MEMORY:
     107                                if (o && o->type == MEMMAP_FREE_MEM &&
     108                                    o->base + o->size == md->phys_start) {
     109                                        o->size += md->pages * EFI_PAGE_SIZE;
     110                                        continue;
     111                                }
    99112                                memmap[items].type = MEMMAP_FREE_MEM;
    100113                                break;
  • kernel/genarch/src/fb/fb.c

    rb4a4ad94 rb9f1585  
    7676            (instance)->cols + (col))
    7777
     78#define BB_NEXT_COL(pos) (++(pos))
     79
    7880#define GLYPH_POS(instance, glyph, y) \
    7981        ((glyph) * (instance)->glyphbytes + (y) * (instance)->glyphscanline)
     
    270272                                unsigned int x;
    271273                                unsigned int col;
     274                                size_t bb_pos = BB_POS(instance, 0, row);
     275                                size_t bb_pos1 = BB_POS(instance, 0, row + 1);
    272276
    273277                                for (col = 0, x = 0; col < instance->cols;
     
    276280
    277281                                        if (row < instance->rows - 1) {
    278                                                 if (instance->backbuf[BB_POS(instance, col, row)] ==
    279                                                     instance->backbuf[BB_POS(instance, col, row + 1)])
    280                                                         continue;
    281 
    282                                                 glyph = instance->backbuf[BB_POS(instance, col, row + 1)];
     282                                                if (instance->backbuf[bb_pos] ==
     283                                                    instance->backbuf[bb_pos1])
     284                                                        goto skip;
     285
     286                                                glyph = instance->backbuf[bb_pos1];
    283287                                        } else
    284288                                                glyph = 0;
     
    287291                                            &instance->glyphs[GLYPH_POS(instance, glyph, yd)],
    288292                                            instance->glyphscanline);
     293                                skip:
     294                                        BB_NEXT_COL(bb_pos);
     295                                        BB_NEXT_COL(bb_pos1);
    289296                                }
    290297                        }
     
    373380                        unsigned int x;
    374381                        unsigned int col;
     382                        size_t bb_pos = BB_POS(instance, 0, row);
    375383
    376384                        for (col = 0, x = 0; col < instance->cols;
    377385                            col++, x += FONT_WIDTH) {
    378386                                uint16_t glyph =
    379                                     instance->backbuf[BB_POS(instance, col, row)];
     387                                    instance->backbuf[bb_pos];
    380388                                void *dst = &instance->addr[FB_POS(instance, x, y + yd)];
    381389                                void *src = &instance->glyphs[GLYPH_POS(instance, glyph, yd)];
    382390                                memcpy(dst, src, instance->glyphscanline);
     391                                BB_NEXT_COL(bb_pos);
    383392                        }
    384393                }
  • tools/toolchain.sh

    rb4a4ad94 rb9f1585  
    6161        echo "Syntax:"
    6262        echo " $0 [--no-install] [--non-helenos-target] <platform>"
     63        echo " $0 --test-version [<platform>]"
    6364        echo
    6465        echo "Possible target platforms are:"
     
    9596}
    9697
     98test_version() {
     99        echo "Cross-compiler toolchain build script"
     100        echo
     101        echo "Start testing the version of the installed software"
     102        echo
     103       
     104        if [ -z "$1" ] || [ "$1" == "all" ] ; then
     105                PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     106        else
     107                PLATFORMS=("$1")
     108        fi
     109       
     110       
     111        if [ -z "${CROSS_PREFIX}" ] ; then
     112                CROSS_PREFIX="/usr/local/cross"
     113        fi
     114
     115        for i in "${PLATFORMS[@]}"
     116        do
     117                PLATFORM="$i"
     118                set_target_from_platform "$PLATFORM"
     119                PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}"
     120
     121                echo "== $PLATFORM =="
     122                test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
     123                test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
     124                test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
     125        done
     126
     127        exit
     128}
     129
     130test_app_version() {
     131        PKGNAME="$1"
     132        APPNAME="$2"
     133        REGEX="$3"
     134        INS_VERSION="$4"
     135
     136
     137        APP="${PREFIX}-${APPNAME}"
     138        if [ ! -e $APP ]; then
     139                echo "- $PKGNAME is missing"
     140        else
     141                {
     142                        OUT=$(${APP} -v 2>&1)
     143                } &> /dev/null
     144
     145                if [[ "$OUT" =~ $REGEX ]]; then
     146                VERSION="${BASH_REMATCH[1]}"
     147                if [ "$INS_VERSION" = "$VERSION" ]; then
     148                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     149                else
     150                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     151                fi
     152            else
     153                echo "- $PKGNAME Unexpected output"
     154            fi
     155        fi
     156}
     157
     158
     159
    97160change_title() {
    98161        echo -en "\e]0;$1\a"
     
    408471while [ "$#" -gt 1 ] ; do
    409472        case "$1" in
     473                --test-version)
     474                        test_version "$2"
     475                        exit
     476                        ;;
    410477                --no-install)
    411478                        REAL_INSTALL=false
     
    427494
    428495case "$1" in
     496        --test-version)
     497                test_version
     498                ;;
    429499        amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    430500                prepare
  • uspace/Makefile

    rb4a4ad94 rb9f1585  
    6767        app/netecho \
    6868        app/nterm \
     69        app/pci \
    6970        app/perf \
    7071        app/redir \
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rb4a4ad94 rb9f1585  
    199199
    200200        /* Populate the directory list. */
    201         if (ls.recursive) {
     201        if (ls.recursive && nbdirs > 0) {
    202202                tmp = (struct dir_elem_t *) realloc(*dir_list_ptr,
    203203                    nbdirs * sizeof(struct dir_elem_t));
  • uspace/drv/bus/pci/pciintel/Makefile

    rb4a4ad94 rb9f1585  
    3232
    3333SOURCES = \
     34        ctl.c \
    3435        pci.c
    3536
  • uspace/drv/bus/pci/pciintel/pci.c

    rb4a4ad94 rb9f1585  
    11/*
     2 * Copyright (c) 2019 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    3  * Copyright (c) 2018 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    5858#include <pci_dev_iface.h>
    5959
     60#include "ctl.h"
    6061#include "pci.h"
     62#include "pci_regs.h"
    6163
    6264#define NAME "pciintel"
     
    7375
    7476/** Obtain PCI bus soft-state from DDF device node */
    75 #if 0
    76 static pci_bus_t *pci_bus(ddf_dev_t *dnode)
     77pci_bus_t *pci_bus(ddf_dev_t *dnode)
    7778{
    7879        return ddf_dev_data_get(dnode);
    7980}
    80 #endif
    8181
    8282/** Obtain PCI bus soft-state from function soft-state */
     
    448448
    449449        /* TODO add subsys ids, but those exist only in header type 0 */
     450}
     451
     452/** Get first PCI function.
     453 *
     454 * @param bus PCI bus
     455 * @return First PCI function on @a bus or @c NULL if there is none
     456 */
     457pci_fun_t *pci_fun_first(pci_bus_t *bus)
     458{
     459        link_t *link;
     460
     461        link = list_first(&bus->funs);
     462        if (link == NULL)
     463                return NULL;
     464
     465        return list_get_instance(link, pci_fun_t, lfuns);
     466}
     467
     468/** Get next PCI function.
     469 *
     470 * @param cur Current function
     471 * @return Next PCI function on the same bus or @c NULL if there is none
     472 */
     473pci_fun_t *pci_fun_next(pci_fun_t *cur)
     474{
     475        link_t *link;
     476
     477        link = list_next(&cur->lfuns, &cur->busptr->funs);
     478        if (link == NULL)
     479                return NULL;
     480
     481        return list_get_instance(link, pci_fun_t, lfuns);
    450482}
    451483
     
    691723                                continue;
    692724                        }
     725
     726                        list_append(&fun->lfuns, &bus->funs);
    693727                }
    694728        }
     
    718752                goto fail;
    719753        }
     754
     755        list_initialize(&bus->funs);
    720756        fibril_mutex_initialize(&bus->conf_mutex);
    721757
     
    802838        }
    803839
     840        ddf_fun_set_conn_handler(ctl, pci_ctl_connection);
     841
    804842        /* Enumerate functions. */
    805843        ddf_msg(LVL_DEBUG, "Enumerating the bus");
     
    816854        }
    817855
     856        rc = ddf_fun_add_to_category(ctl, "pci");
     857        if (rc != EOK) {
     858                ddf_msg(LVL_ERROR, "Failed adding control function to category "
     859                    "'pci'.");
     860                goto fail;
     861        }
     862
    818863        hw_res_clean_resource_list(&hw_resources);
    819864
  • uspace/drv/bus/pci/pciintel/pci.h

    rb4a4ad94 rb9f1585  
    3737#define PCI_H_
    3838
     39#include <adt/list.h>
     40#include <ddi.h>
    3941#include <ddf/driver.h>
    40 #include "pci_regs.h"
     42#include <fibril_synch.h>
    4143
    4244#define PCI_MAX_HW_RES 10
     
    5052        pio_window_t pio_win;
    5153        fibril_mutex_t conf_mutex;
     54        /** List of functions (of pci_fun_t) */
     55        list_t funs;
    5256} pci_bus_t;
    5357
     
    5559        pci_bus_t *busptr;
    5660        ddf_fun_t *fnode;
     61        /** Link to @c busptr->funs */
     62        link_t lfuns;
    5763
    5864        int bus;
     
    7177} pci_fun_t;
    7278
     79extern pci_bus_t *pci_bus(ddf_dev_t *);
     80
    7381extern void pci_fun_create_match_ids(pci_fun_t *);
     82extern pci_fun_t *pci_fun_first(pci_bus_t *);
     83extern pci_fun_t *pci_fun_next(pci_fun_t *);
    7484
    7585extern uint8_t pci_conf_read_8(pci_fun_t *, int);
  • uspace/lib/c/Makefile

    rb4a4ad94 rb9f1585  
    165165        generic/assert.c \
    166166        generic/bsearch.c \
     167        generic/pci.c \
    167168        generic/pio_trace.c \
    168169        generic/qsort.c \
  • uspace/lib/c/generic/io/chargrid.c

    rb4a4ad94 rb9f1585  
    263263void chargrid_set_cursor(chargrid_t *scrbuf, sysarg_t col, sysarg_t row)
    264264{
     265        if (col >= scrbuf->cols || row >= scrbuf->rows)
     266                return;
     267
    265268        scrbuf->col = col;
    266269        scrbuf->row = row;
  • uspace/lib/clui/tinput.c

    rb4a4ad94 rb9f1585  
    5656} seek_dir_t;
    5757
     58static void tinput_update_origin(tinput_t *);
    5859static void tinput_init(tinput_t *);
    5960static void tinput_insert_string(tinput_t *, const char *);
     
    7172static void tinput_console_set_lpos(tinput_t *ti, unsigned lpos)
    7273{
    73         console_set_pos(ti->console, LIN_TO_COL(ti, lpos),
    74             LIN_TO_ROW(ti, lpos));
     74        unsigned col = LIN_TO_COL(ti, lpos);
     75        unsigned row = LIN_TO_ROW(ti, lpos);
     76
     77        assert(col < ti->con_cols);
     78        assert(row < ti->con_rows);
     79        console_set_pos(ti->console, col, row);
    7580}
    7681
     
    163168static void tinput_position_caret(tinput_t *ti)
    164169{
     170        tinput_update_origin(ti);
    165171        tinput_console_set_lpos(ti, ti->text_coord + ti->pos);
    166172}
     
    232238
    233239        tinput_display_tail(ti, ti->pos - 1, 0);
    234         tinput_update_origin(ti);
    235240        tinput_position_caret(ti);
    236241}
     
    276281
    277282        tinput_display_tail(ti, ti->pos - ilen, 0);
    278         tinput_update_origin(ti);
    279283        tinput_position_caret(ti);
    280284}
  • uspace/srv/locsrv/locsrv.c

    rb4a4ad94 rb9f1585  
    13901390        categ_dir_add_cat(&cdir, cat);
    13911391
     1392        cat = category_new("pci");
     1393        categ_dir_add_cat(&cdir, cat);
     1394
    13921395        return true;
    13931396}
  • uspace/srv/vfs/vfs_ops.c

    rb4a4ad94 rb9f1585  
    892892        rc = vfs_fd_alloc(&file, false, out_fd);
    893893        if (rc != EOK) {
     894                fibril_rwlock_read_unlock(&namespace_rwlock);
    894895                vfs_node_put(node);
    895896                vfs_file_put(parent);
Note: See TracChangeset for help on using the changeset viewer.