aboutsummaryrefslogtreecommitdiffstats
path: root/dmcub/fetch_ref.sh
blob: dda770b45ddc4adeedb18e336d65c61976893429 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# Re-fetch the reference sources used by the DMCUB analysis. Not tracked: these
# are upstream kernel files (1.7 MB), regenerable, and not our work.
#
#   ref/dcn_3_2_0_offset.h  AMD register offsets for DCN 3.2 (Navi 31)
#   ref/dcn_3_2_0_sh_mask.h bitfield shifts/masks (needed by hw/dmcub_hwregs.py)
#   ref/dmub_cmd.h          the host<->DMCUB command ABI
#   ref/dmub_cmd_v6.17.h    same, pinned PRE-deprecation (see the note below)
#
# NOTE, load-bearing: upstream commit 9a591ae691b5 ("[FW Promotion] Release
# 0.1.63.0", 2026-06-05) DELETED command IDs 1-4 (DMUB_CMD__REG_SEQ_*,
# DMUB_CMD__REG_REG_WAIT) from `enum dmub_cmd_type` and added "command IDs 1-4
# have been deprecated" -- in an enum whose own comment says "Command IDs should
# be treated as stable ABI. Do not reuse or modify IDs." They were documented in
# every release from v5.6 through v6.18-rc1, and **every DMUB image in fw/ still
# implements and dispatches them**, including DCN 4.0.1 (fw 10.0.4352).
#
# Fetching only master therefore makes types 1/3/4 look unpublished, which is
# exactly the wrong conclusion and is how this tree mislabelled them once. The
# pinned v6.17 copy is what the analysis tools should name IDs from.
#   ref/dmub_srv.c          loader: window bases, meta lookup, PSP footer
#   ref/dmub_dcn32.c        DCN 3.2 specific setup (DMCUB_SEC_CNTL, windows)
set -e
cd "$(dirname "$0")"
mkdir -p ref
K=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain
D=drivers/gpu/drm/amd
for p in \
  "$D/include/asic_reg/dcn/dcn_3_2_0_offset.h" \
  "$D/include/asic_reg/dcn/dcn_3_2_0_sh_mask.h" \
  "$D/display/dmub/inc/dmub_cmd.h" \
  "$D/display/dmub/src/dmub_srv.c" \
  "$D/display/dmub/src/dmub_dcn32.c" ; do
  echo "fetch $(basename "$p")"
  curl -sS -f -o "ref/$(basename "$p")" "$K/$p"
done

# Pinned pre-deprecation ABI, so IDs 1-4 still have names. See the note above.
echo "fetch dmub_cmd_v6.17.h (pinned, pre-deprecation)"
curl -sS -f -o ref/dmub_cmd_v6.17.h \
  "https://raw.githubusercontent.com/torvalds/linux/v6.17/$D/display/dmub/inc/dmub_cmd.h"

# The firmware images themselves (if fw/ was cleaned):
#   for f in $(sed -n 's#.*dmcub/fw/##p' ../data/MANIFEST.sha256); do
#     curl -sS -f -O --output-dir fw \
#       "https://gitlab.com/kernel-firmware/linux-firmware/-/raw/main/amdgpu/$f"
#   done