---
# System prepended metadata

title: Work Note 2

---

# Work Note 2
(2021-Oct-5 ~ Present)

## Works to do

- RainierS3
    - Stress run
        - ? 8kdu+pi (raw)
        - ? 8kdu+pi+h4k (ram)
    - ROM boot + firmware (**purpose: A0 ROM boot up FTK**)
        - * secure boot porting on DC
        - *? ftk run using loader
        - ? X2 nand card
- RainierB0
    - * NVME
        - L1.2 validation
- Tacoma12
    - * ROM development
    - ? ramdisk/rawdisk/ftk run


## RainierS3
### SATA
```
created a branch for rainiers3 sata fw
tacoma HEAD:refs/for/rainiers3_a0_fpga_dv
patches:
http://10.20.0.16:8000/38048
http://10.20.0.16:8000/38049
http://10.20.0.16:8000/38050
patch only for AMD platform
http://10.20.0.16:8000/38051
```
### NVME
```
```




## Tacoma12
### branch, tacoma12_bringup

```
# ramdisk 2 core
./mpc-ramdisk.sh 2 RV32
# ramdisk 4 core
./mpc-ramdisk.sh 4 RV32
# rawdisk 2 core, not validated
# ./mpc-rawdisk.sh 2 tsb
```

### generic, tacoma12_bringup, tacoma12_fpga, tacoma12_bringup_rv32
### 13578 Tacoma12 R5/RV32 Performance
From #10780 Tacoma12 R5/RV32 Performance

- RISC-V, RV32
  - ramdisk only,
  ```
  cmake ../ -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAMDISK=1 -DCPU_RV32=1
  ```
  - ramdisk ddr,
  ```
  cmake ../ -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAMDISK=1 -DDDR=1 -DCPU_RV32=1
  ```
  - rawdisk only, can't run now
  ```
  cmake ../ -DUSE_TSB_NAND=1 -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAWDISK=1 -DCPU_RV32=1
  ```
  - programmer
  ```
  cmake ../ -DUSE_TSB_NAND=1 -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DPROGRAMMER=1 -DCPU_RV32=1
  ```
- ARM, R5
  - ramdisk only,
  ```
  cmake ../ -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAMDISK=1 -DCPU_R5=1
  ```
  - ramdisk ddr,
  ```
  cmake ../ -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAMDISK=1 -DDDR=1 -DCPU_R5=1
  ```
  - rawdisk only, can't run now
  ```
  cmake ../ -DUSE_MU_NAND=1 -DDISABLE_HS_CRC_SUPPORT=1 -DENABLE_SOUT=1 -DFPGA=1 -DRAWDISK=1 -DCPU_R5=1
  ```


## Ticket

### Regression


- 2021-10-13
- bitfile: 
- fw: 
    ─ [x] rs3.a0.fpga.programmer
    ─ [ ] rs3.rawdisk.4kdu.h4k.nopi.aes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [x] rs3.rawdisk.4kdu.h4k.nopi.noaes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [ ] rs3.rawdisk.4kdu.h4k.pi.aes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [ ] rs3.rawdisk.4kdu.h4k.pi.noaes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [ ] rs3.rawdisk.4kdu.h512.nopi.aes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [.] rs3.rawdisk.4kdu.h512.nopi.noaes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [ ] rs3.rawdisk.4kdu.h512.pi.aes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    ─ [ ] rs3.rawdisk.4kdu.h512.pi.noaes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
    - ... wip
    - [-] rs3.rawdisk.4kdu.h512.nopi.noaes.hcrc.rainiers3_a0_fpga_dv.8ae727ee6.elf
### 13965 tacoma12 riscv atomic ops

### [RS3] ROM usb2sata bridge issue

```graphviz
digraph G {

  subgraph cluster_0 {
    style=filled;
    color=lightgrey;
    node [style=filled,color=white];
    a0 []
    a0 -> a1 -> a2 -> a3;
    label = "test #1";
  }

  subgraph cluster_1 {
    node [style=filled];
    b0 -> b1 -> b2 -> b3;
    label = "test #2";
    color=blue
  }
  
  subgraph cluster_2 {
    style=filled;
    color=lightblue;
    node [style=filled,color=white];
    c0 -> c1 -> c2 -> c3;
    label = "test #3";
  }


  start -> a0;
  start -> b0;
  start -> c0;
#  a1 -> b3;
#  b2 -> a3;
#  a3 -> a0;
  a3 -> end;
  b3 -> end;
  c3 -> end;

  start [shape=Mdiamond];
  end [shape=Msquare];
}
```


## MISC

### Containier with gdb-multiarch
- use docker to do cdump
```
$ docker start 88f5f36ebfea
$ docker attach 88f5f36ebfea
$ gdb-multiarch <riscv-elf>
gdb > source <path-to-gef>/gef.py
gef >>> cdump
```
- log

```
# install tools in container
$$ sudo apt update
$$ scp djiang@10.110.27.245:~/github/training/setup/dj.setenv.sh .
$$ sh dj.setenv.sh
$$ sudo apt install gdb-multiarch
## $$ export LANG=en_US.utf8
$$ gdb-multiarch
$$ scp djiang@10.110.27.245:~/igt/t12.fpga/tmp/main .
$$ gdb-multiarch main.elf

# install docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg  lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo   "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ apt-cache madison docker-ce
$ docker --version
$ sudo systemctl status docker
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ sudo usermod -aG docker abhilash
$ groups

# pull images 
$ docker search ubuntu20
$ docker pull homebrew/ubuntu20.04
$ docker images
$ docker run -it homebrew/ubuntu20.04
$ docker ps -a
$ docker start 88f5f36ebfea
$ docker attach 88f5f36ebfea
```
## install docker on ubuntu 17.10
[How to install docker on buntu 17.10](https://gist.github.com/levsthings/0a49bfe20b25eeadd61ff0e204f50088)

## Installing Docker CE on Ubuntu 17.10 Artful Aardvark

As of 20/10/2017, a release file for Ubuntu 17.10 Artful Aardvark is not available on [Download Docker](https://download.docker.com/linux/ubuntu/dists/).

If you are used to installing Docker to your development machine with `get-docker` [script](https://get.docker.com/), that won't work either. So the solution is to install Docker CE from the `zesty` package.

```terminal
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"

sudo apt-get update
sudo apt-get install docker-ce
```

## ROM

```graphviz
digraph G {
    
}
```


```shell=
# dump elf2.bin binary file to hex output to std out
 $ hexdump -v -e '16/1 "%02X " "\n"' elf2.bin
```

# Gerrit Repos

```
10.20.0.16:8000: Tacoma (All projects)
10.20.0.64:8000: DC (RainierS)
```

Server -> Repo -> Branch

## Tacoma Server

- tacoma
  - rainier_a0
  - rainier_b0
  - rainier3
  - rainier_S
  - tacoma12
  - ...
- mu
- shared_tool
- srb_header
- ...

## DC Server

- RainierS
  - rainier_S_DC
  - rainierS_FPGA
- shared_tool
- srb_header

## Start to work with package build

- download repo
  - `git clone repo`
- update submodules
  - `git submodule init`
  - `git submodule update`
    - shared_tool
    - srb_header
- `img_builder.py` is changed to `img_builder_20.py` according to crc32c applied. Original tool uses crc32.

```graphviz
digraph G {
    rankdir=LR
    Server[shape=box]
    Repo[shape=box]
    Branch[shape=box]
    ToBeUpdated[shape=note fontcolor=red]
    Server -> Repo -> Branch
    Tacoma -> tacoma
    tacoma -> rainier_a0
    tacoma -> rainier_b0
    tacoma -> rainier3
    tacoma -> rainier_S
    Tacoma -> mu
    Tacoma -> shared_tool
    Tacoma -> srb_header
    DC -> RainierS
    RainierS -> rainier_S_DC
    RainierS -> rainierS_FPGA
    DC -> shared_tool_1
    DC -> srb_header_1
    ToBeUpdated -> shared_tool_1 [style=dotted]
    ToBeUpdated -> srb_header_1 [style=dotted]
    shared_tool -> ToBeUpdated [style=dotted]
    srb_header -> ToBeUpdated [style=dotted]
    {rank=same; Server; Tacoma; DC}
    {rank=same; tacoma; RainierS; Repo; shared_tool_1; srb_header_1}
    {rank=same; ToBeUpdated; Branch}
}

```

## ticket 14143 and ticket 14308

```graphviz
digraph G {
    rankdir=LR
    img_builder_20
    sign
    encrypt
    
}

```

## Rainier B0 ZNS


### NVME
```
Program received signal SIGTRAP, Trace/breakpoint trap.
0x2000338e in writel (addr=0xc003c004, val=0) at /home/djiang/igt/rb0.1/rtos/armv7r/io.h:18
18      /home/djiang/igt/rb0.1/rtos/armv7r/io.h: No such file or directory.
(gdb) bt
#0  0x2000338e in writel (addr=0xc003c004, val=0) at /home/djiang/igt/rb0.1/rtos/armv7r/io.h:18
#1  cmd_proc_writel (reg=4, val=0) at /home/djiang/igt/rb0.1/nvme/src/nvme_cmd_proc/nvme_cmd_proc.c:287
#2  cmd_proc_resume (abort=abort@entry=0) at /home/djiang/igt/rb0.1/nvme/src/nvme_cmd_proc/nvme_cmd_proc.c:1998
#3  0x200c8f2c in cmd_proc_init () at /home/djiang/igt/rb0.1/nvme/src/nvme_cmd_proc/nvme_cmd_proc.c:2071
#4  0x200c8a24 in nvmet_init () at /home/djiang/igt/rb0.1/nvme/src/nvme_ctrl/nvme_ctrl.c:4644
#5  0x200c804c in fw_init () at /home/djiang/igt/rb0.1/main.c:113
#6  main () at /home/djiang/igt/rb0.1/main.c:195

```

#### tracking nvme identify

```
2134 typedef union {
2135     u32 all;
2136     struct {
2137         u32 cc_en_set:1;
2138         u32 cc_en_clear:1;
2139         u32 cc_shn_2000:1;
2140         u32 nssr:1;
2141         u32 adm_sq_tail_updt:1;
2142         u32 io_sq_tail_updt:1;
2143         u32 adm_cmd_fetched:1;
2144         u32 io_cmd_fetched:1;
2145         u32 nvm_cmd_fetch_done:1;
2146         u32 nvm_cq_send_done:1;
2147         u32 dma_queue0_xfer_done:1;
2148         u32 dma_queue1_xfer_done:1;
2149         u32 ntbl_auto_lkup_done:1;
2150         u32 fw_ntbl_access_done:1;
2151         u32 fw_cq_req_done:1;
2152         u32 boot_partition_read_op:1;
2153         u32 nvm_cmd_fetch_error:1;
2154         u32 dma_read_cmpl_error:1;
2155         u32 dma_queue_xfer_error:1;
2156         u32 rsvd_19:1;
2157         u32 que_ptr_update_err:1;
2158         u32 sram_parity_errs:1;
2159         u32 axi_bus_parity_errs:1;
2160         u32 hw_cq_buf_empty_not:1;
2161         u32 hw_sram_init_done:1;
2162         u32 fw_cq_err:1;
2163         u32 any_vf_cc_en_set:1;
2164         u32 any_vf_adm_cmd_fetched:1;
2165         u32 rsvd_28:1;
2166         u32 any_flr_active:1;
2167         u32 rsvd_30:1;
2168         u32 cc_en_status:1;
2169     } b;
2170 } nvme_unmasked_int_status_t;

```

### BTN

```
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000383e in writel (addr=0xc0010294, val=45536) at /home/djiang/igt/rb0.1/rtos/armv7r/io.h:18
18      /home/djiang/igt/rb0.1/rtos/armv7r/io.h: No such file or directory.
(gdb) bt
#0  0x0000383e in writel (addr=0xc0010294, val=45536) at /home/djiang/igt/rb0.1/rtos/armv7r/io.h:18
#1  btn_writel (reg=660, val=45536) at /home/djiang/igt/rb0.1/btn/dpe/../inc/btn.h:136
#2  sync_dpe_init () at /home/djiang/igt/rb0.1/btn/dpe/sync_dpe.c:110
#3  sync_dpe_reset () at /home/djiang/igt/rb0.1/btn/dpe/sync_dpe.c:135
#4  0x2000307c in dpe_init () at /home/djiang/igt/rb0.1/btn/dpe/dpe.c:1065
#5  0x20002d12 in btn_core_resume_phase1 () at /home/djiang/igt/rb0.1/btn/btn_core.c:1199
#6  0x20001ba2 in btn_resume_phase1 () at /home/djiang/igt/rb0.1/btn/btn.c:166
#7  0x200c8734 in btn_init () at /home/djiang/igt/rb0.1/btn/btn.c:223
#8  0x200c804c in fw_init () at /home/djiang/igt/rb0.1/main.c:113
#9  main () at /home/djiang/igt/rb0.1/main.c:195

```

### irq

```
(gdb) p poll_isr_tbl 
$3 =   {0x64ed <nvmet_isr>,
  0x0 <atcm_base>,
  0x7d2d <btn_nrd_cmd_in>,
  0x7d4d <btn_prd_cmd_in>,
  0x7d6d <btn_w_cmd_in>,
  0x0 <atcm_base>,
  0x8285 <btn_data_in_isr>,
  0x8285 <btn_data_in_isr>,
  0x8285 <btn_data_in_isr>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x84b1 <bm_isr_com_free>,
  0x7165 <bm_isr_slow>,
  0x7a65 <btn_rcmd_rls_isr>,
  0x7d8d <btn_wcmd_rls_isr>,
  0x0 <atcm_base>,
  0x7165 <bm_isr_slow>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0xa9d5 <cmd_proc_isr>,
  0xa9d5 <cmd_proc_isr>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x0 <atcm_base>,
  0x1771 <timer_isr>,
  0x17f5 <poll_sys_misc_isr>}

```