Changeset d46366a in rtems


Ignore:
Timestamp:
01/11/23 07:27:40 (14 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e5a53d6
Parents:
b76f382
git-author:
Sebastian Huber <sebastian.huber@…> (01/11/23 07:27:40)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/12/23 07:15:58)
Message:

riscv: Resurrect RISCV_ENABLE_HTIF_SUPPORT

Low-end configurations may want to have the HTIF support removed.
Enable the option by default. Fix formatting. Fix node validity
checks.

Updates #4779.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bsps/riscv/noel/include/bsp/riscv.h

    rb76f382 rd46366a  
    5151uint32_t riscv_get_hart_index_by_phandle(uint32_t phandle);
    5252
    53 void htif_poweroff(void);
    54 
    5553#ifdef __cplusplus
    5654}
  • bsps/riscv/riscv/console/console-config.c

    rb76f382 rd46366a  
    6161#endif
    6262
     63#ifdef RISCV_ENABLE_HTIF_SUPPORT
    6364static htif_console_context htif_console_instance;
     65#endif
    6466
    6567#if RISCV_CONSOLE_MAX_NS16550_DEVICES > 0
     
    164166    }
    165167
     168#ifdef RISCV_ENABLE_HTIF_SUPPORT
    166169    /* Search for HTIF (eg. on Spike) and use it if found */
    167170    if (fdt_stringlist_contains(compat, compat_len, "ucb,htif0")) {
     
    172175      riscv_console.getchar = htif_console_getchar;
    173176    };
     177#endif
    174178
    175179#if RISCV_CONSOLE_MAX_NS16550_DEVICES > 0
     
    278282)
    279283{
     284#ifdef RISCV_ENABLE_HTIF_SUPPORT
    280285  rtems_termios_device_context *base;
    281286  char htif_path[] = "/dev/ttyShtif";
    282 
     287#endif
    283288#if RISCV_CONSOLE_MAX_NS16550_DEVICES > 0
    284289  char path[] = "/dev/ttyS?";
     
    293298  rtems_termios_initialize();
    294299
     300#ifdef RISCV_ENABLE_HTIF_SUPPORT
    295301  base = &htif_console_instance.base;
    296302  rtems_termios_device_install(htif_path, &htif_console_handler, NULL, base);
     
    299305    link(htif_path, CONSOLE_DEVICE_NAME);
    300306  }
     307#endif
    301308
    302309#if RISCV_CONSOLE_MAX_NS16550_DEVICES > 0
  • bsps/riscv/riscv/console/htif.c

    rb76f382 rd46366a  
    2929
    3030#include <bsp/riscv.h>
     31
     32#ifdef RISCV_ENABLE_HTIF_SUPPORT
    3133
    3234#include <dev/serial/htif.h>
     
    138140  .mode = TERMIOS_POLLED
    139141};
     142
     143#endif /* RISCV_ENABLE_HTIF_SUPPORT */
  • bsps/riscv/riscv/include/bsp/riscv.h

    rb76f382 rd46366a  
    5353uint32_t riscv_get_hart_index_by_phandle(uint32_t phandle);
    5454
     55#ifdef RISCV_ENABLE_HTIF_SUPPORT
    5556void htif_poweroff(void);
     57#endif
    5658
    5759#ifdef __cplusplus
  • bsps/riscv/riscv/irq/irq.c

    rb76f382 rd46366a  
    250250
    251251  if (plic == NULL) {
    252       node = fdt_node_offset_by_compatible(fdt, -1, "ucb,htif0");
    253 
    254       /* Spike platform has HTIF and does not have a PLIC */
    255       if (node != -1) {
    256           return;
    257       } else {
    258           bsp_fatal(RISCV_FATAL_NO_PLIC_REG_IN_DEVICE_TREE);
    259       }
     252#ifdef RISCV_ENABLE_HTIF_SUPPORT
     253    node = fdt_node_offset_by_compatible(fdt, -1, "ucb,htif0");
     254
     255    /* Spike platform has HTIF and does not have a PLIC */
     256    if (node >= 0) {
     257      return;
     258    } else {
     259      bsp_fatal(RISCV_FATAL_NO_PLIC_REG_IN_DEVICE_TREE);
     260    }
     261#else
     262    bsp_fatal(RISCV_FATAL_NO_PLIC_REG_IN_DEVICE_TREE);
     263#endif
    260264  }
    261265
  • bsps/riscv/riscv/start/bsp_fatal_halt.c

    rb76f382 rd46366a  
    4141  fdt = bsp_fdt_get();
    4242
     43#ifdef RISCV_ENABLE_HTIF_SUPPORT
    4344  node = fdt_node_offset_by_compatible(fdt, -1, "ucb,htif0");
    4445
    45   if (node != -1)
    46       htif_poweroff();
     46  if (node >= 0) {
     47    htif_poweroff();
     48  }
     49#endif
    4750
    4851#if RISCV_ENABLE_MPFS_SUPPORT != 0
  • spec/build/bsps/riscv/riscv/opthtif.yml

    rb76f382 rd46366a  
    66copyrights:
    77- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
    8 default: false
     8default: true
    99default-by-variant: []
    1010description: |
    11   enables the HTIF support if defined to a non-zero value, otherwise it is disabled (disabled by default)
     11  Enable the Host/Target Interface (HTIF) support.
    1212enabled-by: true
    1313links: []
Note: See TracChangeset for help on using the changeset viewer.