mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
disks: nvme related fixes
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
0a1a62f13f
commit
b464f5c077
@ -162,20 +162,8 @@ function dtModel() {
|
|||||||
echo " compatible = \"Synology\";" >>${DEST}
|
echo " compatible = \"Synology\";" >>${DEST}
|
||||||
echo " model = \"${UNIQUE}\";" >>${DEST}
|
echo " model = \"${UNIQUE}\";" >>${DEST}
|
||||||
echo " version = <0x01>;" >>${DEST}
|
echo " version = <0x01>;" >>${DEST}
|
||||||
|
echo " power_limit = \"\";" >>${DEST}
|
||||||
|
|
||||||
# NVME power_limit
|
|
||||||
POWER_LIMIT=""
|
|
||||||
NVME_PORTS=$(ls /sys/class/nvme 2>/dev/null | wc -w)
|
|
||||||
for I in $(seq 0 $((${NVME_PORTS} - 1))); do
|
|
||||||
[ ${I} -eq 0 ] && POWER_LIMIT="100" || POWER_LIMIT="${POWER_LIMIT},100"
|
|
||||||
done
|
|
||||||
if [ -n "${POWER_LIMIT}" ]; then
|
|
||||||
echo " power_limit = \"${POWER_LIMIT}\";" >>${DEST}
|
|
||||||
fi
|
|
||||||
if [ ${NVME_PORTS} -gt 0 ]; then
|
|
||||||
_set_conf_kv rd "supportnvme" "yes"
|
|
||||||
_set_conf_kv rd "support_m2_pool" "yes"
|
|
||||||
fi
|
|
||||||
# SATA ports
|
# SATA ports
|
||||||
if [ "${1}" = "true" ]; then
|
if [ "${1}" = "true" ]; then
|
||||||
I=1
|
I=1
|
||||||
@ -276,7 +264,8 @@ function dtModel() {
|
|||||||
echo "maxdisks=${MAXDISKS}"
|
echo "maxdisks=${MAXDISKS}"
|
||||||
|
|
||||||
# NVME ports
|
# NVME ports
|
||||||
COUNT=1
|
COUNT=0
|
||||||
|
POWER_LIMIT=""
|
||||||
for P in $(ls -d /sys/block/nvme* 2>/dev/null); do
|
for P in $(ls -d /sys/block/nvme* 2>/dev/null); do
|
||||||
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
||||||
echo "bootloader: ${P}"
|
echo "bootloader: ${P}"
|
||||||
@ -284,17 +273,24 @@ function dtModel() {
|
|||||||
fi
|
fi
|
||||||
PCIEPATH=$(grep 'pciepath' ${P}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
PCIEPATH=$(grep 'pciepath' ${P}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
if [ -n "${PCIEPATH}" ]; then
|
if [ -n "${PCIEPATH}" ]; then
|
||||||
|
COUNT=$((${COUNT} + 1))
|
||||||
echo " nvme_slot@${COUNT} {" >>${DEST}
|
echo " nvme_slot@${COUNT} {" >>${DEST}
|
||||||
echo " pcie_root = \"${PCIEPATH}\";" >>${DEST}
|
echo " pcie_root = \"${PCIEPATH}\";" >>${DEST}
|
||||||
echo " port_type = \"ssdcache\";" >>${DEST}
|
echo " port_type = \"ssdcache\";" >>${DEST}
|
||||||
echo " };" >>${DEST}
|
echo " };" >>${DEST}
|
||||||
COUNT=$((${COUNT} + 1))
|
POWER_LIMIT="${POWER_LIMIT},100"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
[ -n "${POWER_LIMIT:1}" ] && sed -i "s/power_limit = .*/power_limit = \"${POWER_LIMIT:1}\";/" ${DEST} || sed -i '/power_limit/d' ${DEST}
|
||||||
|
if [ ${COUNT} -gt 0 ]; then
|
||||||
|
_set_conf_kv rd "supportnvme" "yes"
|
||||||
|
_set_conf_kv rd "support_m2_pool" "yes"
|
||||||
|
fi
|
||||||
|
|
||||||
# USB ports
|
# USB ports
|
||||||
COUNT=1
|
COUNT=0
|
||||||
for I in $(getUsbPorts); do
|
for I in $(getUsbPorts); do
|
||||||
|
COUNT=$((${COUNT} + 1))
|
||||||
echo " usb_slot@${COUNT} {" >>${DEST}
|
echo " usb_slot@${COUNT} {" >>${DEST}
|
||||||
echo " usb2 {" >>${DEST}
|
echo " usb2 {" >>${DEST}
|
||||||
echo " usb_port =\"${I}\";" >>${DEST}
|
echo " usb_port =\"${I}\";" >>${DEST}
|
||||||
@ -303,7 +299,6 @@ function dtModel() {
|
|||||||
echo " usb_port =\"${I}\";" >>${DEST}
|
echo " usb_port =\"${I}\";" >>${DEST}
|
||||||
echo " };" >>${DEST}
|
echo " };" >>${DEST}
|
||||||
echo " };" >>${DEST}
|
echo " };" >>${DEST}
|
||||||
COUNT=$((${COUNT} + 1))
|
|
||||||
done
|
done
|
||||||
echo "};" >>${DEST}
|
echo "};" >>${DEST}
|
||||||
fi
|
fi
|
||||||
@ -337,10 +332,8 @@ function nondtModel() {
|
|||||||
MAXDISKS=$(($(_get_conf_kv maxdisks)))
|
MAXDISKS=$(($(_get_conf_kv maxdisks)))
|
||||||
printf "get maxdisks=%d\n" "${MAXDISKS}"
|
printf "get maxdisks=%d\n" "${MAXDISKS}"
|
||||||
else
|
else
|
||||||
[ ${MAXDISKS} -gt 26 ] && MAXDISKS=26
|
|
||||||
printf "cal maxdisks=%d\n" "${MAXDISKS}"
|
printf "cal maxdisks=%d\n" "${MAXDISKS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _check_post_k "rd" "usbportcfg"; then
|
if _check_post_k "rd" "usbportcfg"; then
|
||||||
USBPORTCFG=$(($(_get_conf_kv usbportcfg)))
|
USBPORTCFG=$(($(_get_conf_kv usbportcfg)))
|
||||||
printf 'get usbportcfg=0x%.2x\n' "${USBPORTCFG}"
|
printf 'get usbportcfg=0x%.2x\n' "${USBPORTCFG}"
|
||||||
|
Loading…
Reference in New Issue
Block a user