Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what license does this project fall under #1

Closed
causten opened this issue Mar 11, 2015 · 1 comment
Closed

what license does this project fall under #1

causten opened this issue Mar 11, 2015 · 1 comment

Comments

@causten
Copy link

causten commented Mar 11, 2015

I see files that show GPLv2 and others that show nothing. For the files that show nothing what is the license?

@tfangit
Copy link
Contributor

tfangit commented Mar 11, 2015

Chris, they are under GPLv2.

@tfangit tfangit closed this as completed Mar 11, 2015
facebook-github-bot pushed a commit that referenced this issue Aug 27, 2017
Summary: Add node_bmc.py in project layer to replace the file in common layer.

Reviewed By: jmehta

Test Plan:
Check node /peb/bmc: pass

--

[root@localhost ~]# curl -x "" http://fe80::ff:fe00:1%enp0s29u1u2u1:8080/api/peb/bmc | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   581  100   581    0     0    367      0  0:00:01  0:00:01 --:--:--   367
{
    "Actions": [
        "reboot"
    ],
    "Information": {
        "CPU Usage": "CPU:  15% usr  84% sys   0% nic   0% idle   0% io   0% irq   0% sirq",
        "Description": "Lightning BMC",
        "MAC Addr": "29:2E:51:63:30:4F",
        "Memory Usage": "Mem: 101032K used, 113408K free, 612K shrd, 0K buff, 78476K cached",
        "OpenBMC Version": "",
        "Reset Reason": "User Initiated Reset or WDT Reset",
        "Uptime": " 09:57:39 up 4 min,  load average: 1.89, 0.97, 0.40\n",
        "kernel version": "4.1.15 #1 Thu Aug 24 14:00:52 CST 2017",
        "u-boot version": "U-Boot 2016.07 lightning-e7e5215 (Aug 25 2017 - 17:27:04 +0800)"
    },
    "Resources": []
}

fbshipit-source-id: 789d2ce
facebook-github-bot pushed a commit that referenced this issue Oct 26, 2017
Summary: TPM is usually a part of the BMC design and so this diff extends BMC node to display TPM version information

Test Plan:
Tested on Bryce Canyon: rtptest1413-oob.prn3

  $ curl http://rtptest1413-oob.prn3.facebook.com:8080/api/iom/bmc  | python -m json.tool

  {
      "Actions": [
          "reboot"
      ],
      "Information": {
          "CPU Usage": "CPU:  16% usr  58% sys   0% nic  25% idle   0% io   0% irq   0% sirq",
          "Description": "FBTTN BMC",
          "MAC Addr": "24:8A:07:A4:93:4E",
          "Memory Usage": "Mem: 99360K used, 336424K free, 704K shrd, 0K buff, 56084K cached",
          "OpenBMC Version": "1.6",
          "Reset Reason": "User Initiated Reset or WDT Reset",
          "TPM FW version": "133.32",
          "TPM TCG version": "1.2",
          "Uptime": " 05:48:04 up 9 min,  load average: 2.85, 2.68, 1.42\n",
          "kernel version": "4.1.15 #1 Mon Oct 16 00:54:14 PDT 2017",
          "u-boot version": "U-Boot SPL 2016.07 fbttn-v1.6 (Oct 16 2017 - 00:55:22)\nU-Boot 2016.07 fbttn-v1.6 (Oct 16 2017 - 00:55:27 -0700)"
      },
      "Resources": []
  }

Reviewed By: amithash

fbshipit-source-id: e1a89de
facebook-github-bot pushed a commit that referenced this issue Nov 17, 2017
Summary:
Summary
- Move bios-util version from v0.1 to v0.2.
- Add and modularize these features for project-specific: plat_info, pcie_config, pcie_port_config.
- Select with bios-util supports feature by bios_board.py.

Test Plan
- It works on Bryce Canyon DVT type 5 system.

 ---

1. boot_order:
  (1) clear_CMOS:
      root@bmc:/tmp# bios-util server boot_order --clear_CMOS --get
      Clear CMOS Function: Disabled
      root@bmc:/tmp# bios-util server boot_order --clear_CMOS --enable
      root@bmc:/tmp# bios-util server boot_order --clear_CMOS --get
      Clear CMOS Function: Enabled
      root@bmc:/tmp# bios-util server boot_order --clear_CMOS --disable
      root@bmc:/tmp# bios-util server boot_order --clear_CMOS --get
      Clear CMOS Function: Disabled
  (2) force_boot_BIOS_setup:
      root@bmc:/tmp# bios-util server boot_order --force_boot_BIOS_setup --get
      Force Boot to BIOS Setup Function: Disabled
      root@bmc:/tmp# bios-util server boot_order --force_boot_BIOS_setup --enable
      root@bmc:/tmp# bios-util server boot_order --force_boot_BIOS_setup --get
      Force Boot to BIOS Setup Function: Enabled
      root@bmc:/tmp# bios-util server boot_order --force_boot_BIOS_setup --disable
      root@bmc:/tmp# bios-util server boot_order --force_boot_BIOS_setup --get
      Force Boot to BIOS Setup Function: Disabled
  (3) boot_order:
      root@bmc:/tmp# bios-util server boot_order --boot_order --get
      Boot Order: USB Device, IPv6 Network, SATA HDD, SATA-CDROM, Other Removable Device
      root@bmc:/tmp# cfg-util slot1_boot_order
      810009020304
      root@bmc:/tmp# bios-util server boot_order --boot_order --set 0 1 2 3 4
      root@bmc:/tmp# bios-util server boot_order --boot_order --get
      Boot Order: USB Device, IPv4 Network, SATA HDD, SATA-CDROM, Other Removable Device
      root@bmc:/tmp# cfg-util slot1_boot_order
      810001020304
      root@bmc:/tmp# bios-util server boot_order --boot_order --disable
      root@bmc:/tmp# cfg-util slot1_boot_order
      010001020304
      root@bmc:/tmp# bios-util server boot_order --boot_order --set 0 9 2 3 4
      root@bmc:/tmp# cfg-util slot1_boot_order
      810009020304
2. postcode:
   root@bmc:/tmp# bios-util server postcode --get
   2 3 6 1D 19 A1 A3 A3 A7 A9 A7 A7 A7 A8 A9 A9 A9 AA AA AA AE AF B0 B1 B4 B2 B3 B6 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B8 B9 B9 BA B7 BB BC BF 33 32 4F 9A 78 68 70 79 91 92 94 94 94 94 94 94 95 96 97 98 9D 9C B4 B4 B4 B4 B4 B4 92 A0 A2 AD D9 AD D9 AD A0 84 AA 0
3. plat_info:
   root@bmc:/tmp# bios-util server plat_info --get
   Presense: Present
   Non Test Board
   SKU: Triton-Type 5B (Right sub-system)
   Slot Index: 1
4. pcie_config:
   root@bmc:/tmp# bios-util server pcie_config --get
   PCIe Configuration:Triton-Type 5
5. pcie_port_config:
   root@bmc:/tmp# bios-util server pcie_port_config --get
   * PCIe Port #3 is invalid and will be ignored.
     SCC IOC: Unknown
     flash1: Unknown
     flash2: Unknown
   * PCIe Port #1 is invalid and will be ignored.
     NIC: Unknown
   root@bmc:/tmp# cfg-util server_pcie_port_config
   0000
   root@bmc:/tmp# bios-util server pcie_port_config --set --disable scc_ioc
   root@bmc:/tmp# bios-util server pcie_port_config --set --disable flash1
   root@bmc:/tmp# bios-util server pcie_port_config --set --disable flash2
   root@bmc:/tmp# bios-util server pcie_port_config --set --disable nic
   root@bmc:/tmp# bios-util server pcie_port_config --get
     SCC IOC: Disabled
     flash1: Disabled
     flash2: Disabled
     NIC: Disabled
   root@bmc:/tmp# cfg-util server_pcie_port_config
   838f
   root@bmc:/tmp# bios-util server pcie_port_config --set --enable scc_ioc
   root@bmc:/tmp# bios-util server pcie_port_config --set --enable flash1
   root@bmc:/tmp# bios-util server pcie_port_config --set --enable flash2
   root@bmc:/tmp# bios-util server pcie_port_config --set --enable nic
   root@bmc:/tmp# bios-util server pcie_port_config --get
     SCC IOC: Enabled
     flash1: Enabled
     flash2: Enabled
     NIC: Enabled
   root@bmc:/tmp# cfg-util server_pcie_port_config
   8080

Reviewed By: benwei13

fbshipit-source-id: 73e3e43
facebook-github-bot pushed a commit that referenced this issue Nov 22, 2017
Summary:
1. To keep LogUtilFileFormat compatible with standard RsyslogFileFormat; appending the bmc_version_tag to %msg% section.
2. Log all the syslog message to the remote syslog server
3. Log the mTerm logs (host console history) to remote syslog server

Test Plan:
Query for the logs for fbttn platform:

[#1 verified] since the bmc_version_tag in %msg%
[#2 verified] syslog message is based on the template LogUtilFileFormat
[#3 verified] verified that syslog sends mTerm logs to remote server with tag 'oob_console' as 'local0.debug'

Reviewed By: jmehta

fbshipit-source-id: 580e7b0
facebook-github-bot pushed a commit that referenced this issue Dec 21, 2017
Summary:
1. sometimes ipmbd may crash during IPMB stress due to SIGSEGV when calling pthread_create:
\--------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1762]
0x4c9a68d8 in pthread_create () from /lib/libpthread.so.0
(gdb) bt
\#0  0x4c9a68d8 in pthread_create () from /lib/libpthread.so.0
\#1  0x00011664 in ipmb_lib_handler (bus_num=0xbeffabdf) at /usr/src/debug/ipmbd/0.1-r2/ipmbd.c:804
\#2  0x4c9a60e8 in ?? () from /lib/libpthread.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
\--------------------------------------------------------------------------------------------------

It's "Bug 20116: Fix use after free in pthread_create()" of glibc, so add the patch to fix it.
source: git://sourceware.org/git/glibc.git

Test Plan: build and test pass on fby2 system

Reviewed By: sdasari73

fbshipit-source-id: 70c9df9
facebook-github-bot pushed a commit that referenced this issue Feb 15, 2018
Summary: The aggregator messes up the logs into a single long log line in the format <line1>#1<line2>#1<line3>. Please see the task description for further details.

Test Plan: Test the change on bryce-canyon which ran old template until 4am PST and then move to the new config. Check Phabricator comments for the data.

Reviewed By: amithash

fbshipit-source-id: 6e75c26
facebook-github-bot pushed a commit that referenced this issue Mar 21, 2018
Summary: Move vboot information gathering into bmc node.

Test Plan:
curl http://$IP:8080/api/sled/mb/bmc
{"Resources": [], "Actions": ["reboot"], "Information": {"TPM FW version": "133.32", "SPI0 Vendor": "Winbond", "CPU Usage": "CPU:  37% usr  62% sys   0% nic   0% idle   0% io   0% irq   0% sirq", "TPM TCG version": "1.2", "Memory Usage": "Mem: 106972K used, 328784K free, 2200K shrd, 0K buff, 61608K cached", "kernel version": "4.1.15 #1 Tue Mar 6 18:07:00 PST 2018", "Description": "fbtp BMC", "Uptime": "20:57:10 up 52 min,  load average: 5.22, 5.18, 4.87", "vboot": {"uboot_time": "Wed Mar  7 20:04:06 UTC 2018", "recovery_retried": "0x00", "cert_time": "Sat Jun 17 20:17:06 UTC 2017", "cert_fallback_time": "Sat Jun 17 20:17:06 UTC 2017", "recovery_boot": "0x00", "hardware_enforce": "0x00", "status": "0.0", "uboot_fallback_time": "Tue Feb 27 19:59:54 UTC 2018", "force_recovery": "0x00", "tpm_status": "0", "status_text": "OpenBMC was verified correctly"}, "MAC Addr": "EC:0D:9A:65:D1:22", "SPI1 Vendor": "Winbond", "u-boot version": "U-Boot SPL 2016.07 fbtp-7e8d1ae (Mar 07 2018 - 12:00:25), U-Boot 2016.07 fbtp-7e8d1ae (Mar 07 2018 - 12:00:31 -0800)", "Reset Reason": "User Initiated Reset or WDT Reset", "OpenBMC Version": ""}}

Reviewed By: benwei13

fbshipit-source-id: 44ba889
facebook-github-bot pushed a commit that referenced this issue Mar 30, 2018
Summary: Add support set/get BIOS boot mode in boot_order node.

Test Plan:
It works on Bryce Canyon DVT type 5 system and check the behavior by curl command.

Test Result
```
1. # curl http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   197  100   197    0     0     29      0  0:00:06  0:00:06 --:--:--    55
  {
      "Actions": [
          "set"
      ],
      "Information": {
          "Boot Mode": "UEFI",
          "Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }",
          "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"
      },
      "Resources": []
  }
2. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "0"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "success"
  }
3. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "1"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "success"
  }
4. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "2"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "failure"
  }
```

Reviewed By: jmehta

fbshipit-source-id: bc2e047
facebook-github-bot pushed a commit that referenced this issue Mar 30, 2018
Summary:
Summary
- Add support set/get BIOS boot mode in boot_order option.

Test Plan
- Build pass in Bryce Canyon, FBTP, and FBY2.
- It works on Bryce Canyon DVT type 5 system and check the behavior by curl command.

Test Result
1. # curl http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   197  100   197    0     0     29      0  0:00:06  0:00:06 --:--:--    55
  {
      "Actions": [
          "set"
      ],
      "Information": {
          "Boot Mode": "UEFI",
          "Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }",
          "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"
      },
      "Resources": []
  }
2. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "0"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "success"
  }
3. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "1"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "success"
  }
4. # curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "2"}' http://2000::268a:7ff:fe8d:6c70:8080/api/server/bios/boot-order/boot_mode | python -m json.tool
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
  {
      "result": "failure"
  }

Reviewed By: jmehta

fbshipit-source-id: 1580bfb
facebook-github-bot pushed a commit that referenced this issue Apr 4, 2018
Summary:
1. update api tree in plat_tree.py
2. update key value setting function in pal.py
3. add necessary lib in rest-api_0.2.bbappend

Test Plan:
Build and test pass on YV2 DVT system

root@ypinky:/home/pinky/work/openbmc/yosemiteV2/openbmc.wiwynn/openbmc.wiwynn/build-dir# curl http://2000::50:8080/api/server1/bios/boot-order/boot_mode | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   197  100   197    0     0     36      0  0:00:05  0:00:05 --:--:--    44
{
    "Actions": [
        "set"
    ],
    "Information": {
        "Boot Mode": "UEFI",
        "Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }",
        "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"
    },
    "Resources": []
}
root@ypinky:/home/pinky/work/openbmc/yosemiteV2/openbmc.wiwynn/openbmc.wiwynn/build-dir# curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "0"}' http://2000::50:8080/api/server1/bios/boot-order/boot_mode | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
{
    "result": "success"
}
root@ypinky:/home/pinky/work/openbmc/yosemiteV2/openbmc.wiwynn/openbmc.wiwynn/build-dir# curl http://2000::50:8080/api/server1/bios/boot-order/boot_mode | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   199  100   199    0     0     30      0  0:00:06  0:00:06 --:--:--    55
{
    "Actions": [
        "set"
    ],
    "Information": {
        "Boot Mode": "Legacy",
        "Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }",
        "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"
    },
    "Resources": []
}
root@ypinky:/home/pinky/work/openbmc/yosemiteV2/openbmc.wiwynn/openbmc.wiwynn/build-dir# curl -H "Content-Type: application/json" -X POST -d '{"action": "set", "mode": "1"}' http://2000::50:8080/api/server1/bios/boot-order/boot_mode | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    51  100    21  100    30      3      4  0:00:07  0:00:06  0:00:01     0
{
    "result": "success"
}
root@ypinky:/home/pinky/work/openbmc/yosemiteV2/openbmc.wiwynn/openbmc.wiwynn/build-dir# curl http://2000::50:8080/api/server1/bios/boot-order/boot_mode | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   197  100   197    0     0     31      0  0:00:06  0:00:06 --:--:--    59
{
    "Actions": [
        "set"
    ],
    "Information": {
        "Boot Mode": "UEFI",
        "Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }",
        "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"
    },
    "Resources": []
}

Reviewed By: benwei13

fbshipit-source-id: 5eaea1e
facebook-github-bot pushed a commit that referenced this issue May 24, 2018
Summary:
We have 882 MB RAM available on cmm platform (after ECC reserve), but given a 3/1 virtual address split, kernel truncates the RAM to 760 MB because it doesn't have enough virtual space to map the entire RAM. Only 760MB is available for direct mappings because: among 1GB kernel virtual space, 16MB (0xFF000000-0xFFFFFFFF) are reserved for fixmap/vector and 248MB (0xEF800000-0xFF000000, including 8MB hole for error detection) are reserved for vmalloc and io mappings.

We have considered 3 options to solve the problem, and finally we decide to go with option #1 because of high returns and low risk:

1) Extend kernel virtual space from 1GB to 2GB (CONFIG_VMSPLIT_2GB).
    Technically speaking, modifying address space allocation may potentially break some non-standard user level applications which make assumptions about user address space, but the risk is very low and I don't see any issues in my testing, so I believe it's worth making the change.

2) Enable CONFIG_HIGHMEM option.
    As the cost of handling high memory (temporary mappings) can be quite high, getting back 100+ MB physical RAM may not improve system performance (it may get worse in some cases), and this is why we don't want to go with this option.

3) Decrease size of vmalloc area.
    Doing this may lead to vmalloc/ioremap failures.

Test Plan:
1) "bitbake cmm-image" succeeded.
2) booted up cmm board: 882 MB RAM are directly mapped into kernel successfully.
3) Upgraded cmm syscpld (cmmcpld_update.sh cpld.vme) successfully.

Below is bootup log for reference; please suggest if you feel more tests are needed.
P59600480

Reviewed By: covracer

fbshipit-source-id: 0b15741
facebook-github-bot pushed a commit that referenced this issue Jun 7, 2018
Summary: 1. as title, to avoid the problem that set boot_order fails, but rest-api get 'success' result

Test Plan:
root@cosmo-System-Product-Name:\~# curl http://10.10.12.229:8080/api/server1/bios/boot-order/boot_order | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   453  100   453    0     0     63      0  0:00:07  0:00:07 --:--:--   113
{
    "Actions": [
        "set",
        "disable"
    ],
    "Information": {
        "Boot Order": "USB Device, IPv4 Network, SATA HDD, SATA-CDROM, Other Removable Device",
        "Note #1: Actions Format:": "{'action': 'set', '1st': <1st_no>, '2nd': <2nd_no>, '3rd': <3rd_no>, '4th': <4th_no>, '5th': <5th_no>}",
        "Note #2: Boot Order No.": "{ 0: 'USB Device', 1: 'IPv4 Network', 9: 'IPv6 Network', 2: 'SATA HDD', 3: 'SATA-CDROM', 4: 'Other Removalbe Device', 255: 'Reserved' }"
    },
    "Resources": []
}
root@cosmo-System-Product-Name:\~# curl -H "Content-Type: application/json" -X POST -d '{"action":"set", "1st":"1", "2nd":"2", "3rd":"9", "4th":"3", "5th":"4"}' http://10.10.12.229:8080/api/server1/bios/boot-order/boot_order | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    92  100    21  100    71      2     10  0:00:10  0:00:07  0:00:03     0
{
    "result": "failure"
}
root@cosmo-System-Product-Name:\~# curl -H "Content-Type: application/json" -X POST -d '{"action":"set", "1st":"0", "2nd":"2", "3rd":"2", "4th":"3", "5th":"4"}' http://10.10.12.229:8080/api/server1/bios/boot-order/boot_order | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    92  100    21  100    71      2      9  0:00:10  0:00:07  0:00:03     0
{
    "result": "failure"
}
root@cosmo-System-Product-Name:\~# curl -H "Content-Type: application/json" -X POST -d '{"action":"set", "1st":"2", "2nd":"1", "3rd":"0", "4th":"3", "5th":"4"}' http://10.10.12.229:8080/api/server1/bios/boot-order/boot_order | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    92  100    21  100    71      2      9  0:00:10  0:00:07  0:00:03     0
{
    "result": "success"
}
root@cosmo-System-Product-Name:\~# curl http://10.10.12.229:8080/api/server1/bios/boot-order/boot_order | python -m json.tool  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   453  100   453    0     0     66      0  0:00:06  0:00:06 --:--:--    97
{
    "Actions": [
        "set",
        "disable"
    ],
    "Information": {
        "Boot Order": "SATA HDD, IPv4 Network, USB Device, SATA-CDROM, Other Removable Device",
        "Note #1: Actions Format:": "{'action': 'set', '1st': <1st_no>, '2nd': <2nd_no>, '3rd': <3rd_no>, '4th': <4th_no>, '5th': <5th_no>}",
        "Note #2: Boot Order No.": "{ 0: 'USB Device', 1: 'IPv4 Network', 9: 'IPv6 Network', 2: 'SATA HDD', 3: 'SATA-CDROM', 4: 'Other Removalbe Device', 255: 'Reserved' }"
    },
    "Resources": []
}

Reviewed By: amithash

fbshipit-source-id: c2e3553
facebook-github-bot pushed a commit that referenced this issue Jun 12, 2018
Summary:
Migrate the tree based implementation of the openBMC
rest framework to use aiohttp instead of bottle/cherryPy.

Test Plan:
Build and load onto fbtp. Log-onto connected test server and issue curl commands ($IP is the IP address of the BMC)
[guest@localhost ~]$ curl http://$IP:8080/api
{"Information": {"Description": "fbtp RESTful API Entry"}, "Resources": ["sled"], "Actions": []}[guest@localhost ~]$
[guest@localhost ~]$ curl http://$IP:8080/api/sled
{"Information": {"Description": "fbtp SLED"}, "Resources": ["mb", "mezz"], "Actions": []}[guest@localhost ~]$
[guest@localhost ~]$ curl http://$IP:8080/api/sled/mb
{"Information": {"status": "power-on"}, "Resources": ["fruid", "bmc", "sensors", "logs"], "Actions": []}[guest@localhost ~]$
[guest@localhost ~]$ curl http://$IP:8080/api/sled/mb/bmc
{"Information": {"Memory Usage": "Mem: 117772K used, 317952K free, 1472K shrd, 0K buff, 68344K cached", "SPI0 Vendor": "Winbond", "At-Scale-Debug Running": false, "OpenBMC Version": "1.1", "TPM TCG version": "1.2", "u-boot version": "U-Boot SPL 2016.07 fbtp-1dd9d03 (Jun 08 2018 - 11:56:45), U-Boot 2016.07 fbtp-1dd9d03 (Jun 08 2018 - 11:56:48 -0700)", "MAC Addr": "$MAC_ADDR", "Description": "fbtp BMC", "kernel version": "4.1.51 #1 Tue Jun 5 19:00:54 PDT 2018", "TPM FW version": "133.33", "SPI1 Vendor": "Winbond", "Uptime": "20:01:21 up 4 min,  load average: 2.07, 1.35, 0.58", "Reset Reason": "User Initiated Reset or WDT Reset", "vboot": {"tpm_status": "0", "status_text": "OpenBMC was verified correctly", "recovery_boot": "0x00", "status": "0.0", "cert_fallback_time": "Sat Jun 17 20:17:06 UTC 2017", "recovery_retried": "0x00", "uboot_time": "Fri Jun  8 18:58:51 UTC 2018", "force_recovery": "0x00", "cert_time": "Sat Jun 17 20:17:06 UTC 2017", "hardware_enforce": "0x00", "uboot_fallback_time": "Fri Jun  8 18:47:29 UTC 2018"}, "CPU Usage": "CPU:  46% usr  53% sys   0% nic   0% idle   0% io   0% irq   0% sirq"}, "Resources": [], "Actions": []}[guest@localhost ~]$

Ensure actions are turned off:
root@bmc-oob:~# curl -X POST -d '{"action": "power-off"}' http://localhost:8080/api/sled/mb
405: Method Not Allowed

# in /etc/rest.cfg, change 'write = false' to 'write = true'
# sv restart restapi
# ensure power-util mb status reports as server being on.
/rest.py: REST: Launched with Read/Write Mode
root@bmc-oob:~# curl -X POST -d '{"action": "power-off"}' http://localhost:8080/api/sled/mb
{"result": "success"}
# Ensure power-util mb status shows server is off.

Reviewed By: benwei13, covracer

fbshipit-source-id: fe9b21c
facebook-github-bot pushed a commit that referenced this issue Jun 25, 2018
Summary: This diff flips the switch to fscd for wedge100.

Test Plan:
Lab testing:
root@bmc-oob:/tmp/tests/wedge100/unittests# python fscd_test.py
[FSCD Testing] Setting (userver=23.0C, switch=23.0C ,intake=23.0C, outlet=23.0C)
[FSCD Testing] PWM test,expected=38% [PASSED]
[FSCD Testing] Setting (userver=23.0C, switch=28.0C ,intake=28.0C, outlet=23.0C)
[FSCD Testing] PWM test,expected=38% [PASSED]
[FSCD Testing] Setting (userver=30.0C, switch=32.0C ,intake=33.0C, outlet=30.0C)
[FSCD Testing] PWM test,expected=38% [PASSED]
[FSCD Testing] Setting (userver=32.0C, switch=32.0C ,intake=37.0C, outlet=32.0C)
[FSCD Testing] PWM test,expected=51% [PASSED]
[FSCD Testing] Setting (userver=32.0C, switch=32.0C ,intake=39.0C, outlet=32.0C)
[FSCD Testing] PWM test,expected=51% [PASSED]
[FSCD Testing] Setting (userver=32.0C, switch=38.0C ,intake=42.0C, outlet=32.0C)
[FSCD Testing] PWM test,expected=74% [PASSED]
[FSCD Testing] Setting (userver=40.0C, switch=41.0C ,intake=50.0C, outlet=40.0C)
[FSCD Testing] PWM test,expected=100% [PASSED]
[FSCD Testing] Setting (userver=46.0C, switch=47.0C ,intake=85.0C, outlet=46.0C)
[FSCD Testing] PWM test,expected=100% [PASSED]
[FSCD Testing] System should shutdown because temperature  limit reached. Verifying...
[FSCD Testing] Host action test: Expected userver to power off due to high temperature event [PASSED]
[FSCD Testing] Recovering system for next test...
[FSCD Testing] Setting (userver=40.0C, switch=41.0C ,intake=44.0C, outlet=40.0C)
[FSCD Testing] PWM test,expected=74% [PASSED]
[FSCD Testing] Ready for next test...
g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM)
[FSCD Testing] Host action test: Expected userver to power off due to read failure event [PASSED]
[FSCD Testing] PWM test,expected=100% [PASSED]
g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM)
[FSCD Testing] Host action test: Expected userver to power on due to fan RPM read failure event but fantray status is GOOD [PASSED]
FSCD Testing [PASSED]

Accton Testing:
Based on chat with vii, data from FSCD is similar to Fand. On startup there is improvement.

Reviewed By: covracer

fbshipit-source-id: 53db311
facebook-github-bot pushed a commit that referenced this issue Sep 21, 2018
…compatible

Summary:
Bring in information exposed in V1 which are not exposed in V2.
Make sure V2 is a super set of information provided by V1.

Test Plan:
root@bmc-oob:~# curl http://localhost:8080/api/bmc
{"Information": {"OpenBMC Version": "", "Uptime": "00:46:50 up 2 min,  load average: 2.23, 0.96, 0.36", "load-1": "2.23", "SPI0 Vendor": "Winbond", "load-5": "0.97", "Description": "fbtp BMC", "SPI1 Vendor": "Winbond", "At-Scale-Debug Running": true, "MAC Addr": "EC:0D:9A:65:D1:22", "open-fds": "721", "kernel version": "4.1.51 #1 Wed Sep 19 16:00:20 PDT 2018", "TPM FW version": "133.32", "u-boot version": "U-Boot SPL 2016.07 fbtp-1b2be3235 (Sep 19 2018 - 16:33:13), U-Boot 2016.07 fbtp-1b2be3235 (Sep 19 2018 - 16:33:17 -0700)", "CPU Usage": "CPU:   8% usr  25% sys   0% nic  66% idle   0% io   0% irq   0% sirq", "Memory Usage": "Mem: 118264K used, 317464K free, 1432K shrd, 0K buff, 68172K cached", "load-15": "0.37", "Reset Reason": "User Initiated Reset or WDT Reset", "vboot": {"cert_fallback_time": "Sat Jun 17 13:17:06 2017", "cert_time": "Sat Jun 17 13:17:06 2017", "force_recovery": "0x00", "recovery_boot": "0x00", "hardware_enforce": "0x00", "status_text": "OpenBMC was verified correctly", "software_enforce": "0x01", "status_crc": "0x7dc2", "uboot_fallback_time": "Wed Sep 19 16:04:12 2018", "tpm_status": "0", "recovery_retried": "0x00", "uboot_time": "Wed Sep 19 16:48:06 2018", "status": "0.0"}, "TPM TCG version": "1.2"}, "Actions": ["reboot"], "Resources": []}

Note (Filtered from the mess):
"load-1": "2.23",
"load-5": "0.97",
"load-15": "0.37"
"open-fds": "721"
Before change CIT output for fbtp:
python ./CLI.py ./fbtp.json <BMC Hostname> <Server Hostname>
Read fan for fbtp platform [PASSED]
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled/mb | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled/mezz | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/bmc | python -m json.tool
Rest-api test [PASSED]

After change CIT output for fbtp:
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled/mb | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/sled/mezz | python -m json.tool
Executing cmd=curl -g http://rtptest57216-oob.frc2:8080/api/bmc | python -m json.tool
Rest-api test [PASSED]

Reviewed By: vineelasmile, benwei13

fbshipit-source-id: 8b8fcba34
facebook-github-bot pushed a commit that referenced this issue Sep 28, 2018
Summary:
Move rest-api-v2 to use node_bmc.py in hopes of
unifying the functionality while we work on migration
which is expected to be a slower process.

Test Plan:
Flash image on CMM
root@fsw001-mm001-oob:/usr/local/bin# curl http://localhost:8080/api/sys/bmc
{"Actions": [], "Information": {"kernel version": "4.17.2-635177a5c64fa51c04f317d61c9a642205c05750 #1 Thu Sep 27 12:04:34 PDT 2018", "SPI0 Vendor": "Unknown", "At-Scale-Debug Running": false, "open-fds": "330", "TPM TCG version": "NA", "load-1": "0.33", "load-5": "0.40", "vboot": {"status": "-1", "status_text": "Unsupported"}, "CPU Usage": "CPU:   0% usr  16% sys   0% nic  83% idle   0% io   0% irq   0% sirq", "Description": "cmm BMC", "OpenBMC Version": "", "Reset Reason": "User Initiated Reset or WDT Reset", "SPI1 Vendor": "Unknown", "MAC Addr": "00:E0:EC:45:AF:29", "u-boot version": "U-Boot 2016.07 cmm-222b61a77 (Sep 27 2018 - 12:04:21 -0700)", "TPM FW version": "NA", "load-15": "0.43", "Memory Usage": "Mem: 107344K used, 780076K free, 284K shrd, 0K buff, 59940K cached", "Uptime": "13:39:16 up  1:10,  load average: 0.32, 0.40, 0.43"}, "Resources": []}

CIT Test for BMC rest endpoint: Passed
Without change:
Rest-api test [FAILED]
Connection for fsw001-mm001-oob.p015.f01.prn3 v6 [PASSED]
Sensor Readings on cmm for keys: [<snip>] [FAILED]
With Change:
Rest-api test [FAILED]
Connection for fsw001-mm001-oob.p015.f01.prn3 v6 [PASSED]
Sensor Readings on cmm for keys: [<snip>] [FAILED]

EIther way, no failures observed with respect to testing the /api/sys/bmc endpoint.

Reviewed By: covracer

fbshipit-source-id: d183d22a4
facebook-github-bot pushed a commit that referenced this issue Sep 29, 2018
Summary:
Fix regression for rest-api-v1 where uptime in seconds
was removed. This change adds it back -- Also the feature
is new for rest-api-v2.

Test Plan:
Build and load on fbtp:
root@bmc-oob:~# curl http://localhost:8080/api/bmc
{"Information": {"load-5": "1.13", "Memory Usage": "Mem: 118256K used, 317472K free, 1468K shrd, 0K buff, 68208K cached", "load-15": "0.50", "SPI0 Vendor": "Winbond", "SPI1 Vendor": "Winbond", "At-Scale-Debug Running": true, "Uptime": "18:38:28 up 4 min,  load average: 1.57, 1.12, 0.50", "Reset Reason": "User Initiated Reset or WDT Reset", "open-fds": "719", "CPU Usage": "CPU:  15% usr  69% sys   0% nic  15% idle   0% io   0% irq   0% sirq", "TPM TCG version": "1.2", "TPM FW version": "133.33", "u-boot version": "U-Boot SPL 2016.07 fbtp-d183d22a4 (Sep 28 2018 - 10:35:05), U-Boot 2016.07 fbtp-d183d22a4 (Sep 28 2018 - 10:35:13 -0700)", "OpenBMC Version": "", "uptime": "272.83", "load-1": "1.58", "kernel version": "4.1.51 #1 Fri Sep 28 10:35:37 PDT 2018", "vboot": {"status_text": "OpenBMC was verified correctly", "tpm_status": "0", "uboot_time": "Fri Sep 28 10:37:54 2018", "uboot_fallback_time": "Wed Sep 26 11:11:05 2018", "recovery_retried": "0x00", "software_enforce": "0x01", "recovery_boot": "0x00", "status": "0.0", "status_crc": "0x2f52", "cert_fallback_time": "Sat Jun 17 13:17:06 2017", "hardware_enforce": "0x00", "cert_time": "Sat Jun 17 13:17:06 2017", "force_recovery": "0x00"}, "Description": "fbtp BMC", "MAC Addr": "EC:0D:9A:65:D1:22"}, "Actions": ["reboot"], "Resources": []}

Note:
"uptime": "272.83"

Reviewed By: covracer

fbshipit-source-id: ec666451e
facebook-github-bot pushed a commit that referenced this issue Oct 12, 2018
Summary:
"wdtcli" is the command line interface to control the watchdog timer,
and it's intended to be used by fscd, watchdog_ctrl.sh and testing
purposes.
Applications who consume "wdtcli" won't be impacted by kernel upgrade,
because "wdtcli" will pick up the right watchdog library when kernel is
upgraded.

Test Plan:
root@bmc-oob:~# uname -a
Linux bmc-oob 4.17.2 #1 Sun Oct 7 22:00:10 PDT 2018 armv6l GNU/Linux
root@bmc-oob:~# wdtcli -h
Usage: wdtcli [-lvh] <command>
    -l  list available commands
    -v  enable verbose logging
    -h  print this help message
root@bmc-oob:~# wdtcli -l
Supported commands:
start  - start watchdog
stop   - stop watchdog
kick   - kick watchdog
root@bmc-oob:~# wdtcli -v kick
open watchdog: failed
root@bmc-oob:~# ps | grep fand
 1358 root      2128 S    /usr/local/bin/fand -v
 5351 root      2960 S    grep fand
root@bmc-oob:~# kill 1358
root@bmc-oob:~# wdtcli -v kick
open watchdog: passed
kick watchdog: passed
close watchdog: passed

Reviewed By: amithash

fbshipit-source-id: 942c2d912
facebook-github-bot pushed a commit that referenced this issue Nov 10, 2018
Summary: [Minipack] Implement reset_cp2112.sh command for Minipack

Test Plan: Tested with MPK17 Minipack #1

Reviewed By: covracer

fbshipit-source-id: 16424894f
facebook-github-bot pushed a commit that referenced this issue Nov 12, 2018
Summary:
CIT caught a test failure for restapi endpoint.
History of test:
https://fburl.com/tests/6zv4t4lo

Last night's run:
https://fburl.com/scuba/j57guxte

[vineelak@devbig609 ~]$ curl -g http://[2401:db00:116:3004::64]:8080/api/sys/bmc | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   141  100   141    0     0     68      0  0:00:02  0:00:02 --:--:--    68
No JSON object could be decoded

Test Plan:
[vineelak@devbig609 files{wedge100_restapi}]$ curl -g http://[2401:db00:116:3004::64]:8080/api/sys/bmc | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   858  100   858    0     0    346      0  0:00:02  0:00:02 --:--:--   346
{
    "Actions": [],
    "Information": {
        "At-Scale-Debug Running": false,
        "CPU Usage": "CPU:   8% usr  16% sys   0% nic  75% idle   0% io   0% irq   0% sirq",
        "Description": "wedge100 BMC",
        "MAC Addr": "8C:EA:1B:4E:36:30",
        "Memory Usage": "Mem: 137204K used, 109696K free, 6932K shrd, 0K buff, 72060K cached",
        "OpenBMC Version": "",
        "Reset Reason": "User Initiated Reset or WDT Reset",
        "SPI0 Vendor": "Macronix",
        "SPI1 Vendor": "Unknown",
        "TPM FW version": "NA",
        "TPM TCG version": "NA",
        "Uptime": "10:38:04 up 18:12,  load average: 1.32, 1.18, 1.11",
        "kernel version": "4.1.51 #1 Thu Nov 8 05:21:09 PST 2018",
        "load-1": "1.33",
        "load-15": "1.12",
        "load-5": "1.19",
        "open-fds": "576",
        "u-boot version": "U-Boot 2016.07 wedge100-d43377520 (Nov 08 2018 - 05:20:52 -0800)",
        "uptime": "65555.65",
        "vboot": {
            "status": "-1",
            "status_text": "Unsupported"
        }
    },
    "Resources": []
}

Reviewed By: tfangit

fbshipit-source-id: 1140fd622
facebook-github-bot pushed a commit that referenced this issue Jan 17, 2019
…122)

Summary:
1. If read block data length is large than 32, it will cause kernel panic
2. Using read word data to get block data length and first PSU model character to identify PSU model name
Pull Request resolved: facebookexternal/openbmc.accton#122

Test Plan:
Oringinal:
```
root@bmc-oob:~# sensors psu_driver-i2c-49-59
psu_driver-i2c-49-59
Adapter: i2c-24-mux (chan_id 1)
pgd = b8310000
[fffffffe] *pgd=beffd821, *pte=00000000, *ppte=00000000
Internal error: Oops: 80000007 [#7] ARM
Modules linked in: usb_f_acm u_serial usb_f_ecm g_cdc u_ether libcomposite configfs pmbus at24 adm1275 pmbus_core tmp421 lm75 powr1220 tpm_i2c_infineon tpm smbcpld(O) scmcpld(O) psu_driver(O) pdbcpld(O) max34461(O) isl68127(O) ir3595(O) iobfpga(O) fcmcpld(O) domfpga(O) i2c_dev_sysfs(O) at25 spidev i2c_mux_pca954x i2c_mux
CPU: 0 PID: 24910 Comm: sensors Tainted: G      D    O    4.1.51 #1
Hardware name: AST-G5
BMC call trace: CPU: 0 PID: 24910 Comm: sensors Tainted: G      D    O    4.1.51 #1. Hardware name: AST-G5
\task: bd615880 ti: b82cc000 task.ti: b82cc000
PC is at 0xfffffffe
LR is at i2c_transfer+0x78/0x90
pc : [<fffffffe>]    lr : [<802520d4>]    psr: 60000133
sp : b82cddf8  ip : 804f5390  fp : ffffffff
r10: ffffffff  r9 : ffffffff  r8 : ffffffff
r7 : ffffffff  r6 : ffffffff  r5 : ffffffff  r4 : ffffffff
r3 : 00000100  r2 : 00000100  r1 : 000000ff  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment user
Control: 00c5387d  Table: b8310008  DAC: 00000015
Process sensors (pid: 24910, stack limit = 0xb82cc188)
Stack: (0xb82cddf8 to 0xb82ce000)
dde0:                                                       ffffffff ffffffff
de00: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
de20: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
de40: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
de60: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
de80: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
dea0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
dec0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
dee0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
df00: ffffffff ffffffff ffffffff 0000ffff 00001000 00000000 00000000 00000000
df20: 5c0f7886 24f47300 5c0f7886 24f47300 5c0f7886 24f47300 00000000 bd61ed20
df40: b82cdf88 00001000 00025008 00025008 bd61ed20 b82cdf88 00001000 8009d980
df60: bd61ed20 00025008 00001000 bd61ed20 bd61ed20 00025008 00001000 80017288
df80: b82cc000 8009e14c 00000000 00000000 00001000 00033e68 42e69366 00000066
dfa0: 00000003 800170c0 00033e68 42e69366 00000003 00025008 00001000 00000000
dfc0: 00033e68 42e69366 00000066 00000003 42e69367 00000000 42e5b020 7ee9682c
dfe0: 00000000 7ee961fc 42d89398 42ddfebc 60000010 00000003 00000000 00000000
[<802520d4>] (i2c_transfer) from [<ffffffff>] (0xffffffff)
Code: bad PC value
---[ end trace f6ee13fc1b0ed586 ]---
```

After modification:
```
root@bmc-oob:~# sensors psu_driver-i2c-49-59
psu_driver-i2c-49-59
Adapter: i2c-24-mux (chan_id 1)
PSU1 Input Voltage:              N/A
PSU1 12V Output Voltage:         N/A
PSU1 5/3.3V Output Voltage:      N/A
PSU1 FAN:                        N/A
PSU1 Temp1:                      N/A
PSU1 Temp2:                      N/A
PSU1 Temp3:                      N/A
PSU1 Input Power:                N/A
PSU1 12V Output Power:           N/A
PSU1 5/3.3V Output Power:        N/A
PSU1 Input Current:              N/A
PSU1 12V Output Current:         N/A
PSU1 5/3.3V Output Current:      N/A
```

Test on Minipack:pass

Reviewed By: tomrepo

fbshipit-source-id: 982e0b69a
facebook-github-bot pushed a commit that referenced this issue Apr 5, 2019
Summary:
Update the sequence of "setup-dhc6.sh" from 2 to 3 (runlevel 5) so fixup
scripts (such as "eth0_mac_fixup.sh") can be placed at sequence 2 for
yamp, which needs to be executed after "networking start" (sequence #1)
but before "setup-dhc6.sh" (sequence #3).

Test Plan:
1) "bitbake yamp-image" succeeded.
2) rebooted yamp-4.18 for 3 times and verified ipv6 link-local address
   is always derived from the correct MAC.
3) tested the patch on cmm: no issue found.

Reviewed By: mikechoifb

fbshipit-source-id: 0d05e26196
facebook-github-bot pushed a commit that referenced this issue Jul 16, 2019
Summary:
as title, keep a copy of dump in RAM so after lumberjack
uploads crashdump file (and delete it from /mnt/data), we still have
a RAM copy for debug purpose.
2. add fw-util version to crashdump, in the case of ME not returning
correct version, its version can still be inferred from BIOS version

Test Plan:
verified on Yv2
* Check dumpfile is copied to /tmp
```
root@sled3104gt-oob:/mnt/data# autodump.sh slot1
Auto Dump will start after 30s...
Auto Dump for slot1 Started
Auto Dump for slot1 Completed
Auto Dump Stored in /mnt/data/crashdump_slot1.tar.gz

root@sled3104gt-oob:/mnt/data# ls -l /tmp/
-rw-r--r--    1 root     root             2 Jul  3 05:49 ast_por
drwxr-xr-x    2 root     root          5580 Jul 12 16:04 cache_store
-rw-r--r--    1 root     root          5321 Jul 12 16:04 crashdump_slot1.tar.gz
drwxr-xr-x    2 root     root            40 Jul  3 05:50 fanfail_record
```
* Check dumpfile contains FW versions
```
root@sled3104gt-oob:/tmp# head crashdump_slot1
Crash Dump generated at Fri Jul 12 16:13:41 PDT 2019
U-Boot SPL 2016.07 fby2-v2019.18.0 (May 01 2019 - 23:37:40)
U-Boot 2016.07 fby2-v2019.18.0 (May 01 2019 - 23:37:56 +0000)
Linux sled3104gt-oob.23.prn2.facebook.com 4.1.51 #1 Wed May 1 23:35:47 UTC 2019 armv6l GNU/Linux
OpenBMC Release fby2-v2019.18.0

Get firmware version info:
Bridge-IC Version: v1.19
Bridge-IC Bootloader Version: v2.02
BIOS Version: F09_3A12
```

Reviewed By: zhdaniel12

fbshipit-source-id: 8f99077b85
facebook-github-bot pushed a commit that referenced this issue Aug 20, 2019
Summary: Ignore voltage/current/power data of all the pages except page 0 (V1).

Test Plan:
root@bmc-oob:~# uname -a
Linux bmc-oob. 5.0.3-cmm #1 Thu Aug 15 00:21:53 UTC 2019 armv6l GNU/Linux
root@bmc-oob:~# sensors pfe3000-i2c-27-10
pfe3000-i2c-27-10
Adapter: i2c-2-mux (chan_id 3)
vin:         +118.50 V  (crit min = +80.00 V, max = +300.00 V)
                       (crit max = +305.00 V)
vcap:        +430.00 V
vout1:       +12.39 V
fan1:        7200 RPM
fan2:        6816 RPM
temp1:        +19.2 C
temp2:        +39.8 C
temp3:        +37.5 C
pin:         698.00 W
pout1:       656.00 W
iin:          +5.90 A  (max = +16.00 A)
iout1:       +53.00 A  (max = +256.00 A)

Reviewed By: benwei13

fbshipit-source-id: 68c3526d6b
facebook-github-bot pushed a commit that referenced this issue Sep 16, 2019
Summary:
All the lines in bic.c were reviewed and following issues are fixed
by the patch:

1) fixed coding style issues.
2) remove redundant code, unused variables, and etc.
3) validating input arguments to avoid NULL pointer reference.
4) Add logic to minimize potential buffer overflow

Test Plan:
Booted up minipack-4.1 and verified:
  - gpiod is running properly.
  - ipmbd is running properly.
  - ran a few bic-util commands: no issues found.

Reviewed By: zhdaniel12

fbshipit-source-id: cc58719b99
facebook-github-bot pushed a commit that referenced this issue Apr 8, 2020
Summary: Remove code duplication by using common rest api endpoint

Test Plan:
BMC Rest API still works for network platforms:
```
root@wedge-oob:~# curl http://localhost:8080/api/sys/bmc
{"Resources": [], "Actions": [], "Information": {"vboot": {"status": "-1", "status_text": "Unsupported"}, "CPU Usage": "CPU:   0% usr  10% sys   0% nic  80% idle   0% io   0% irq  10% sirq", "uptime": "7265298.09", "Reset Reason": "Power ON Reset", "OpenBMC Version": "2019.23.0", "SPI1 Vendor": "Unknown", "open-fds": "523", "MAC Addr": "B8:6A:97:82:2C:3B", "load-1": "1.36", "TPM TCG version": "1.2", "load-5": "1.07", "Memory Usage": "Mem: 181080K used, 65820K free, 22040K shrd, 0K buff, 123964K cached", "u-boot version": "U-Boot 2016.07 wedge100-v2019.23.0 (Jun 10 2019 - 08:04:28 +0000)", "Description": "wedge100 BMC", "Uptime": "06:13:25 up 84 days,  2:08,  load average: 1.36, 1.06, 0.77", "At-Scale-Debug Running": false, "TPM FW version": "133.33", "load-15": "0.78", "SPI0 Vendor": "Macronix", "kernel version": "4.1.51 #1 Sun Jun 9 09:04:31 UTC 2019"}}
````
BMC Rest API still works for compute platforms
```
root@compute-oob:~# curl http://localhost:8080/api/spb/bmc
{"Information": {"SPI1 Vendor": "Winbond", "load-5": "3.68", "Uptime": "06:24:36 up  3:49,  load average: 3.37, 3.67, 3.65", "load-1": "3.37", "Description": "FBY2 BMC", "open-fds": "937", "MAC Addr": "98:03:9B:A4:D6:3F", "kernel version": "4.1.51 #1 Wed Nov 6 21:29:58 UTC 2019", "uptime": "13743.84", "Memory Usage": "Mem: 184332K used, 251396K free, 10600K shrd, 0K buff, 131932K cached", "vboot": {"tpm_status": "0", "software_enforce": "0x01", "status_crc": "0x68e5", "uboot_fallback_time": "Tue Sep 24 22:41:49 2019", "force_recovery": "0x00", "cert_time": "Sat Jun 17 13:17:06 2017", "status_text": "OpenBMC was verified correctly", "status": "0.0", "uboot_time": "Wed Nov  6 15:52:34 2019", "recovery_retried": "0x00", "recovery_boot": "0x00", "hardware_enforce": "0x01", "cert_fallback_time": "Sat Jun 17 13:17:06 2017"}, "u-boot version": "U-Boot SPL 2016.07 fby2-v4.6 (Oct 16 2018 - 15:07:23), U-Boot 2016.07 fby2-v4.6 (Oct 16 2018 - 15:07:32 -0700)", "load-15": "3.65", "TPM TCG version": "1.2", "At-Scale-Debug Running": false, "Reset Reason": "User Initiated Reset or WDT Reset", "TPM FW version": "133.33", "CPU Usage": "CPU:  53% usr  46% sys   0% nic   0% idle   0% io   0% irq   0% sirq", "SPI0 Vendor": "Winbond", "OpenBMC Version": "2019.32.2"}, "Actions": ["reboot"], "Resources": []}
```

Reviewed By: williamspatrick

fbshipit-source-id: dca1aad827
facebook-github-bot pushed a commit that referenced this issue Jun 5, 2020
Summary:
We've seen several instances of jffs2 corruption on minipack and cmm
BMCs, which might be caused by kernel upgrade (jffs2 is not compatible
across different kernel versions), or by a certain file operation
pattern which triggers jffs2 bugs.

The patch aims at improving jffs2 reliability by running a few jffs2
health check at mount time and re-formatting/recovering the partition
if critical failures are detected.

Test Plan:
1) manually corrupted /mnt/data/etc on CMM:

data0 partition found on /dev/mtdblock3; mounting to /mnt/data.
Checking JFFS2 filesystem health on /dev/mtdblock3..
JFFS2 health check error: /mnt/data/etc corrupted (not a directory)!
Unmounting /dev/mtdblock3 and starting JFFS2 recovery..
Erasing and creating JFFS2 filesystem on /dev/mtd3..
Re-mounting /dev/mtdblock3 to /mnt/data..

2) rebooted CMM (after jffs2 was recovered in step #1):

data0 partition found on /dev/mtdblock3; mounting to /mnt/data.
Checking JFFS2 filesystem health on /dev/mtdblock3..

Reviewed By: zhdaniel12

fbshipit-source-id: 22b4c9a67b
facebook-github-bot pushed a commit that referenced this issue Jul 15, 2020
Summary:
Enable JTAG_ASPEED_LEGACY_UIO option because "xapp" needs the legacy
jtag interfaces.

Test Plan:
root@fboss200932661-oob:~# uname -a
Linux fboss200932661-oob.snc1.facebook.com.tfbnw.net 5.6.14-yamp #1 Wed
Jul 15 06:43:23 UTC 2020 armv6l GNU/Linux
root@fboss200932661-oob:~# fpga_util.sh lc1 program /tmp/sperry.axsvf
XSVF Player v5.01, Xilinx, Inc.
CPLDUPATE DLL name = /usr/lib/libcpldupdate_dll_ast_jtag.so
XSVF file = /tmp/sperry.axsvf

xsvf file progress: 0%

xsvf file progress: 10%

xsvf file progress: 20%

xsvf file progress: 30%

xsvf file progress: 40%

xsvf file progress: 50%

xsvf file progress: 60%

xsvf file progress: 70%

xsvf file progress: 80%

xsvf file progress: 90%
SUCCESS - Completed XSVF execution.
Execution time: 360 seconds
Jtag ops: tck 116895874, tms 765254, tdi 5028138, tdo 5003862
Clock pulses 52781398, total jtag ops 127693128
Jtag operations: 354703 / sec

Reviewed By: zhdaniel12

fbshipit-source-id: 86413118f6
facebook-github-bot pushed a commit that referenced this issue Aug 11, 2020
Summary:
- Change shell to `/bin/bash` (it was already using features not present in POSIX `sh`)
- Use `[[ ]]` everywhere
- Make it actually fail (exit with code != 0) if any command fails (previously script never failed)
- Make it more verbose so, in case of failure we know which command failed
- Other safety options set (fail on unassigned variables and in case a piped command fails)
- Implemented other recommendations by shellcheck
- Shorten some very long lines

Test Plan:
FANCPLD, no action (same usercode):
```
root@fboss96703260-oob:/tmp# ./cpld_upgrade.sh FAN_RACKMON_CPLD.jbc
+ set -e
+ set -u
+ set -o pipefail
+ '[' 1 -lt 1 ']'
+ jbcfile=FAN_RACKMON_CPLD.jbc
+ [[ ! -f FAN_RACKMON_CPLD.jbc ]]
++ basename FAN_RACKMON_CPLD.jbc
+ filename=FAN_RACKMON_CPLD.jbc
+ [[ .jbc != \.\j\b\c ]]
+ case $filename in
+ upgrade_fancpld FAN_RACKMON_CPLD.jbc
+ echo 'Started FANCPLD upgrade ..'
Started FANCPLD upgrade ..
+ echo out
+ echo 0
++ jbi -r -aREAD_USERCODE -gc77 -gi78 -go79 -gs76 FAN_RACKMON_CPLD.jbc
++ grep -i 'USERCODE code is'
++ awk '{ print $6 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ sys_usercode=0057EA7E
++ jbi -i FAN_RACKMON_CPLD.jbc
++ grep -i '"USERCODE"'
++ awk -F '"' '{ print $4 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ new_usercode=0057EA7E
+ [[ 0057EA7E != \0\0\5\7\E\A\7\E ]]
+ echo 'Finished FANCPLD upgrade: No Action (Same usercode)'
Finished FANCPLD upgrade: No Action (Same usercode)
```

SYSCPLD, no action (same usercode):
```
root@fboss96703260-oob:/tmp# ./cpld_upgrade.sh WEDGE100_SYSCPLD.jbc
+ set -e
+ set -u
+ set -o pipefail
+ '[' 1 -lt 1 ']'
+ jbcfile=WEDGE100_SYSCPLD.jbc
+ [[ ! -f WEDGE100_SYSCPLD.jbc ]]
++ basename WEDGE100_SYSCPLD.jbc
+ filename=WEDGE100_SYSCPLD.jbc
+ [[ .jbc != \.\j\b\c ]]
+ case $filename in
+ upgrade_syscpld WEDGE100_SYSCPLD.jbc
+ echo 'Started SYSCPLD upgrade ..'
Started SYSCPLD upgrade ..
+ echo out
+ echo 1
++ jbi -r -aREAD_USERCODE -gc102 -gi101 -go103 -gs100 WEDGE100_SYSCPLD.jbc
++ grep -i 'USERCODE code is'
++ awk '{ print $6 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ sys_usercode=00906A77
++ jbi -i WEDGE100_SYSCPLD.jbc
++ grep -i '"USERCODE"'
++ awk -F '"' '{ print $4 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ new_usercode=00906A77
+ [[ 00906A77 != \0\0\9\0\6\A\7\7 ]]
+ echo 'Finished SYSCPLD upgrade: No Action (Same usercode)'
Finished SYSCPLD upgrade: No Action (Same usercode)
```

SYSCPLD, forced upgrade (replaced condition with `if true`):
```
root@fboss96703260-oob:/tmp# ./cpld_upgrade.sh WEDGE100_SYSCPLD.jbc
+ set -e
+ set -u
+ set -o pipefail
+ '[' 1 -lt 1 ']'
+ jbcfile=WEDGE100_SYSCPLD.jbc
+ [[ ! -f WEDGE100_SYSCPLD.jbc ]]
++ basename WEDGE100_SYSCPLD.jbc
+ filename=WEDGE100_SYSCPLD.jbc
+ [[ .jbc != \.\j\b\c ]]
+ case $filename in
+ upgrade_syscpld WEDGE100_SYSCPLD.jbc
+ echo 'Started SYSCPLD upgrade ..'
Started SYSCPLD upgrade ..
+ echo out
+ echo 1
++ jbi -r -aREAD_USERCODE -gc102 -gi101 -go103 -gs100 WEDGE100_SYSCPLD.jbc
++ grep -i 'USERCODE code is'
++ awk '{ print $6 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ sys_usercode=00906A77
++ jbi -i WEDGE100_SYSCPLD.jbc
++ grep -i '"USERCODE"'
++ awk -F '"' '{ print $4 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ new_usercode=00906A77
+ true
+ i2cset -f -y 12 0x31 0x2e 0x18
+ jbi -r -aPROGRAM -gc102 -gi101 -go103 -gs100 WEDGE100_SYSCPLD.jbc
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

Device #1 Silicon ID is ALTERA10(06)
erasing MAXII device(s)...
erasing MAXII UFM block...
erasing MAXII CFM block...
programming CFM block...
programming UFM block...
verifying CFM block...
verifying UFM block...
DONE
Exit code = 0... Success
+ echo 'Finished SYSCPLD upgrade: Pass'
Finished SYSCPLD upgrade: Pass
```

FANCPLD, forced upgrade (replaced condition with `if true`):
```
root@fboss96703260-oob:/tmp# ./cpld_upgrade.sh FAN_RACKMON_CPLD.jbc
+ set -e
+ set -u
+ set -o pipefail
+ '[' 1 -lt 1 ']'
+ jbcfile=FAN_RACKMON_CPLD.jbc
+ [[ ! -f FAN_RACKMON_CPLD.jbc ]]
++ basename FAN_RACKMON_CPLD.jbc
+ filename=FAN_RACKMON_CPLD.jbc
+ [[ .jbc != \.\j\b\c ]]
+ case $filename in
+ upgrade_fancpld FAN_RACKMON_CPLD.jbc
+ echo 'Started FANCPLD upgrade ..'
Started FANCPLD upgrade ..
+ echo out
+ echo 0
++ jbi -r -aREAD_USERCODE -gc77 -gi78 -go79 -gs76 FAN_RACKMON_CPLD.jbc
++ grep -i 'USERCODE code is'
++ awk '{ print $6 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ sys_usercode=0057EA7E
++ jbi -i FAN_RACKMON_CPLD.jbc
++ grep -i '"USERCODE"'
++ awk -F '"' '{ print $4 }'
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

+ new_usercode=0057EA7E
+ true
+ jbi -aPROGRAM -gc77 -gi78 -go79 -gs76 FAN_RACKMON_CPLD.jbc
Jam STAPL ByteCode Player Version 2.2
Copyright (C) 1998-2001 Altera Corporation

Device #1 Silicon ID is ALTERA10(05)
erasing MAXII device(s)...
erasing MAXII UFM block...
erasing MAXII CFM block...
programming CFM block...
programming UFM block...
verifying CFM block...
verifying UFM block...
DONE
Exit code = 0... Success
+ echo 'Finished FANCPLD upgrade: Pass'
Finished FANCPLD upgrade: Pass
```

Reviewed By: mikechoifb

fbshipit-source-id: cea53ec0f9
facebook-github-bot pushed a commit that referenced this issue Aug 11, 2020
Summary:
UART/RS485 emulation is handled by patch "kernel rs485 drain/switch hack"
in kernel v4.1, and the hack can be replaced with 2 "serial_rs485" flags
in the latest kernel.

As the 2 flags (SER_RS485_RTS_AFTER_SEND and SER_RS485_RX_DURING_TX) are
"ignored" in kernel 4.1, let's set these flags blindly for all kernel
versions.

Test Plan:
1) "rackmonstatus" in kernel 5.6.19:
root@rsw1aa-oob:~# uname -a
Linux rsw1aa-oob.01.ftw1.facebook.com 5.6.19-wedge #1 Mon Aug 10
17:30:13 UTC 2020 armv5tejl GNU/Linux
root@rsw1aa-oob:~# rackmonstatus
Monitored PSUs:
PSU addr a0 - crc errors: 0, timeouts: 0
PSU addr a1 - crc errors: 0, timeouts: 0
PSU addr a2 - crc errors: 0, timeouts: 0
PSU addr a4 - crc errors: 0, timeouts: 0
PSU addr a5 - crc errors: 0, timeouts: 0
PSU addr a6 - crc errors: 0, timeouts: 0
Active on last scan: a0 a1 a2 a4 a5 a6
Next scan in 34 seconds.

2) "rackmonstatus" in kernel 4.1.51:
root@rsw1aa-oob:~# uname -a
Linux rsw1aa-oob.01.ftw1.facebook.com 4.1.51 #1 Mon Aug 10 22:19:45 UTC
2020 armv5tejl GNU/Linux
root@rsw1aa-oob:~# rackmonstatus
Monitored PSUs:
PSU addr a1 - crc errors: 0, timeouts: 0
PSU addr a2 - crc errors: 0, timeouts: 0
PSU addr a4 - crc errors: 0, timeouts: 0
PSU addr a5 - crc errors: 0, timeouts: 0
PSU addr a6 - crc errors: 0, timeouts: 0
Active on last scan: a1 a2 a4 a5 a6
Next scan in 91 seconds.

Reviewed By: benwei13

fbshipit-source-id: 159d946932
facebook-github-bot pushed a commit that referenced this issue Aug 27, 2020
Summary: Upgrade yocto from warrior to zeus

Test Plan:
Build and test on AST2600-A1 EVB.
```
U-Boot 2019.04 grandcanyon-d4dccc65d15-dirty (Aug 26 2020 - 21:05:23 +0000)

SOC: AST2600-A1
RST: Power On
eSPI Mode: SIO:Enable : SuperIO-2e
Eth: MAC0: RGMII, MAC1: RGMII, MAC2: RGMII, MAC3: RGMII
Model: Aspeed BMC
DRAM:  1008 MiB
MMC:   emmc_slot0@100: 0
Loading Environment from SPI Flash... SF: Detected w25q512jv with page size 256 Bytes, erase size 4 KiB, total 64 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Aspeed BMC
Net:
Warning: ftgmac@1e680000 (eth1) using random MAC address - 8e:3d:3d:e1:c8:3b
eth1: ftgmac@1e680000
Hit any key to stop autoboot:  0
## Loading kernel from FIT Image at 20100000 ...

...

root@bmc-oob:~# strings /dev/mtd0 | grep 'U-Boot 20'; uname -a; cat /etc/issue
U-Boot 2019.04 grandcanyon-d4dccc65d15-dirty (Aug 26 2020 - 21:05:23 +0000)
Linux bmc-oob. 5.6.19-grandcanyon #1 SMP Wed Aug 26 21:01:35 UTC 2020 armv7l GNU/Linux
OpenBMC Release grandcanyon-d4dccc65d15-dirty

```

Reviewed By: williamspatrick

fbshipit-source-id: 9507711e79
facebook-github-bot pushed a commit that referenced this issue Mar 4, 2021
Summary:
Recently during Minipack push it was observed that mtd parts were not exposed from BMC. We dont have a root cause yet about the problem. (T76706702)
That being said, we dont have a good mechanism to detect for such a condition as well and if it was a trend atall. Mostly as per h5h output (in task) it is limited to minipack.
This diff adds REST endpoint to expose /prc/mtd parts. Stacked diff adds CIT test for the endpoint.
Next step:
- Adding ODS dimension key for presence of these mtd parts.
- Swagger definitions

Test Plan:
Curl:
```
[vineelak@devbig609 ~]$ curl http://fboss308930393-oob.snc1:8080/api/sys/bmc | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1024  100  1024    0     0    768      0  0:00:01  0:00:01 --:--:--   768
{
    "Actions": [],
    "Information": {
        "At-Scale-Debug Running": false,
        "CPU Usage": "CPU:   7% usr  21% sys   0% nic  71% idle   0% io   0% irq   0% sirq",
        "Description": "minipack BMC",
        "MAC Addr": "68:21:5F:6F:BA:2B",
        "MTD Parts": [
            "u-boot",
            "env",
            "fit",
            "data0",
            "flash0",
            "flash1"
        ],
        "Memory Usage": "Mem: 271656K used, 612256K free, 14864K shrd, 41688K buff, 130004K cached",
        "OpenBMC Version": "",
        "Reset Reason": "User Initiated Reset or WDT Reset",
        "SPI0 Vendor": "Unknown",
        "SPI1 Vendor": "Unknown",
        "TPM FW version": "133.33",
        "TPM TCG version": "1.2",
        "Uptime": "09:33:33 up 1 day, 10:25,  load average: 2.39, 2.12, 2.09",
        "kernel version": "5.10.5-minipack #1 Thu Feb 25 09:15:12 UTC 2021",
        "load-1": "2.40",
        "load-15": "2.10",
        "load-5": "2.12",
        "memory": {
            "Buffers": 41688,
            "Cached": 130004,
            "MemAvailable": 656428,
            "MemFree": 612272,
            "MemTotal": 883912,
            "Shmem": 14864
        },
        "open-fds": "846",
        "u-boot version": "2019.04",
        "uptime": "123906.75",
        "vboot": {
            "status": "-1",
            "status_text": "Unsupported"
        }
    },
    "Resources": []
}

```

CIT Test result:
```
root@fboss308930393-oob:/usr/local/bin/tests2# python cit_runner.py --platform minipack --run-test tests.minipack.test_rest_endpoint.RestEndpointTest.test_endpoint_api_sys_mtd
test_endpoint_api_sys_mtd (tests.minipack.test_rest_endpoint.RestEndpointTest) ... ok

----------------------------------------------------------------------
Ran 1 test in 1.633s

OK
```

Reviewed By: kawmarco

fbshipit-source-id: 1f9d59f63b
facebook-github-bot pushed a commit that referenced this issue Apr 9, 2021
Summary: Add boot source to REST endpoint /api/sys/bmc to indicate current boot code source, e.g. primary, or not

Test Plan:
1- Boot cloudripper(AST2600), wedge400c(AST2500) and wedge100(AST2400) from primary or secondary flash
2- Run the curl command similar to the following:

```
[binhuang@devbig033.frc2 ~/local/openbmc/common] curl -s http://cloudripper-oob.08.06.mpk17:8080/api/sys/bmc |jq
{
  "Information": {
    "Description": "cloudripper BMC",
    "MAC Addr": "0C:48:C6:74:CC:AA",
    "Reset Reason": "User Initiated Reset or WDT Reset",
    "Uptime": "20:55:56 up 2 min,  load average: 0.43, 0.42, 0.17",
    "uptime": "158.17",
    "Memory Usage": "Mem: 139764K used, 1928220K free, 2964K shrd, 1244K buff, 83548K cached",
    "memory": {
      "MemTotal": 2067984,
      "MemFree": 1928288,
      "MemAvailable": 1903380,
      "Buffers": 1244,
      "Cached": 83548,
      "Shmem": 2964
    },
    "CPU Usage": "CPU:   4% usr   4% sys   0% nic  90% idle   0% io   0% irq   0% sirq",
    "OpenBMC Version": "",
    "u-boot version": "NA",
    "kernel version": "5.6.19-cloudripper #1 SMP Tue Apr 6 00:57:38 UTC 2021",
    "TPM TCG version": "2.0",
    "TPM FW version": "7.85",
    "SPI0 Vendor": "Unknown",
    "SPI1 Vendor": "Unknown",
    "At-Scale-Debug Running": false,
    "Secondary Boot Triggered": false,
    "vboot": {
      "status": "-1",
      "status_text": "Unsupported"
    },
    "load-1": "0.43",
    "load-5": "0.42",
    "load-15": "0.18",
    "open-fds": "576",
    "MTD Parts": [
      "u-boot",
      "env",
      "meta",
      "fit",
      "data0",
      "flash0",
      "flash1"
    ]
  },
  "Actions": [],
  "Resources": []
}
```
3- Verify "Secondary Boot Triggered" should be "false" if boot from primary flash, and "true" if boot from secondary flash

Reviewed By: kawmarco

fbshipit-source-id: a98db96f0b
leilanon referenced this issue in delta-sw103/openbmc Apr 23, 2021
Summary: Add boot source to REST endpoint /api/sys/bmc to indicate current boot code source, e.g. primary, or not

Test Plan:
1- Boot cloudripper(AST2600), wedge400c(AST2500) and wedge100(AST2400) from primary or secondary flash
2- Run the curl command similar to the following:

```
[binhuang@devbig033.frc2 ~/local/openbmc/common] curl -s http://cloudripper-oob.08.06.mpk17:8080/api/sys/bmc |jq
{
  "Information": {
    "Description": "cloudripper BMC",
    "MAC Addr": "0C:48:C6:74:CC:AA",
    "Reset Reason": "User Initiated Reset or WDT Reset",
    "Uptime": "20:55:56 up 2 min,  load average: 0.43, 0.42, 0.17",
    "uptime": "158.17",
    "Memory Usage": "Mem: 139764K used, 1928220K free, 2964K shrd, 1244K buff, 83548K cached",
    "memory": {
      "MemTotal": 2067984,
      "MemFree": 1928288,
      "MemAvailable": 1903380,
      "Buffers": 1244,
      "Cached": 83548,
      "Shmem": 2964
    },
    "CPU Usage": "CPU:   4% usr   4% sys   0% nic  90% idle   0% io   0% irq   0% sirq",
    "OpenBMC Version": "",
    "u-boot version": "NA",
    "kernel version": "5.6.19-cloudripper #1 SMP Tue Apr 6 00:57:38 UTC 2021",
    "TPM TCG version": "2.0",
    "TPM FW version": "7.85",
    "SPI0 Vendor": "Unknown",
    "SPI1 Vendor": "Unknown",
    "At-Scale-Debug Running": false,
    "Secondary Boot Triggered": false,
    "vboot": {
      "status": "-1",
      "status_text": "Unsupported"
    },
    "load-1": "0.43",
    "load-5": "0.42",
    "load-15": "0.18",
    "open-fds": "576",
    "MTD Parts": [
      "u-boot",
      "env",
      "meta",
      "fit",
      "data0",
      "flash0",
      "flash1"
    ]
  },
  "Actions": [],
  "Resources": []
}
```
3- Verify "Secondary Boot Triggered" should be "false" if boot from primary flash, and "true" if boot from secondary flash

Reviewed By: kawmarco

fbshipit-source-id: a98db96f0b
facebook-github-bot pushed a commit that referenced this issue May 19, 2021
Summary:
PSU devices cannot be detected on fboss12719856-oob.snc1 because PSU bus
and address is not correct in the current psumuxmon.py.

Here is the correct PSU address mapping described in Wedge100 Hardware
Specification:
  - PSU1: connected to i2c-mux channel #2 (15-0059)
  - PSU2: connected to i2c-mux channel #1 (14-005a)

Test Plan:
1) log on fboss12719856-oob.snc1 without fix:
   - https://www.internalfb.com/phabricator/paste/view/P415749225
2) log on fboss12719856-oob.snc1 with the fix:
   - https://www.internalfb.com/phabricator/paste/view/P415749307
3) log on wedge100 with 2 AC PSUs:
   - https://www.internalfb.com/intern/paste/P415750974/

Reviewed By: joancaneus

fbshipit-source-id: cd48537cb6
zzzoie referenced this issue in delta-sw103/openbmc Jun 8, 2021
Summary:
PSU devices cannot be detected on fboss12719856-oob.snc1 because PSU bus
and address is not correct in the current psumuxmon.py.

Here is the correct PSU address mapping described in Wedge100 Hardware
Specification:
  - PSU1: connected to i2c-mux channel #2 (15-0059)
  - PSU2: connected to i2c-mux channel #1 (14-005a)

Test Plan:
1) log on fboss12719856-oob.snc1 without fix:
   - https://www.internalfb.com/phabricator/paste/view/P415749225
2) log on fboss12719856-oob.snc1 with the fix:
   - https://www.internalfb.com/phabricator/paste/view/P415749307
3) log on wedge100 with 2 AC PSUs:
   - https://www.internalfb.com/intern/paste/P415750974/

Reviewed By: joancaneus

fbshipit-source-id: cd48537cb6
facebook-github-bot pushed a commit that referenced this issue Jun 22, 2021
Summary:
Fall back to "at93cx6_util" for oob switch eeprom access so byte order is
consistent with the previous openbmc images. Check S235340 for details.

Test Plan:
Updated eeprom using "openbmc.wedge100.firmware:5" and power cycle the
chassis: lldp-util works after power cycle:

root@rsw1dk-oob:~# cat /etc/issue
OpenBMC Release wedge100-v2021.19.0

root@rsw1dk-oob:~# uname -a
Linux rsw1dk-oob.12.prn3.facebook.com 5.10.23-wedge100 #1 Sun May 9 07:16:07 UTC 2021 armv5tejl GNU/Linux
root@rsw1dk-oob:~# lldp-util
Listening for LLDP packets...
LLDP: local_port=eth0 remote_system=rsw1cp.99.prn3 remote_port=Ethernet48
LLDP: local_port=eth0 remote_system=rsw1dk.12.prn3.facebook.com remote_port=00:90:fb:5e:1e:61
LLDP: local_port=eth0 remote_system=rsw1cp.99.prn3 remote_port=Ethernet48
LLDP: local_port=eth0 remote_system=rsw1dk.12.prn3.facebook.com remote_port=00:90:fb:5e:1e:61

Reviewed By: benwei13

fbshipit-source-id: 0000b359a4
zzzoie referenced this issue in delta-sw103/openbmc Jun 22, 2021
Summary:
Fall back to "at93cx6_util" for oob switch eeprom access so byte order is
consistent with the previous openbmc images. Check S235340 for details.

Test Plan:
Updated eeprom using "openbmc.wedge100.firmware:5" and power cycle the
chassis: lldp-util works after power cycle:

root@rsw1dk-oob:~# cat /etc/issue
OpenBMC Release wedge100-v2021.19.0

root@rsw1dk-oob:~# uname -a
Linux rsw1dk-oob.12.prn3.facebook.com 5.10.23-wedge100 #1 Sun May 9 07:16:07 UTC 2021 armv5tejl GNU/Linux
root@rsw1dk-oob:~# lldp-util
Listening for LLDP packets...
LLDP: local_port=eth0 remote_system=rsw1cp.99.prn3 remote_port=Ethernet48
LLDP: local_port=eth0 remote_system=rsw1dk.12.prn3.facebook.com remote_port=00:90:fb:5e:1e:61
LLDP: local_port=eth0 remote_system=rsw1cp.99.prn3 remote_port=Ethernet48
LLDP: local_port=eth0 remote_system=rsw1dk.12.prn3.facebook.com remote_port=00:90:fb:5e:1e:61

Reviewed By: benwei13

fbshipit-source-id: 0000b359a4
facebook-github-bot pushed a commit that referenced this issue Jun 22, 2021
Summary:
gpio unexport was broken by D21607312 and it was fixed by D29276458.

Apply the workaround so backup bios can be accessed after accessing
eepprom; otherwise, spi-aspeed driver would complain the pins were
configured as GPIO (because unexport fails).

Test Plan:
root@rsw1yt-oob:~# cat /etc/issue
OpenBMC Release wedge100-v2021.19.0

root@rsw1yt-oob:~# uname -a
Linux rsw1yt-oob.06.prn3.facebook.com 5.10.23-wedge100 #1 Sun May 9 07:16:07 UTC 2021 armv5tejl GNU/Linux

root@rsw1yt-oob:/tmp# ./spi_util.sh read spi2 OOB_SWITCH_EEPROM eeprom.bin
disable spi1 (bios) connection..
unexporting gpio COM_SPI_SEL
enable spi2 (eeprom) connection..
exporting gpio (aspeed-gpio, GPIOE2), shadow=SWITCH_EEPROM1_WRT
exporting gpio (aspeed-gpio, GPIOI4), shadow=BMC_EEPROM1_SPI_SS
exporting gpio (aspeed-gpio, GPIOI5), shadow=BMC_EEPROM1_SPI_SCK
exporting gpio (aspeed-gpio, GPIOI6), shadow=BMC_EEPROM1_SPI_MOSI
exporting gpio (aspeed-gpio, GPIOI7), shadow=BMC_EEPROM1_SPI_MISO
running at93cx6_util_py3.py..
disable spi1 (bios) connection..
disable spi2 (eeprom) connection..
unexporting gpio BMC_EEPROM1_SPI_SS
unexporting gpio BMC_EEPROM1_SPI_SCK
unexporting gpio BMC_EEPROM1_SPI_MOSI
unexporting gpio BMC_EEPROM1_SPI_MISO
unexporting gpio SWITCH_EEPROM1_WRT
root@rsw1yt-oob:/tmp# ./spi_util.sh read spi1 BACKUP_BIOS bios.bin
disable spi2 (eeprom) connection..
enable spi1 (bios) connection..
exporting gpio (aspeed-gpio, GPIOO0), shadow=COM_SPI_SEL
flashrom v0.9.9-r1955 on Linux 5.10.23-wedge100 (armv5tejl)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... delay loop is unreliable, trying to continue OK.
Found Winbond flash chip "W25Q64.V" (8192 kB, SPI) on linux_spi.
Reading flash... done.
disable spi1 (bios) connection..
unexporting gpio COM_SPI_SEL
disable spi2 (eeprom) connection..
root@rsw1yt-oob:/tmp# ./spi_util.sh read spi2 OOB_SWITCH_EEPROM eeprom.bin
disable spi1 (bios) connection..
enable spi2 (eeprom) connection..
exporting gpio (aspeed-gpio, GPIOE2), shadow=SWITCH_EEPROM1_WRT
exporting gpio (aspeed-gpio, GPIOI4), shadow=BMC_EEPROM1_SPI_SS
exporting gpio (aspeed-gpio, GPIOI5), shadow=BMC_EEPROM1_SPI_SCK
exporting gpio (aspeed-gpio, GPIOI6), shadow=BMC_EEPROM1_SPI_MOSI
exporting gpio (aspeed-gpio, GPIOI7), shadow=BMC_EEPROM1_SPI_MISO
running at93cx6_util_py3.py..
disable spi1 (bios) connection..
disable spi2 (eeprom) connection..
unexporting gpio BMC_EEPROM1_SPI_SS
unexporting gpio BMC_EEPROM1_SPI_SCK
unexporting gpio BMC_EEPROM1_SPI_MOSI
unexporting gpio BMC_EEPROM1_SPI_MISO
unexporting gpio SWITCH_EEPROM1_WRT

Reviewed By: GoldenBug

fbshipit-source-id: 616a939462
facebook-github-bot pushed a commit that referenced this issue Jun 25, 2021
Summary: asincify compute specific routes batch 1

Test Plan:
## /api/fans
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/fans`
```
{"Information": ["Fan 0 Speed: 2893 RPM (24%)", "Fan 1 Speed: 2889 RPM (24%)", "Fan Mode: 0", "FSCD Driver:linear_inlet(spb:sp_inlet_temp)", "Sensor Fail: 0", "Fan Fail: 0", "Platform Specific: 0"], "Resources": [], "Actions": []}
22,478230 0,101860 0,788877
```

## /api/mezz
`] time curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/mezz`
```
{"Information": {"Description": "FBY2 Mezzanine Card"}, "Resources": ["fruid", "logs", "sensors"], "Actions": []}
9,826903 0,101882 1,080027
```

`] time curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/mezz/fruid`
```
{"Information": {"Board Mfg": "Mellanox", "Product Part Number": "MCX4431N-GCAN_FB", "Board FRU ID": "FRU Ver 0.01", "Board Serial": "MT1904K15906", "Product Custom Data 3": "ConnectX-4 Lx", "Product Serial": "MT1904K15906", "Board Part Number": "MCX4431N-GCAN_FB", "Product Custom Data 2": "DVT", "Board Product": "Mellanox-ConnectX-4 Lx", "Product Manufacturer": "Mellanox", "Board Mfg Date": "Mon Jan 28 20:02:00 2019", "Product Version": "A3", "Product Name": "Mellanox-ConnectX-4 Lx"}, "Resources": [], "Actions": []}
8,162040 0,100807 0,468630
```

`] time curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/mezz/sensors`
```
{"Information": {"PORT_0_LINK_STATE (PLDM)": {"value": "Normal"}, "MEZZ_SENSOR_TEMP": {"value": "60.00"}, "NIC_SOC_TEMP (PLDM)": {"value": "60.00"}, "NIC_HEALTH_STATE (PLDM)": {"value": "Normal"}, "PORT_0_TEMP (PLDM)": {"value": "0.00"}, "PORT_0_LINK_SPEED (PLDM)": {"value": "0.00"}}, "Resources": [], "Actions": ["history-clear"]}
19,088600 0,104294 12,194248
```

`] time curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/mezz/logs`
P425564318

## /api/sensors
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/sensors`
P425564566

## /api/server(X)/bios
```
➜  ~ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios
{"Resources": ["boot-order", "plat-info", "postcode"], "Information": {"Description": "BIOS Information"}, "Actions": []}%
```
## /api/server(X)/bios/boot_order
```
curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/boot-order
{"Resources": ["boot_mode", "boot_order", "clear_cmos", "force_boot_bios_setup"], "Actions": [], "Information": {"Description": "BIOS Boot Order Information"}}%
```
## /api/server(X)/bios/boot-order/boot_order
```
curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/boot-order/boot_order
{"Resources": [], "Actions": ["set", "disable"], "Information": {"Boot Order": "USB Device, USB Device, USB Device, USB Device, USB Device", "Note #2: Boot Order No.": "{ 0: 'USB Device', 1: 'IPv4 Network', 9: 'IPv6 Network', 2: 'SATA HDD', 3: 'SATA-CDROM', 4: 'Other Removalbe Device', 255: 'Reserved' }", "Note #1: Actions Format:": "{'action': 'set', '1st': <1st_no>, '2nd': <2nd_no>, '3rd': <3rd_no>, '4th': <4th_no>, '5th': <5th_no>}"}}%
```
## /api/server(X)/bios/boot-order/boot_mode
```
➜  openbmc git:(restrouter) ✗ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/boot-order/boot_mode
{"Resources": [], "Actions": ["set"], "Information": {"Note #1: Actions Format:": "{ 'action': 'set', 'mode': {0,1} }", "Boot Mode": "Legacy", "Note #2: Boot Mode No.": "{ 0: 'Legacy', 1: 'UEFI' }"}}%
➜  openbmc git:(restrouter) ✗
```
## /api/server(X)/bios/boot-order/clear_cmos

```
➜  openbmc git:(restrouter) ✗ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/boot-order/clear_cmos
{"Resources": [], "Actions": ["enable", "disable"], "Information": {"Clear CMOS Function": "Disabled"}}%
```

## /api/server(X)/bios/boot-order/clear_cmos
```
➜  openbmc git:(restrouter) ✗ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/boot-order/force_boot_bios_setup
{"Resources": [], "Actions": ["enable", "disable"], "Information": {"Force Boot to BIOS Setup Function": "Disabled"}}%
```
## /api/server(X)/bios/plat-info
```
➜  openbmc git:(restrouter) ✗ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/plat-info
{"Resources": [], "Actions": [], "Information": {"Platform Information": ["Presense: Present", "Non Test Board", "SKU: Yosemite V2", "Slot Index: 1", "PCIe Configuration:4x Twin Lakes"]}}%
```
## /api/server(X)/bios/postcode

```
➜  openbmc git:(restrouter) ✗ curl -k  https://rtptest005-oob.ftw3:8443/api/server1/bios/postcode
{"Resources": [], "Actions": [], "Information": {"POST Code": "00 00 00 00 E3 E3 E3 AA 84 A0 B1 78 AD D9 78 AD D9 78 AD 92 92 92 99 92 9C 9D 98 B2 97 92 92 92 92 D5 91 99 92 92 92 EF 96 95 94 94 94 94 94 94 94 94 92 91 D4 D3 D2 D1 D0 79 70 68 78 9A 61 4F EE ED EC EB E9 E8 E7 E6 BF BC B7 BB B9 BA B9 B9 B9 B9 B9 B8 B7 BE B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B7 B6 B7 B6 B7 B7 B6 B6 B6 B6 B3 B3 B3 B3 B2 B4 B1 B0 B0 E5 E3 E4 E1 E0 AF AE AA A9 A9 A8 A7 A7 A7 A9 A7 A3 A3 A1 19 06 05 04 03 02 01"}}%
```

Reviewed By: amithash

fbshipit-source-id: 42e0bf8f4c
facebook-github-bot pushed a commit that referenced this issue Jun 25, 2021
… server, sled, spb

Summary: Asynchronization of REST API components.

Test Plan:
## /spi/spb

`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb`
```
{"Information": {"Description": "FBY2 Side Plane"}, "Resources": ["bmc", "fans", "fruid", "logs", "sensors"], "Actions": ["sled-cycle", "sled-identify-on", "sled-identify-off"]}
14,020372 0,102242 3,839762
```
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb/bmc`
```
{"Information": {"TPM TCG version": "1.2", "OpenBMC Version": "2020.49.2", "memory": {"Shmem": 33736, "Cached": 123568, "MemAvailable": 345456, "MemTotal": 435728, "Buffers": 0, "MemFree": 259988}, "SPI0 Vendor": "Winbond", "MAC Addr": "98:03:9B:A7:AE:2D", "MTD Parts": ["romx", "env", "u-boot", "fit", "data0", "flash1", "flash1rw", "rom", "envro", "u-bootro", "fitro", "dataro", "flash0"], "uptime": "627315.55", "u-boot version": "2016.07", "open-fds": "1093", "SPI1 Vendor": "Winbond", "Secondary Boot Triggered": false, "load-15": "4.37", "vboot": {"cert_fallback_time": "Sat Jun 17 13:17:06 2017", "software_enforce": "0x01", "status_crc": "0xeb0b", "cert_time": "Sat Jun 17 13:17:06 2017", "hardware_enforce": "0x01", "tpm_status": "0", "force_recovery": "0x00", "uboot_time": "Thu Feb 11 17:04:43 2021", "recovery_boot": "0x00", "recovery_retried": "0x00", "status_text": "OpenBMC was verified correctly", "status": "0.0", "uboot_fallback_time": "Thu Feb 11 17:04:43 2021"}, "Description": "FBY2 BMC", "kernel version": "4.1.51 #1 Fri Feb 12 00:47:04 UTC 2021", "Reset Reason": "User Initiated Reset or WDT Reset", "TPM FW version": "133.33", "At-Scale-Debug Running": "", "CPU Usage": "CPU:  39% usr  60% sys   0% nic   0% idle   0% io   0% irq   0% sirq", "Memory Usage": "Mem: 175740K used, 259988K free, 33736K shrd, 0K buff, 123568K cached", "Uptime": "06:50:29 up 7 days,  6:15,  load average: 4.75, 4.46, 4.36", "load-1": "4.75", "load-5": "4.47"}, "Resources": [], "Actions": ["reboot"]}
13,616354 0,099073
```
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb/fans`
```
{"Information": ["Fan 0 Speed: 2892 RPM (24%)", "Fan 1 Speed: 2887 RPM (24%)", "Fan Mode: 0", "FSCD Driver:linear_inlet(spb:sp_inlet_temp)", "Sensor Fail: 0", "Fan Fail: 0", "Platform Specific: 0"], "Resources": [], "Actions": []}
8,685631 0,102030 0,656285
```
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb/fruid`
```
{"Information": {"Board Product": "Baseboard MP", "Board Custom Data 1": "19-001042", "Board Part Number": "B91.01510.0032", "Chassis Type": "Rack Mount Chassis", "Product Version": "MP", "Board Mfg": "Wiwynn", "Board Mfg Date": "Mon Jan 28 22:42:00 2019", "Product Custom Data 1": "01-003231", "Product Custom Data 2": "MP", "Board Serial": "WL329041U5ZA1", "Chassis Part Number": "B60.0150P.0004", "Product Manufacturer": "Wiwynn", "Product Asset Tag": "6479906", "Chassis Serial Number": "N/A", "Product Part Number": "B91.01501.0014", "Product Name": "Yosemite V2 MP", "Product Serial": "WTL19121UAMA1"}, "Resources": [], "Actions": []}
7,488774 0,102476 0,595613
```
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb/logs`
```
{"Information": {"Logs": []}, "Resources": [], "Actions": ["clear"]}
10,895581 0,101326 0,864532
```
`] curl -w '%{time_total} %{time_connect} %{time_appconnect}' -s -k  https://rtptest005-oob.ftw3:8443/api/spb/sensors`
```
{"Information": {"SP_SENSOR_P1V15_BMC_STBY": {"value": "1.14"}, "SP_P12V": {"value": "12.31"}, "SP_FAN1_TACH": {"value": "2887.00"}, "SP_HSC_PEAK_IOUT": {"value": "14.82"}, "SP_P1V8_STBY": {"value": "1.81"}, "SP_HSC_PEAK_PIN": {"value": "180.93"}, "SP_HSC_TEMP": {"value": "32.62"}, "SP_FAN0_PWM": {"value": "24.00"}, "SP_SENSOR_P2V5_BMC_STBY": {"value": "2.50"}, "SP_P3V3_STBY": {"value": "3.30"}, "SP_INLET_TEMP": {"value": "29.62"}, "SP_HSC_IN_VOLT": {"value": "12.40"}, "SP_HSC_OUT_CURR": {"value": "8.61"}, "SP_FAN1_PWM": {"value": "24.00"}, "SP_P12V_SLOT4": {"value": "12.35"}, "SP_OUTLET_TEMP": {"value": "34.94"}, "SP_P12V_SLOT1": {"value": "12.34"}, "SP_P12V_SLOT3": {"value": "12.32"}, "SP_P12V_SLOT2": {"value": "12.28"}, "SP_P3V3": {"value": "3.33"}, "SP_FAN0_TACH": {"value": "2891.00"}, "SP_SENSOR_P1V2_BMC_STBY": {"value": "1.20"}, "SP_HSC_IN_POWERAVG": {"value": "107.10"}, "SP_P5V": {"value": "4.99"}, "SP_HSC_IN_POWER": {"value": "107.93"}}, "Resources": [], "Actions": ["history-clear"]}
10,386820 0,099928 0,520789
```
## /api/logs
P425564113

## more to come

Reviewed By: amithash

fbshipit-source-id: 534bcc66a3
facebook-github-bot pushed a commit that referenced this issue Aug 25, 2021
Summary:
replace top calls for getting CPU and memory usage information to psutil.
Gather CPU information over a given period, as instant readings can be flaky
Context(https://www.internalfb.com/tasks/?t=98251975&activity=1049411515864195)

Test Plan:
rest running on oob:
```
Creating new webapp
Adding FBOSS base-routes
Adding common routes
Loaded acl cache with 70 entries
Updated cpu usage data.
2401:db00:21:b154:face:0:19:0 - - [24/Aug/2021:15:06:17 +0000] "GET /api/sys/bmc HTTP/1.1" 200 1243 1472637us "-" "-" "central_proxy"
2401:db00:eef0:1120:3520:0:1808:205b - - [24/Aug/2021:15:06:22 +0000] "GET /api/sys/bmc HTTP/1.1" 200 1243 1281313us "-" "-" "curl/7.61.1"
2401:db00:21:b154:face:0:19:0 - - [24/Aug/2021:15:06:27 +0000] "GET /api/sys/modbus_registers HTTP/1.1" 200 160 9838783us "-" "-" "central_proxy"
2401:db00:21:b154:face:0:19:0 - - [24/Aug/2021:15:06:29 +0000] "GET /api/sys/sensors HTTP/1.1" 200 2372 1020138us "-" "-" "central_proxy"
2401:db00:21:b154:face:0:19:0 - - [24/Aug/2021:15:06:29 +0000] "GET /api/sys/mTerm_status HTTP/1.1" 404 172 46424us "-" "-" "central_proxy"
Updated cpu usage data.
```

Original top output:
```
root@fboss8127813-oob:~# top -b n1
Mem: 141688K used, 99876K free, 10656K shrd, 0K buff, 94552K cached
CPU:  11% usr  52% sys   0% nic  29% idle   0% io   0% irq   5% sirq
```
Data via rest
```
{
  "Actions": [],
  "Resources": [],
  "Information": {
    "Secondary Boot Triggered": false,
    "load-15": "0.65",
    "kernel version": "5.10.23-wedge #1 Sun Apr 4 07:15:26 UTC 2021",
    "CPU Usage": "CPU:  10% usr  31% sys   0% nic   59% idle   0% io   0% irq   0% sirq",
    "vboot": {
      "status": "-1",
      "status_text": "Unsupported"
    },
    "Uptime": "02:54:43 up 64 days, 19:49,  load average: 1.03, 0.73, 0.64",
    "OpenBMC Version": "2021.14.0",
    "At-Scale-Debug Running": false,
    "open-fds": "387",
    "TPM FW version": "NA",
    "Reset Reason": "User Initiated Reset or WDT Reset",
    "TPM TCG version": "NA",
    "memory": {
      "MemTotal": 241564,
      "Cached": 94336,
      "Shmem": 10416,
      "MemFree": 100940,
      "Buffers": 0,
      "MemAvailable": 112244
    },
    "Description": "wedge BMC",
    "MAC Addr": "CC:37:AB:4A:89:46",
    "Memory Usage": "Mem: 141712K used, 99852K free, 10664K shrd, 0K buff, 94560K cached",
    "u-boot version": "2016.07",
    "uptime": "5600969.88",
    "load-5": "0.73",
    "SPI0 Vendor": "Unknown",
    "load-1": "1.03",
    "MTD Parts": [
      "u-boot",
      "env",
      "fit",
      "data0",
      "flash0"
    ],
    "SPI1 Vendor": "Unknown"
  }
}
```

Reviewed By: kawmarco

fbshipit-source-id: f5ee2036f3
facebook-github-bot pushed a commit that referenced this issue Oct 26, 2021
Summary:
It was reported on Northdome that certain invocations of `fruid-util`
could result in an error such as:
```
    malloc(): invalid size(unsorted)
```
Looking at the glibc source code this appears to be a buffer-overrun
resulting in corruption of the buddy information in the heap allocation.

I visually inspected the code and found two instances where strings were
not properly NUL-terminated.  I then hacked at the executable to get it
to compile on an x86-64 system so I could run the tool against an EEPROM
capture that was reported to cause the problem.  I enabled GCC's ASAN
and it identified the following problem:

```
$ gcc recipes-lib/fruid/files/fruid.c recipes-core/fruid/files/fruid-util.c \
    -Irecipes-lib/fruid/files -Irecipes-lib/ipmi/files \
    -Irecipes-lib/obmc-pal/files -ljansson -O1 -g -fsanitize=address

$ ./a.out slot1 --modify --CCD1 9KF8120U10147 5.bin
=================================================================
==166643==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000003cf at pc 0x55c4c24403db bp 0x7ffc2cb11cf0 sp 0x7ffc2cb11ce0
READ of size 1 at 0x6020000003cf thread T0
    #0 0x55c4c24403da in rtrim recipes-core/fruid/files/fruid-util.c:70
    #1 0x55c4c2440e7d in fruid_trim recipes-core/fruid/files/fruid-util.c:87
    #2 0x55c4c2440e7d in get_fruid_info recipes-core/fruid/files/fruid-util.c:511
    #3 0x55c4c2444ad7 in do_action recipes-core/fruid/files/fruid-util.c:1148
    #4 0x55c4c2444fe3 in main recipes-core/fruid/files/fruid-util.c:1273
    #5 0x7fd8bd86b7fc in __libc_start_main (/lib64/libc.so.6+0x237fc)
    #6 0x55c4c2436459 in _start (/home/apwillia/local/sync/fbopenbmc/common/a.out+0x7459)

0x6020000003cf is located 1 bytes to the left of 2-byte region [0x6020000003d0,0x6020000003d2)
allocated by thread T0 here:
    #0 0x7fd8bdacd777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777)
    #1 0x55c4c2436b4f in _fruid_area_field_read recipes-lib/fruid/files/fruid.c:192

AddressSanitizer: heap-buffer-overflow recipes-core/fruid/files/fruid-util.c:70 in rtrim
```

Through some additional debug I determined that the `chassis.custom2`
field in this EEPROM was initialized with 0's.  This causes
`_fruid_area_field_read` to interpret the data as {TYPE_BINARY, len 0}
for which it allocates a 1-byte NUL-terminated string.  Later on the
`rtrim` function does not correctly handle strings where `strlen` is 0
without causing corruption past the end of the string.  Added a case to
skip `rtrim` when the string is 0-bytes long.

After this was resolved, ASAN identified another problem:
```
$ ./a.out slot1 --modify --CCD1 9KF8120U10147 5.bin
=================================================================
==170880==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000000110 at pc 0x7fa7c0d8481b bp 0x7fffe02a33c0 sp 0x7fffe02a2b68
WRITE of size 14 at 0x611000000110 thread T0
    #0 0x7fa7c0d8481a in __interceptor_memcpy (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0x3a81a)
    #1 0x55dd7892aced in memcpy /usr/include/bits/string_fortified.h:29
    #2 0x55dd7892aced in fruid_modify recipes-lib/fruid/files/fruid.c:1852
    #3 0x55dd7892fb2c in do_action recipes-core/fruid/files/fruid-util.c:1148
    #4 0x55dd78930062 in main recipes-core/fruid/files/fruid-util.c:1278
    #5 0x7fa7c0b9e7fc in __libc_start_main (/lib64/libc.so.6+0x237fc)
    #6 0x55dd78921459 in _start (/home/apwillia/local/sync/fbopenbmc/common/a.out+0x7459)

0x611000000110 is located 0 bytes to the right of 208-byte region [0x611000000040,0x611000000110)
allocated by thread T0 here:
    #0 0x7fa7c0e00777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777)
    #1 0x55dd78927e9d in fruid_modify recipes-lib/fruid/files/fruid.c:1618
```

The source of this issue is found when adding a new optional field, such
as `CCD1`, it can cause an entirely new section (ex. `chassis`) to be
added with all of its optional fields becoming 1-byte type/len entries.
In order to prevent a buffer overrun when creating the modified EEPROM
image, we need to account for these additional optional fields.
Over-estimate this size by adding an allocation for all optional fields
in the entire image.

Test Plan: Fix issues and confirm ASAN no longer reports problems.

Reviewed By: amithash

fbshipit-source-id: 6729ce2a43
zzzoie referenced this issue in delta-sw103/openbmc Nov 9, 2021
Summary:
It was reported on Northdome that certain invocations of `fruid-util`
could result in an error such as:
```
    malloc(): invalid size(unsorted)
```
Looking at the glibc source code this appears to be a buffer-overrun
resulting in corruption of the buddy information in the heap allocation.

I visually inspected the code and found two instances where strings were
not properly NUL-terminated.  I then hacked at the executable to get it
to compile on an x86-64 system so I could run the tool against an EEPROM
capture that was reported to cause the problem.  I enabled GCC's ASAN
and it identified the following problem:

```
$ gcc recipes-lib/fruid/files/fruid.c recipes-core/fruid/files/fruid-util.c \
    -Irecipes-lib/fruid/files -Irecipes-lib/ipmi/files \
    -Irecipes-lib/obmc-pal/files -ljansson -O1 -g -fsanitize=address

$ ./a.out slot1 --modify --CCD1 9KF8120U10147 5.bin
=================================================================
==166643==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000003cf at pc 0x55c4c24403db bp 0x7ffc2cb11cf0 sp 0x7ffc2cb11ce0
READ of size 1 at 0x6020000003cf thread T0
    #0 0x55c4c24403da in rtrim recipes-core/fruid/files/fruid-util.c:70
    #1 0x55c4c2440e7d in fruid_trim recipes-core/fruid/files/fruid-util.c:87
    #2 0x55c4c2440e7d in get_fruid_info recipes-core/fruid/files/fruid-util.c:511
    #3 0x55c4c2444ad7 in do_action recipes-core/fruid/files/fruid-util.c:1148
    #4 0x55c4c2444fe3 in main recipes-core/fruid/files/fruid-util.c:1273
    #5 0x7fd8bd86b7fc in __libc_start_main (/lib64/libc.so.6+0x237fc)
    #6 0x55c4c2436459 in _start (/home/apwillia/local/sync/fbopenbmc/common/a.out+0x7459)

0x6020000003cf is located 1 bytes to the left of 2-byte region [0x6020000003d0,0x6020000003d2)
allocated by thread T0 here:
    #0 0x7fd8bdacd777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777)
    #1 0x55c4c2436b4f in _fruid_area_field_read recipes-lib/fruid/files/fruid.c:192

AddressSanitizer: heap-buffer-overflow recipes-core/fruid/files/fruid-util.c:70 in rtrim
```

Through some additional debug I determined that the `chassis.custom2`
field in this EEPROM was initialized with 0's.  This causes
`_fruid_area_field_read` to interpret the data as {TYPE_BINARY, len 0}
for which it allocates a 1-byte NUL-terminated string.  Later on the
`rtrim` function does not correctly handle strings where `strlen` is 0
without causing corruption past the end of the string.  Added a case to
skip `rtrim` when the string is 0-bytes long.

After this was resolved, ASAN identified another problem:
```
$ ./a.out slot1 --modify --CCD1 9KF8120U10147 5.bin
=================================================================
==170880==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000000110 at pc 0x7fa7c0d8481b bp 0x7fffe02a33c0 sp 0x7fffe02a2b68
WRITE of size 14 at 0x611000000110 thread T0
    #0 0x7fa7c0d8481a in __interceptor_memcpy (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0x3a81a)
    #1 0x55dd7892aced in memcpy /usr/include/bits/string_fortified.h:29
    #2 0x55dd7892aced in fruid_modify recipes-lib/fruid/files/fruid.c:1852
    #3 0x55dd7892fb2c in do_action recipes-core/fruid/files/fruid-util.c:1148
    #4 0x55dd78930062 in main recipes-core/fruid/files/fruid-util.c:1278
    #5 0x7fa7c0b9e7fc in __libc_start_main (/lib64/libc.so.6+0x237fc)
    #6 0x55dd78921459 in _start (/home/apwillia/local/sync/fbopenbmc/common/a.out+0x7459)

0x611000000110 is located 0 bytes to the right of 208-byte region [0x611000000040,0x611000000110)
allocated by thread T0 here:
    #0 0x7fa7c0e00777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777)
    #1 0x55dd78927e9d in fruid_modify recipes-lib/fruid/files/fruid.c:1618
```

The source of this issue is found when adding a new optional field, such
as `CCD1`, it can cause an entirely new section (ex. `chassis`) to be
added with all of its optional fields becoming 1-byte type/len entries.
In order to prevent a buffer overrun when creating the modified EEPROM
image, we need to account for these additional optional fields.
Over-estimate this size by adding an allocation for all optional fields
in the entire image.

Test Plan: Fix issues and confirm ASAN no longer reports problems.

Reviewed By: amithash

fbshipit-source-id: 6729ce2a43
facebook-github-bot pushed a commit that referenced this issue Nov 18, 2021
Summary:
Update the preferred Linux kernel version from 5.6.19 to 5.10.%
Update linux-aspeed bbappend file to support fby35

Test Plan:
1) Build new Linux kernel 5.10 image
2) Boot image with QEMU
3) Verify image boots to login prompt
4) Login and dump sensor-util output

[garnermic@devvm3584.ftw0 ~/local/openbmc-qemu/build] ./qemu-system-arm -machine ast2600-evb -drive file=~/fby35.mtd,format=raw,if=mtd -serial stdio -display none -no-reboot -s

U-Boot SPL 2019.04 fby35-e3d25c1ad6-dirty (Oct 19 2021 - 20:07:17 +0000)
SYS_INIT_RAM_END=10016000
CONFIG_SYS_INIT_SP_ADDR=10015800
CONFIG_MALLOC_F_ADDR=10012800
gd = sp = 10012730
fdt=00015440
Setup flash: write enable, addr4B, CE1 AHB 64MB window
Setup FMC_CE_CTRL = 0x00000033
Watchdog: 300s
hwstrap write protect SCU508=0x00000000, SCU518=0x00000000
Before: CE0_CTRL=0x00000600, CE1_CTRL=0x00000000
cs0_status = 1, cs1_status = 1
After: CE0_CTRL=0x00000400, CE1_CTRL=0x00000000
vboot_reset 497
Booting recovery U-Boot.
Blindly jumping to 0x20040000

U-Boot 2019.04 fby35-e3d25c1ad6-dirty (Oct 19 2021 - 20:07:17 +0000)

SOC: AST2600-A3
eSPI Mode: SIO:Enable : SuperIO-2e
Eth: MAC0: RGMII, MAC1: RGMII, MAC2: RGMII, MAC3: RGMII
Model: Aspeed BMC
DRAM:  896 MiB (capacity:1024 MiB, VGA:64 MiB, ECC:on, ECC size:896 MiB)
Watchdog: 300s
MMC:
In:    serial
Out:   serial
Err:   serial
Model: Aspeed BMC
Net:   No MDIO found.
No ethernet found.
autoboot in 3 seconds (stop with 'Delete' key)...
   Using 'conf@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x201a00e0
     Data Size:    3922304 Bytes = 3.7 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80008000
     Entry Point:  0x80008000
     Hash algo:    sha256
     Hash value:   379bca163fe25e61520d6a29c4c9ac2544efaf6f409b8606561a6c69651544b4
   Using 'conf@1' configuration
   Trying 'ramdisk@1' ramdisk subimage
     Description:  RAMDISK
     Type:         RAMDisk Image
     Compression:  lzma compressed
     Data Start:   0x2055db50
     Data Size:    23794130 Bytes = 22.7 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    sha256
     Hash value:   519df568f9b6848e37750bb0cdcc1b3b3e660bb0a1e0ce0478366478e79d8a4e
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x21c0ee04
     Data Size:    39043 Bytes = 38.1 KiB
     Architecture: ARM
     Hash algo:    sha256
     Hash value:   7340ceed601d3c9efb089a0470cb29bd6f65beb1685bff6a081a177ccb38dfab
   Booting using the fdt blob at 0x21c0ee04
   Loading Kernel Image ... OK
   Loading Ramdisk to 9e94e000, end 9ffff1d2 ... OK
   Loading Device Tree to 8fff3000, end 8ffff882 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Linux version 5.10.23-fby35 (oe-user@oe-host) (arm-fb-linux-gnueabi-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Mon Oct 25 21:15:12 UTC 2021
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Facebook fby35
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 16 MiB at 0xb7000000
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000080000000-0x00000000b7ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x00000000b7ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000b7ffffff]
[    0.000000] percpu: Embedded 20 pages/cpu s50380 r8192 d23348 u81920
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 227584
[    0.000000] Kernel command line: console=ttyS0,57600n8 root=/dev/ram rw vmalloc=384M
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 855256K/917504K available (9216K kernel code, 789K rwdata, 2152K rodata, 1024K init, 186K bss, 45864K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] random: get_random_u32 called from cache_alloc_refill+0x3d4/0x8e4 with crng_init=0
[    0.000000] ftrace: allocating 28842 entries in 57 pages
[    0.000000] ftrace: allocated 57 pages with 4 groups
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]     Rude variant of Tasks RCU enabled.
[    0.000000]     Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 1200.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x114c1bbbeec, max_idle_ns: 440795229572 ns
[    0.000202] sched_clock: 56 bits at 1200MHz, resolution 0ns, wraps every 2199023255551ns
[    0.000515] Switching to timer-based delay loop, resolution 0ns
[    0.013408] Console: colour dummy device 80x30
[    0.015812] Calibrating delay loop (skipped), value calculated using timer frequency.. 2400.00 BogoMIPS (lpj=12000000)
[    0.016104] pid_max: default: 32768 minimum: 301
[    0.018219] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.018290] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.035977] CPU: Testing write buffer coherency: ok
[    0.050015] CPU0: update cpu_capacity 1024
[    0.050143] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00
[    0.060515] Setting up static identity map for 0x80100000 - 0x80100078
[    0.061630] rcu: Hierarchical SRCU implementation.
[    0.069144] smp: Bringing up secondary CPUs ...
[    0.074159] CPU1: update cpu_capacity 1024
[    0.074215] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01
[    0.080462] smp: Brought up 1 node, 2 CPUs
[    0.080605] SMP: Total of 2 processors activated (4800.00 BogoMIPS).
[    0.080686] CPU: All CPU(s) started in SVC mode.
[    0.102532] devtmpfs: initialized
[    0.130348] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.146890] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.147947] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.153375] pinctrl core: initialized pinctrl subsystem
[    0.165289] NET: Registered protocol family 16
[    0.191474] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.199171] No ATAGs?
[    0.200139] hw-breakpoint: CPU 0 debug is powered down!
[    0.351000] SCSI subsystem initialized
[    0.353737] usbcore: registered new interface driver usbfs
[    0.354151] usbcore: registered new interface driver hub
[    0.354378] usbcore: registered new device driver usb
[    0.354925] mc: Linux media interface: v0.10
[    0.355096] videodev: Linux video capture interface: v2.00
[    0.355455] EDAC MC: Ver: 3.0.0
[    0.383806] clocksource: Switched to clocksource arch_sys_counter
[    0.518405] NET: Registered protocol family 2
[    0.526119] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.526286] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.526792] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.527079] TCP: Hash tables configured (established 8192 bind 8192)
[    0.528450] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.528761] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.530678] NET: Registered protocol family 1
[    0.537156] Unpacking initramfs...
[   54.505112] Freeing initrd memory: 23240K
[   54.511145] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[   54.515993] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[   54.516547] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[   54.519256] NET: Registered protocol family 38
[   54.519785] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[   54.519989] io scheduler mq-deadline registered
[   54.520120] io scheduler kyber registered
[   54.948081] Serial: 8250/16550 driver, 17 ports, IRQ sharing enabled
[   54.980477] printk: console [ttyS0] disabled
[   55.008613] 1e784000.serial: ttyS0 at MMIO 0x1e784000 (irq = 42, base_baud = 1500000) is a 16550A
[   55.025974] printk: console [ttyS0] enabled
[   55.034587] 1e783000.serial: ttyS1 at MMIO 0x1e783000 (irq = 41, base_baud = 1500000) is a 16550A
[   55.039559] 1e78d000.serial: ttyS2 at MMIO 0x1e78d000 (irq = 43, base_baud = 1500000) is a 16550A
[   55.042369] 1e78e000.serial: ttyS3 at MMIO 0x1e78e000 (irq = 44, base_baud = 1500000) is a 16550A
[   55.047548] 1e78f000.serial: ttyS4 at MMIO 0x1e78f000 (irq = 45, base_baud = 1500000) is a 16550A
[   55.075684] loop: module loaded
[   55.108795] aspeed-smc 1e620000.spi: Using bus width 2 and 50 MHz SPI frequency
[   55.110524] aspeed-smc 1e620000.spi: unrecognized JEDEC id bytes: 00 00 00 00 00 00
[   55.110981] aspeed-smc 1e620000.spi: Aspeed SMC probe failed -2
[   55.454617] aspeed-smc: probe of 1e620000.spi failed with error -2
[   55.475578] libphy: Fixed MDIO Bus: probed
[   55.478539] ftgmac100 1e690000.ftgmac: Read MAC address 52:54:00:12:34:59 from chip
[   55.479041] ftgmac100 1e690000.ftgmac: Using NCSI interface
[   55.496092] ftgmac100 1e690000.ftgmac eth0: irq 32, mapped at (ptrval)
[   55.498023] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   55.498483] ehci-platform: EHCI generic platform driver
[   55.513580] ehci-platform 1e6a1000.usb: EHCI Host Controller
[   55.515030] ehci-platform 1e6a1000.usb: new USB bus registered, assigned bus number 1
[   55.524858] ehci-platform 1e6a1000.usb: irq 33, io mem 0x1e6a1000
[   55.553516] ehci-platform 1e6a1000.usb: USB 2.0 started, EHCI 1.00
[   55.568110] hub 1-0:1.0: USB hub found
[   55.569064] hub 1-0:1.0: 6 ports detected
[   55.587938] ehci-platform 1e6a3000.usb: EHCI Host Controller
[   55.588516] ehci-platform 1e6a3000.usb: new USB bus registered, assigned bus number 2
[   55.590289] ehci-platform 1e6a3000.usb: irq 34, io mem 0x1e6a3000
[   55.612877] ehci-platform 1e6a3000.usb: USB 2.0 started, EHCI 1.00
[   55.616379] hub 2-0:1.0: USB hub found
[   55.616691] hub 2-0:1.0: 6 ports detected
[   55.619576] uhci_hcd: USB Universal Host Controller Interface driver
[   55.620459] platform-uhci 1e6b0000.usb: Detected 2 ports from device-tree
[   55.620787] platform-uhci 1e6b0000.usb: Enabled Aspeed implementation workarounds
[   55.631685] platform-uhci 1e6b0000.usb: Generic UHCI Host Controller
[   55.632074] platform-uhci 1e6b0000.usb: new USB bus registered, assigned bus number 3
[   55.633231] platform-uhci 1e6b0000.usb: irq 35, io mem 0x1e6b0000
[   55.637791] hub 3-0:1.0: USB hub found
[   55.638319] hub 3-0:1.0: 2 ports detected
[   55.641655] usbcore: registered new interface driver usb-storage
[   55.647262] aspeed-rtc 1e781000.rtc: registered as rtc0
[   55.649022] aspeed-rtc 1e781000.rtc: setting system clock to 2000-01-01T00:00:00 UTC (946684800)
[   55.650340] i2c /dev entries driver
[   55.655574] aspeed-i2c-bus 1e78a080.i2c-bus: i2c bus 0 registered, irq 46
[   55.658584] aspeed-i2c-bus 1e78a100.i2c-bus: i2c bus 1 registered, irq 47
[   55.661492] aspeed-i2c-bus 1e78a180.i2c-bus: i2c bus 2 registered, irq 48
[   55.664990] aspeed-i2c-bus 1e78a200.i2c-bus: i2c bus 3 registered, irq 49
[   55.667363] aspeed-i2c-bus 1e78a280.i2c-bus: i2c bus 4 registered, irq 50
[   55.669515] aspeed-i2c-bus 1e78a300.i2c-bus: i2c bus 5 registered, irq 51
[   55.671801] aspeed-i2c-bus 1e78a380.i2c-bus: i2c bus 6 registered, irq 52
[   55.674329] aspeed-i2c-bus 1e78a400.i2c-bus: i2c bus 7 registered, irq 53
[   55.676856] aspeed-i2c-bus 1e78a480.i2c-bus: i2c bus 8 registered, irq 54
[   55.679339] aspeed-i2c-bus 1e78a500.i2c-bus: i2c bus 9 registered, irq 55
[   55.681553] aspeed-i2c-bus 1e78a580.i2c-bus: i2c bus 10 registered, irq 56
[   55.685233] aspeed-i2c-bus 1e78a600.i2c-bus: i2c bus 11 registered, irq 57
[   55.687408] aspeed-i2c-bus 1e78a680.i2c-bus: i2c bus 12 registered, irq 58
[   55.689191] aspeed-i2c-bus 1e78a700.i2c-bus: i2c bus 13 registered, irq 59
[   55.691283] Driver for 1-wire Dallas network protocol.
[   55.697675] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com
[   55.699969] sdhci: Secure Digital Host Controller Interface driver
[   55.700231] sdhci: Copyright(c) Pierre Ossman
[   55.700428] sdhci-pltfm: SDHCI platform and OF driver helper
[   55.703665] usbcore: registered new interface driver usbhid
[   55.704085] usbhid: USB HID core driver
[   55.708225] aspeed_adc 1e6e9000.adc: trim 8
[   55.709502] aspeed_adc 1e6e9000.adc: cv 512
[   55.713790] aspeed_adc 1e6e9100.adc: trim 8
[   55.714996] aspeed_adc 1e6e9100.adc: cv 512
[   55.722370] NET: Registered protocol family 10
[   55.737083] Segment Routing with IPv6
[   55.737783] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[   55.741709] NET: Registered protocol family 17
[   55.742125] 8021q: 802.1Q VLAN Support v1.8
[   55.743751] Registering SWP/SWPB emulation handler
[   55.755466] printk: console [netcon0] enabled
[   55.755715] netconsole: network logging started
[   55.809176] platform-uhci 1e6b0000.usb: Controller not stopped yet!
[   55.838696] Freeing unused kernel memory: 1024K
[   55.940278] Checked W+X mappings: passed, no W+X pages found
[   55.940904] Run /init as init process
INIT: version 2.96 booting
Starting udev
[   57.608933] udevd[79]: starting version 3.2.9
[   57.627843] random: udevd: uninitialized urandom read (16 bytes read)
[   57.636055] random: udevd: uninitialized urandom read (16 bytes read)
[   57.638674] random: udevd: uninitialized urandom read (16 bytes read)
[   57.726040] udevd[80]: starting eudev-3.2.9
[   59.460072] aspeed-g6-pinctrl 1e6e2000.syscon:pinctrl: pin A4 already requested by 1e6a1000.usb; cannot claim for 1e6a0000.usb-vhub
[   59.462529] aspeed-g6-pinctrl 1e6e2000.syscon:pinctrl: pin-252 (1e6a0000.usb-vhub) status -22
[   59.464584] aspeed-g6-pinctrl 1e6e2000.syscon:pinctrl: could not request pin 252 (A4) from group USBA  on device aspeed-g6-pinctrl
[   59.466864] aspeed_vhub 1e6a0000.usb-vhub: Error applying setting, reverse things back
[   59.469703] aspeed_vhub: probe of 1e6a0000.usb-vhub failed with error -22
[   60.384685] timeriomem_rng 1e6e2524.hwrng: 32bits from 0x(ptrval) @ 1us
[   60.391910] random: fast init done
[   60.439152] random: crng init done
[   60.439523] random: 1 urandom warning(s) missed due to ratelimiting
No data0/dataro partition found. /mnt/data not mounted.
Fri Mar  9 12:34:56 UTC 2018
Remove poweroff command from .bash
INIT: Entering runlevel: 5
Configuring network interfaces... [   76.048378] 8021q: adding VLAN 0 to HW filter on device eth0
done.
Starting random number generator daemon.
Setup dhclient for IPv6... done.
reloading rsyslogd ... done
[   77.072894] ftgmac100 1e690000.ftgmac eth0: NCSI: retransmit cmd 0x2
Starting OpenBSD Secure Shell server: sshd
  generating ssh RSA key...
[   79.143213] ftgmac100 1e690000.ftgmac eth0: NCSI: retransmit cmd 0x1
  generating ssh ECDSA key...
  generating ssh DSA key...
[   80.193451] ftgmac100 1e690000.ftgmac eth0: NCSI: No channel found to configure!
[   81.223132] ftgmac100 1e690000.ftgmac eth0: Wrong NCSI state 0x100 in workqueue
  generating ssh ED25519 key...
done.
check bmc ready...
Starting atd: OK
Starting ntpd: done
starting rsyslogd ... rsyslogd: imfile: on startup file '/var/log/mTerm_server.log' does not exist but is configured in static file monitor - this may indicate a misconfiguration. If the file appears at a later time, it will automatically be processed. Reason: No such file or directory [v8.2002.0]
done
Set up BMC GPIO pins...
done.
[   86.462063] tmp421 8-001f: Could not read configuration register (-6)
[   86.463833] i2c i2c-8: new_device: Instantiated device tmp421 at 0x1f
[   86.514325] i2c i2c-8: new_device: Instantiated device 24c32 at 0x50
Setup devs for fby35...Is board id correct(id=0)?...Done.
Starting mTerm console server...done.
Setup IPMI message handler... done.
Starting IPMB Rx/Tx Daemon..Is board id correct(id=0)?...Done.
Setup Caching for Bridge IC info..Is board id correct(id=0)?...done.
Setup Front Panel Daemon..done.
Setup VishayIC for fby35...Is board id correct(id=0)?...Done.
Mon Jan  1 00:00:00 PST 2018
Is board id correct(id=0)?...check eth0 ipv4...
Setup fan speed...
cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Error while setting fan speed for Zone 0
Error while setting fan speed for Zone 1
Error while setting fan speed for Zone 2
Error while setting fan speed for Zone 3
Setup gpio monitoring for fby35... done.
Setup gpiointrd for fby35...Is board id correct(id=0)?...done.
Setup healthd for BMC done.
Setup ncsid for BMC done.
Get MB FW version...
Error: Read failed
Error: Read failed
Error: Read failed
Error: Read failed
Error: Write failed
Error: Write failed
cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Error: Write failed
Setup sensor monitoring for FBYV35... done.
Setup crond...starting Busybox Periodic Command Scheduler: crond... done.
done.
ok: run: restapi: (pid 912) 0s

OpenBMC Release fby35-e3d25c1ad6-dirty

bmc-oob. login: cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
cat: can't open '/var/run/dhclient.eth0.pid': No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
/etc/rc5.d/S71check_eth0_ipv4.sh: line 14: kill: (260) - No such process
/etc/rc5.d/S71check_eth0_ipv4.sh: line 14: kill: (260) - No such process
/etc/rc5.d/S71check_eth0_ipv4.sh: line 14: kill: (260) - No such process

OpenBMC Release fby35-e3d25c1ad6-dirty

bmc-oob. login: root
Password:
root@bmc-oob:~# /usr/local/bin/sensor-util
Usage: sensor-util [fru] <sensor num> <option> ..
       sensor-util [fru] <option> ..

       [fru]           : all, slot1, slot2, slot3, slot4, bmc, nic
       [historical fru]: all, slot1, slot2, slot3, slot4, bmc nic
       Use "aggregate" as the [fru] to print just aggregated sensors defined for this platform
       <sensor num>: 0xXX (Omit [sensor num] means all sensors.)
       <option>:
         --threshold               show all thresholds
         --history <period>        show max, min and average values of last <period> seconds
         --history <period>[m/h/d] show max, min and average values of last <period> minutes/hours/days
              example --history 4d means history of 4 days
         --history-clear           clear history values
         --force                   read the sensor directly from the h/w (not cache).Ensure sensord is killed before executing this command
         --json                    JSON representation
         --filter <sensor name with slot name>  filtered by <sensor name with slot name> for fscd usage.
                                   <sensor name with slot_name> will convert space " " to "_",and convert upper case to lower case before filtering
         <sensor name with slot name>: "<slot_name>_<sensor_name>"
                                       "<slot_name> <sensor_name>"
         e.g.,  sensor-util all --filter "slot2_soc_therm_margin"
                slot2 SOC Therm Margin       (0xXX) :  XX.XX C     | (ok)
         e.g.,  sensor-util all --filter "slot2 SOC Therm Margin"
                slot2 SOC Therm Margin       (0xXX) :  XX.XX C     | (ok)
root@bmc-oob:~# /usr/local/bin/sensor-util all

NIC_SENSOR_TEMP              (0xEF) : NA | (na)

BMC_SENSOR_FAN0_TACH         (0xE0) : NA | (na)
BMC_SENSOR_FAN1_TACH         (0xE1) : NA | (na)
BMC_SENSOR_FAN2_TACH         (0xE2) : NA | (na)
BMC_SENSOR_FAN3_TACH         (0xE3) : NA | (na)
BMC_SENSOR_FAN4_TACH         (0xE4) : NA | (na)
BMC_SENSOR_FAN5_TACH         (0xE5) : NA | (na)
BMC_SENSOR_FAN6_TACH         (0xE6) : NA | (na)
BMC_SENSOR_FAN7_TACH         (0xE7) : NA | (na)
BMC_SENSOR_PWM0              (0xE8) : NA | (na)
BMC_SENSOR_PWM1              (0xE9) : NA | (na)
BMC_SENSOR_PWM2              (0xEA) : NA | (na)
BMC_SENSOR_PWM3              (0xEB) : NA | (na)
BMC_OUTLET_TEMP              (0xEE) : NA | (na)
BMC_INLET_TEMP               (0xED) : NA | (na)
BMC_SENSOR_P5V               (0xF0) : NA | (na)
BMC_SENSOR_P12V              (0xF1) : NA | (na)
BMC_SENSOR_P3V3_STBY         (0xF2) : NA | (na)
BMC_SENSOR_P1V8_STBY         (0xF3) : NA | (na)
BMC_SENSOR_P1V2_STBY         (0xF4) : NA | (na)
BMC_SENSOR_P2V5_STBY         (0xF5) : NA | (na)
BMC_SENSOR_P1V0_STBY         (0xD4) : NA | (na)
BMC_SENSOR_P0V6_STBY         (0xD5) : NA | (na)
BMC_SENSOR_P3V3_RGM_STBY     (0xD6) : NA | (na)
BMC_SENSOR_P5V_USB           (0xD7) : NA | (na)
BMC_SENSOR_P3V3_NIC          (0xD8) : NA | (na)
BMC_SENSOR_HSC_TEMP          (0xF8) : NA | (na)
BMC_SENSOR_HSC_VIN           (0xF7) : NA | (na)
BMC_SENSOR_HSC_PIN           (0xF9) : NA | (na)
BMC_SENSOR_HSC_EIN           (0xCB) : NA | (na)
BMC_SENSOR_HSC_IOUT          (0xFA) : NA | (na)
BMC_SENSOR_HSC_PEAK_IOUT     (0xC8) : NA | (na)
BMC_SENSOR_HSC_PEAK_PIN      (0xC9) : NA | (na)
BMC_SENSOR_MEDUSA_VOUT       (0xF6) : NA | (na)
BMC_SENSOR_MEDUSA_VIN        (0xFD) : NA | (na)
BMC_SENSOR_MEDUSA_CURR       (0xD0) : NA | (na)
BMC_SENSOR_MEDUSA_PWR        (0xD1) : NA | (na)
BMC_SENSOR_MEDUSA_VDELTA     (0xCF) : NA | (na)
BMC_SENSOR_PDB_DL_VDELTA     (0xCC) : NA | (na)
BMC_SENSOR_PDB_BB_VDELTA     (0xCE) : NA | (na)
BMC_SENSOR_CURR_LEAKAGE      (0xCD) : NA | (na)
BMC_SENSOR_FAN_IOUT          (0xFB) : NA | (na)
BMC_SENSOR_FAN_PWR           (0xCA) : NA | (na)
BMC_SENSOR_NIC_P12V          (0xD2) : NA | (na)
BMC_SENSOR_NIC_IOUT          (0xFC) : NA | (na)
BMC_SENSOR_NIC_PWR           (0xD3) : NA | (na)

SYSTEM_AIRFLOW               (0x0) : NA | (na)

Reviewed By: williamspatrick

fbshipit-source-id: 72943fd370
facebook-github-bot pushed a commit that referenced this issue Feb 18, 2022
Summary:
procps can throw various exceptions if a process goes missing part way
through a scan of /proc.  Found with OpenBMC Pusher during wedge400
weekly canary.

Test Plan:
CIT tests in Sandcastle.

Copy file to BMC, restart restapi and ensure the /api/sys/bmc endpoint still
works.

```
0 ~ $ curl -k https://rsw1ng-oob.12.lla2.facebook.com:8443/api/sys/bmc | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1264  100  1264    0     0    573      0  0:00:02  0:00:02 --:--:--   573
{
  "Information": {
    "Description": "wedge400 BMC",
    "MAC Addr": "0C:48:C6:28:91:00",
    "Reset Reason": "Power ON Reset",
    "Uptime": "11:42:24 up 23:51:00, load average: 2.99, 2.91, 3.18",
    "uptime": "85860.31",
    "Memory Usage": "Mem: 191436K used, 692524K free, 18456K shrd, 1064K buff, 129224K cached",
    "memory": {
      "MemTotal": 883960,
      "MemFree": 692524,
      "MemAvailable": 691720,
      "Buffers": 1064,
      "Cached": 129224,
      "Shmem": 18456
    },
    "CPU Usage": "CPU:  37% usr  45% sys   0% nic   17% idle   0% io   0% irq   0% sirq",
    "OpenBMC Version": "2022.07.0",
    "u-boot version": "2019.04",
    "kernel version": "5.10.23-wedge400 #1 Sun Feb 13 23:58:27 UTC 2022",
    "TPM TCG version": "NA",
    "TPM FW version": "NA",
    "SPI0 Vendor": "Unknown",
    "SPI1 Vendor": "Unknown",
    "At-Scale-Debug Running": false,
    "Secondary Boot Triggered": false,
    "vboot": {
      "status": "-1",
      "status_text": "Unsupported"
    },
    "load-1": "2.99",
    "load-5": "2.91",
    "load-15": "3.18",
    "open-fds": "735",
    "MTD Parts": [
      "u-boot",
      "env",
      "meta",
      "fit",
      "data0",
      "flash0",
      "flash1"
    ],
    "mmc-info": {
      "/dev/mmcblk0": {
        "CID_MID": 69,
        "CID_PNM": "DG4008",
        "CID_PRV_MAJOR": 1,
        "CID_PRV_MINOR": 23,
        "EXT_CSD_PRE_EOL_INFO": 1,
        "EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A": 1,
        "EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B": 1
      }
    }
  },
  "Actions": [],
  "Resources": []
}
```

Reviewed By: cjcon90

fbshipit-source-id: f047432e33
facebook-github-bot pushed a commit that referenced this issue Jul 26, 2022
Summary: change the wedge400 kernel configuration recipe to support the spi-aspeed-user driver.

Test Plan:
root@fboss312097296-oob:~# uname -a
Linux fboss312097296-oob.snc1.facebook.com 5.15.27-wedge400 #1 Thu Jul 14 05:56:24 UTC 2022 armv6l GNU/Linux
root@fboss312097296-oob:/dev# ls -l spi*
crw-------    1 root     root      153,   0 Jul 13 23:19 spidev1.0
root@fboss311782526-oob:/sys/bus/platform/drivers/aspeed-spi-user# ls -l
lrwxrwxrwx    1 root     root             0 Jul 18 11:41 1e630000.spi -> ../../../../devices/platform/ahb/1e630000.spi
--w-------    1 root     root          4096 Jul 18 11:41 bind
--w-------    1 root     root          4096 Jul 18 11:41 uevent
--w-------    1 root     root          4096 Jul 18 11:41 unbind
root@fboss312097296-oob:~# time spi_util.sh read spi1 DOM_FPGA_FLASH1 fpga
Config SPI1 Done.
Reading flash to fpga...
flashrom v1.2 on Linux 5.15.27-wedge400 (armv6l)
flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Using default 2000kHz clock. Use 'spispeed' parameter to override.
Found Micron/Numonyx/ST flash chip "N25Q128..3E" (16384 kB, SPI) on linux_spi.
Reading flash... done.
real    1m0.632s
user    0m0.925s
sys     0m25.657s
root@fboss312097296-oob:~# time spi_util.sh erase spi1 DOM_FPGA_FLASH1
Config SPI1 Done.
Erasing flash...
flashrom v1.2 on Linux 5.15.27-wedge400 (armv6l)
flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Using default 2000kHz clock. Use 'spispeed' parameter to override.
Found Micron/Numonyx/ST flash chip "N25Q128..3E" (16384 kB, SPI) on linux_spi.
Erasing and writing flash chip... Erase/write done.
real    2m34.025s
user    0m10.878s
sys     0m51.180s
root@fboss312097296-oob:~# time spi_util.sh write spi1 DOM_FPGA_FLASH1 fpga
Config SPI1 Done.
Writing fpga to flash...
flashrom v1.2 on Linux 5.15.27-wedge400 (armv6l)
flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Using default 2000kHz clock. Use 'spispeed' parameter to override.
Found Micron/Numonyx/ST flash chip "N25Q128..3E" (16384 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.
real    2m26.096s
user    0m3.574s
sys     1m1.003s
root@fboss312097296-oob:~# time spi_util.sh read spi1 DOM_FPGA_FLASH1 fpga_r
Config SPI1 Done.
Reading flash to fpga_r...
flashrom v1.2 on Linux 5.15.27-wedge400 (armv6l)
flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Using default 2000kHz clock. Use 'spispeed' parameter to override.
Found Micron/Numonyx/ST flash chip "N25Q128..3E" (16384 kB, SPI) on linux_spi.
Reading flash... done.
real    0m58.793s
user    0m0.768s
sys     0m25.827s
root@fboss312097296-oob:~#  diff fpga fpga_r
root@fboss312097296-oob:~# echo $?
0
root@fboss312097296-oob:~# ls -l
-rw-r--r--    1 root     root      16777328 Jul 13 23:26 fpga
-rw-r--r--    1 root     root      16777328 Jul 13 23:34 fpga_r
root@fboss312097296-oob:~#

Reviewed By: tao-ren

fbshipit-source-id: f17923d12d5a685a9ed9fec98de3bcf41d58b14c
facebook-github-bot pushed a commit that referenced this issue Aug 12, 2022
Summary:
Enable SENSORS_NET_CASIC in wedge400 kconfig file because the Kconfig
entry is renamed in kernel 5.15.

Test Plan:
root@fboss311782522-oob:~# uname -a
Linux fboss311782522-oob.snc1.facebook.com 5.15.27-wedge400 #1 Thu Aug 11 22:20:52 UTC 2022 armv6l GNU/Linux
root@fboss311782522-oob:~# ls /sys/bus/i2c/drivers/net_casic/
3-002a  bind    module  uevent  unbind
root@fboss311782522-oob:~# ls /sys/bus/i2c/devices/3-002a/hwmon/hwmon24/
device        power         subsystem     temp11_input  temp1_input   temp3_input   temp5_input   temp7_input   temp9_input
name          sdk_status    temp10_input  temp12_input  temp2_input   temp4_input   temp6_input   temp8_input   uevent

Reviewed By: GoldenBug

fbshipit-source-id: 16647fb8a691b420f596709d25fbbcafaa62f6c0
facebook-github-bot pushed a commit that referenced this issue Aug 12, 2022
Summary:
Rename "net_asic" to "net_casic" in setup_i2c.sh because the driver name
is updated in kernel 5.15.

Test Plan:
root@fboss311782522-oob:~# uname -a
Linux fboss311782522-oob.snc1.facebook.com 5.15.27-wedge400 #1 Thu Aug 11 22:20:52 UTC 2022 armv6l GNU/Linux
root@fboss311782522-oob:~# ls /sys/bus/i2c/drivers/net_casic/
3-002a  bind    module  uevent  unbind
root@fboss311782522-oob:~# ls /sys/bus/i2c/devices/3-002a/hwmon/hwmon24/
device        power         subsystem     temp11_input  temp1_input   temp3_input   temp5_input   temp7_input   temp9_input
name          sdk_status    temp10_input  temp12_input  temp2_input   temp4_input   temp6_input   temp8_input   uevent

Reviewed By: GoldenBug

fbshipit-source-id: 98134c6b2f85fde90edd7c2dddc0434c26a5ffc1
facebook-github-bot pushed a commit that referenced this issue Aug 19, 2022
Summary:
I'd like to change QEMU so that we don't always have to add a new
machine type for this, but in the meantime, oh well.

Test Plan:
Can boot a `greatlakes` image with `fbqemu`:

```
$ fbqemu --bootargs "console=ttyS4,57600n8 root=/dev/ram rw vmalloc=384M"
Using /home/pdel/openbmc/build2/tmp/deploy/images/greatlakes/flash-greatlakes for primary and golden images.
Using /home/pdel/openbmc/build2/tmp/deploy/images/greatlakes/fitImage-obmc-phosphor-initramfs-greatlakes-greatlakes as FIT image.
Found FIT component kernel-1
Found FIT component fdt-aspeed-ast2600-evb.dtb
Found FIT component ramdisk-1
/home/pdel/openbmc/build2/tmp/work/x86_64-linux/fbqemu-native/0.1.0-r0/recipe-sysroot-native/usr/bin/qemu-system-arm \
  -machine greatlakes-bmc \
  -nographic \
  -drive file=/home/pdel/openbmc/build2/tmp/deploy/images/greatlakes/flash-greatlakes,format=raw,if=mtd,snapshot=on \
  -drive file=/home/pdel/openbmc/build2/tmp/deploy/images/greatlakes/flash-greatlakes,format=raw,if=mtd,snapshot=on \
  -kernel /tmp/.tmp6nG6LC \
  -dtb /tmp/.tmpbmYi1p \
  -initrd /tmp/.tmpSOtYyj \
  -append console=ttyS4,57600n8 root=/dev/ram rw vmalloc=384M
[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Linux version 5.15.61-3eec6f8 (oe-user@oe-host) (arm-fb-linux-gnueabi-gcc (GCC) 12.1.0, GNU ld (GNU Binutils) 2.38.20220623) #1 SMP Thu Aug
18 07:39:38 UTC 2022
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: AST2600 EVB
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0xfb000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node video, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0xfa000000, size 16 MiB
[    0.000000] OF: reserved mem: initialized node framebuffer, compatible id shared-dma-pool
[    0.000000] cma: Reserved 16 MiB at 0xf9000000
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000080000000-0x00000000e6ffffff]
[    0.000000]   HighMem  [mem 0x00000000e7000000-0x00000000ffffefff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
...
Facebook OpenBMC greatlakes-7270d32a24-dirty greatlakes ttyS4

greatlakes login:
```

Reviewed By: williamspatrick

fbshipit-source-id: 7c8b61c6397f94ef89919927b303baf9a9fb800b
facebook-github-bot pushed a commit that referenced this issue Oct 3, 2022
Summary: Delete "fbdarwin-image-layout.inc" because it's not used.

Test Plan:
1) "bitbake fbdarwin-image" succeeded.
2) /proc/mtd is correct in fbdarwin:

root@rsw048-oob:~# uname -a
Linux rsw048-oob.p106.f01.pnb6.tfbnw.net 5.15.67-fbdarwin #1 SMP Fri Sep 30 00:10:17 UTC 2022 armv7l GNU/Linux
root@rsw048-oob:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 000e0000 00010000 "u-boot"
mtd1: 00010000 00010000 "env"
mtd2: 00010000 00010000 "meta"
mtd3: 07700000 00010000 "fit"
mtd4: 00800000 00010000 "data0"
mtd5: 08000000 00010000 "flash0"
mtd6: 08000000 00010000 "flash1"

Reviewed By: mikechoifb

fbshipit-source-id: ef0c64c1778897b9e9120bf15a94f7b79101dc98
facebook-github-bot pushed a commit that referenced this issue Oct 3, 2022
Summary:
Remove find_serfmon.sh from setup_board.sh and create a separate service
to make sure "find_serfmon.sh" is executed after mount_data1.service.

Test Plan:
1) "bitbake fbdarwin-image" succeeded.
2) serfmon-cache service is launched at bootup: P534332368

root@rsw048-oob:~# uname -a
Linux rsw048-oob.p106.f01.pnb6.tfbnw.net 5.15.67-fbdarwin #1 SMP Fri Sep 30 00:10:17 UTC 2022 armv7l GNU/Linux
root@rsw048-oob:~# weutil chassis
Wedge EEPROM chassis:
Version: 0
Product Name: FBDARWIN
Product Part Number:
System Assembly Part Number:
Facebook PCBA Part Number:
Facebook PCB Part Number:
ODM PCBA Part Number: PCA000000000
ODM PCBA Serial Number:
Product Production State: 0
Product Version: 0
Product Sub-Version: 0
Product Serial Number: JPE22082514
Product Asset Tag:
System Manufacturer:
System Manufacturing Date:
PCB Manufacturer:
Assembled At:
Local MAC: C4:CA:2B:FF:F6:E2
Extended MAC Base: 00:00:00:00:00:00
Extended MAC Address Size: 0
Location on Fabric:
CRC8: 0x0

Reviewed By: mikechoifb

fbshipit-source-id: ddc54772ac21be6c6fd563ffa80405fd51f70aed
facebook-github-bot pushed a commit that referenced this issue Nov 1, 2022
Summary: Upgrade elbert to linux kernel 6.0.

Test Plan:
1) "bitbake elbert-image" succeeded.
2) booted up linux 6.0 on elbert successfully.

root@elbert-oob:~# weutil
Wedge EEPROM CHASSIS:
Version: 0
Product Name: ELBERT
Product Part Number: 7388
System Assembly Part Number: ASY051710202
Facebook PCBA Part Number:
Facebook PCB Part Number:
ODM PCBA Part Number: PCA014920102
ODM PCBA Serial Number:
Product Production State: 0
Product Version: 10
Product Sub-Version: 21
Product Serial Number: JAS20410295
Product Asset Tag:
System Manufacturer:
System Manufacturing Date: 2020111023
PCB Manufacturer:
Assembled At:
Local MAC: D4 (831f86385eb9a5ce47ff8ecbc38f50dfcd7ea5aa):AF:F7:30:B0:7A
Extended MAC Base: D4 (831f86385eb9a5ce47ff8ecbc38f50dfcd7ea5aa):AF:F7:30:AD:C1
Extended MAC Address Size: 139
Location on Fabric:
CRC8: 0x0
root@elbert-oob:~# uname -a
Linux elbert-oob.03.04.mpk17.fbinfra.net 6.0.2-elbert #1 SMP Mon Oct 17 07:24:51 UTC 2022 armv7l GNU/Linux
root@elbert-oob:~# df -h
Filesystem                Size      Used Available Use% Mounted on
devtmpfs                886.5M      2.3M    884.1M   0% /dev
tmpfs                   896.0M    112.0K    895.9M   0% /run
tmpfs                   896.0M      1.7M    894.3M   0% /var/volatile
/dev/mtdblock4            8.0M    436.0K      7.6M   5% /mnt/data
/dev/mmcblk0              7.1G    219.3M      6.5G   3% /mnt/data1
root@elbert-oob:~# uptime
 06:48:29 up  1:30,  load average: 0.40, 0.27, 0.20

Reviewed By: mikechoifb

fbshipit-source-id: fb76e2d4b4e14b977eac91d297adbe1e917b12ea
facebook-github-bot pushed a commit that referenced this issue Mar 3, 2023
Summary:
From the failing test's output:
```
Traceback (most recent call last):
  File "/dev/shm/uid-30041/6f04428b-seed-nspid4026532648_cgpid67954179-ns-4026532645/bmc/tools/cit/api_validation_tests/test_api_matches_schema.py", line 90, in test_legacy_endpoints_valid
    raise ValueError(
ValueError: REST output from GET /api/sys/bmc does not match schema defined in 'common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys/bmc.yml':
Output: {"Resources": [], "Actions": [], "Information": {"memory": {"Shmem": 324, "Buffers": 0, "Cached": 83732, "MemAvailable": 118168, "MemTotal": 242628, "MemFree": 117212}, "Description": "wedge100 BMC", "load-15": "0.86", "u-boot version": "2016.07", "uptime": "320.81", "OpenBMC Version": "2023.09.0", "mmc-info": {}, "CPU Usage": "CPU:  74% usr  26% sys   0% nic   0% idle   0% io   0% irq   0% sirq", "kernel version": "5.15.67-galaxy100 #1 Mon Feb 27 08:16:15 UTC 2023", "MTD Parts": ["u-boot", "env", "fit", "data0", "flash0", "flash1"], "At-Scale-Debug Running": false, "Secondary Boot Triggered": false, "MAC Addr": "00:E0:EC:62:A0:F6", "TPM FW version": "NA", "load-1": "2.01", "TPM TCG version": "NA", "Memory Usage": "Mem: 125416K used, 117212K free, 324K shrd, 0K buff, 83732K cached", "vboot": {"status": "-1", "status_text": "Unsupported"}, "Reset Reason": "Power ON Reset", "SPI0 Vendor": "Unknown", "load-5": "1.78", "open-fds": "374", "Uptime": "00:35:42 up 0:05:20, load average: 2.01, 1.78, 0.86", "SPI1 Vendor": "Unknown"}}
Schema errors:
'response':
    - 'body':
        - 'schema':
            - 'Information':
                - 'additionalProperties':
                    - "When `additionalProperties` is False, no unspecified properties are allowed. The following unspecified properties were found:
\t`{'mmc-info'}`"
Please fix incorrect endpoint/schema in 'common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys/bmc.yml' and run test again.'
```

Looks like the `mmc-info` property was missing from the schema, copied the `mmc-info` definition from [wedge100/api/sys/bmc.yml](https://www.internalfb.com/code/yocto-meta-openbmc/[helium%3A27b179715d77bd763927a9e02bc376c5d8374df2]/common/recipes-rest/rest-api/files/swagger/definitions/wedge100/api/sys/bmc.yml?lines=95-122)

Test Plan:
Reproduce [sandcastle command](https://www.internalfb.com/intern/sandcastle/job/36028797911535341/insights) locally adding `--bmc-root "$HOME/openbmc" --regex '.*test_legacy_endpoints_valid.*'` so it uses the local repo and only runs the relevant test:

```
cd $(mktemp -d) && \
fbpkg fetch neteng.netcastle.runner && \
./netcastle.par --team openbmcfb --purpose continuous --jobs 1 --test-config galaxy100 --fbpkg-name openbmc.image.backpack100_fc_lc:d84699df87d6cbc3b2a9615472439fb6 --platform galaxy100 --skip-filtering-by-test-stat --bmc-root "$HOME/openbmc" --regex '.*test_legacy_endpoints_valid.*'
```

Check log output for successful result:

```
2023/03/03 07:09:51.101|161658|MainThread|I|test_case: Test setUp for test_api_matches_schema.ApiValidator.test_legacy_endpoints_valid
2023/03/03 07:09:51.242|161658|MainThread|I|test_api_matches_schema: Running GET /api
2023-03-03 07:09:51,283 DEBUG Starting new HTTPS connection (1): fboss57874250-lc401-oob.snc1.facebook.com:8443
2023-03-03 07:09:52,266 DEBUG https://fboss57874250-lc401-oob.snc1.facebook.com:8443 "GET /api HTTP/1.1" 200 115
2023/03/03 07:09:52.270|161658|MainThread|I|test_api_matches_schema: Ran GET /api, output: {"Information": {"Description": "Wedge RESTful API Entry", "version": "v0.1"}, "Actions": [], "Resources": ["sys"]}
2023/03/03 07:09:52.271|161658|MainThread|I|test_api_matches_schema: Validating response from /api using common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api.yml
2023/03/03 07:09:52.299|161658|MainThread|I|test_api_matches_schema: Running GET /api/sys
2023-03-03 07:09:52,569 DEBUG https://fboss57874250-lc401-oob.snc1.facebook.com:8443 "GET /api/sys HTTP/1.1" 200 222
2023/03/03 07:09:52.569|161658|MainThread|I|test_api_matches_schema: Ran GET /api/sys, output: {"Information": {"Description": "Wedge System"}, "Actions": [], "Resources": ["bmc", "fc_present", "firmware_info", "fscd_sensor_data", "gpios", "i2cflush", "mb", "ntp", "psu_update", "sensors", "server", "usb2i2c_reset"]}
2023/03/03 07:09:52.570|161658|MainThread|I|test_api_matches_schema: Validating response from /api/sys using common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys.yml
2023/03/03 07:09:52.661|161658|MainThread|I|test_api_matches_schema: Running GET /api/sys/bmc
2023-03-03 07:09:53,862 DEBUG https://fboss57874250-lc401-oob.snc1.facebook.com:8443 "GET /api/sys/bmc HTTP/1.1" 200 1044
2023/03/03 07:09:53.863|161658|MainThread|I|test_api_matches_schema: Ran GET /api/sys/bmc, output: {"Information": {"uptime": "314.31", "SPI1 Vendor": "Unknown", "MTD Parts": ["u-boot", "env", "fit", "data0", "flash0", "flash1"], "kernel version": "5.15.67-galaxy100 #1 Mon Feb 27 08:16:15 UTC 2023", "SPI0 Vendor": "Unknown", "CPU Usage": "CPU:  80% usr  20% sys   0% nic   0% idle   0% io   0% irq   0% sirq", "Secondary Boot Triggered": false, "open-fds": "379", "OpenBMC Version": "2023.09.0", "load-1": "1.61", "TPM TCG version": "1.2", "mmc-info": {}, "memory": {"Buffers": 0, "Cached": 83724, "MemAvailable": 118456, "MemFree": 117404, "Shmem": 328, "MemTotal": 242628}, "TPM FW version": "133.32", "u-boot version": "2016.07", "Uptime": "07:09:53 up 0:05:14, load average: 1.61, 1.68, 0.81", "load-5": "1.68", "Reset Reason": "Power ON Reset", "Description": "wedge100 BMC", "vboot": {"status_text": "Unsupported", "status": "-1"}, "At-Scale-Debug Running": false, "Memory Usage": "Mem: 125224K used, 117404K free, 328K shrd, 0K buff, 83724K cached", "load-15": "0.81", "MAC Addr": "00:E0:EC:6C:5E:10"}, "Actions": [], "Resources": []}
2023/03/03 07:09:53.863|161658|MainThread|I|test_api_matches_schema: Validating response from /api/sys/bmc using common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys/bmc.yml
2023/03/03 07:09:53.884|161658|MainThread|I|test_api_matches_schema: Running GET /api/sys/fc_present
2023-03-03 07:09:54,774 DEBUG https://fboss57874250-lc401-oob.snc1.facebook.com:8443 "GET /api/sys/fc_present HTTP/1.1" 200 176
2023/03/03 07:09:54.775|161658|MainThread|I|test_api_matches_schema: Ran GET /api/sys/fc_present, output: {"Information": {"Description": "Slotid indicates monitored slotid's status", "Monitored Slotid": 0, "Status": "Not Applicable", "Slotid": 401}, "Actions": [], "Resources": []}
2023/03/03 07:09:54.775|161658|MainThread|I|test_api_matches_schema: Validating response from /api/sys/fc_present using common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys/fc_present.yml
2023/03/03 07:09:54.796|161658|MainThread|I|test_api_matches_schema: Running GET /api/sys/firmware_info
2023-03-03 07:09:57,928 DEBUG https://fboss57874250-lc401-oob.snc1.facebook.com:8443 "GET /api/sys/firmware_info HTTP/1.1" 200 141
2023/03/03 07:09:57.929|161658|MainThread|I|test_api_matches_schema: Ran GET /api/sys/firmware_info, output: {"SYS_CPLD": {"sub_version": 8, "version": 16}, "SCM_CPLD": {"sub_version": 3, "version": 17}, "QSFP_CPLD": {"sub_version": 1, "version": 1}}
2023/03/03 07:09:57.929|161658|MainThread|I|test_api_matches_schema: Validating response from /api/sys/firmware_info using common/recipes-rest/rest-api/files/swagger/definitions/backpack100_fc_lc/api/sys/firmware_info.yml
2023/03/03 07:09:57.941|161658|MainThread|I|test_case: Test tearDown for test_api_matches_schema.ApiValidator.test_legacy_endpoints_valid
2023/03/03 07:09:57.941|161658|MainThread|I|test_case: Finished test: test_api_matches_schema.ApiValidator.test_legacy_endpoints_valid
2023/03/03 07:09:58.242|161658|MainThread|I|test_case: Test output has been everpasted (https://www.internalfb.com/intern/everpaste/?color=1&handle=GGTauAj85vKHXJgCADdCIiZCB3AZbr0LAAAz)
```

Reviewed By: doranand

Differential Revision: D43748525

fbshipit-source-id: aa758bba4e852e9e1e787cb40ff558613c221018
facebook-github-bot pushed a commit that referenced this issue Mar 29, 2023
Summary:
Upgrade CMM OpenBMC kernel from 6.0.% to 6.1.%.

Update the return type of i2c client drivers' remove method from "int"
to "void" due to the driver API changes between linux 6.0 and 6.1.

Test Plan:
1) "bitbake cmm-image" succeeded.
2) Linux 6.1 booted up on CMM successfully: P670196005
3) ondiff CIT passed.
4) Out of tree kernel modules are loaded successfully:

root@fboss139088541-mm001-oob:~# uname -a
Linux fboss139088541-mm001-oob.snc1.facebook.com 6.1.12-cmm #1 Tue Feb 21 11:26:10 UTC 2023 armv6l GNU/Linux
root@fboss139088541-mm001-oob:~# ls /sys/bus/i2c/drivers/cmmcpld/
13-003e  bind     module   uevent   unbind
root@fboss139088541-mm001-oob:~# cat /sys/bus/i2c/devices/13-003e/cpld_ver
0x2

Note:

Bit[5:0] @ register 0x1, register value 0x2
root@fboss139088541-mm001-oob:~# ls /sys/bus/i2c/drivers/fancpld/
171-0033  179-0033  187-0033  195-0033  bind      module    uevent    unbind
root@fboss139088541-mm001-oob:~# cat /sys/bus/i2c/devices/195-0033/cpld_ver
0x3

Note:

Bit[5:0] @ register 0x1, register value 0x3

Reviewed By: Scott8440

Differential Revision: D44481633

fbshipit-source-id: 4a4a9a01bc2e669012df7b616cdea7dc7e25ffa7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants