diff --git a/sys/dev/ufshci/ufshci.h b/sys/dev/ufshci/ufshci.h --- a/sys/dev/ufshci/ufshci.h +++ b/sys/dev/ufshci/ufshci.h @@ -644,6 +644,14 @@ typedef void (*ufshci_cb_fn_t)(void *, const struct ufshci_completion *, bool); +/* UFS 4.1, section 10.8.5 "Well Known Logical Unit Defined in UFS" */ +enum ufshci_well_known_luns { + UFSHCI_WLUN_REPORT_LUNS = 0x81, + UFSHCI_WLUN_BOOT = 0xb0, + UFSHCI_WLUN_RPMB = 0xc4, + UFSHCI_WLUN_UFS_DEVICE = 0xd0, +}; + /* * UFS Spec 4.1, section 14.1 "UFS Descriptors" * All descriptors use big-endian byte ordering. diff --git a/sys/dev/ufshci/ufshci_pci.c b/sys/dev/ufshci/ufshci_pci.c --- a/sys/dev/ufshci/ufshci_pci.c +++ b/sys/dev/ufshci/ufshci_pci.c @@ -50,7 +50,8 @@ uint32_t quirks; } pci_ids[] = { { 0x131b36, "QEMU UFS Host Controller", UFSHCI_REF_CLK_19_2MHz, UFSHCI_QUIRK_IGNORE_UIC_POWER_MODE | - UFSHCI_QUIRK_NOT_SUPPORT_ABORT_TASK }, + UFSHCI_QUIRK_NOT_SUPPORT_ABORT_TASK | + UFSHCI_QUIRK_SKIP_WELL_KNOWN_LUNS }, { 0x98fa8086, "Intel Lakefield UFS Host Controller", UFSHCI_REF_CLK_19_2MHz, UFSHCI_QUIRK_LONG_PEER_PA_TACTIVATE | diff --git a/sys/dev/ufshci/ufshci_private.h b/sys/dev/ufshci/ufshci_private.h --- a/sys/dev/ufshci/ufshci_private.h +++ b/sys/dev/ufshci/ufshci_private.h @@ -266,6 +266,8 @@ 8 /* Need to change the number of lanes before changing HS-GEAR. */ #define UFSHCI_QUIRK_NOT_SUPPORT_ABORT_TASK \ 16 /* QEMU does not support Task Management Request */ +#define UFSHCI_QUIRK_SKIP_WELL_KNOWN_LUNS \ + 32 /* QEMU does not support Well known logical units*/ uint32_t ref_clk; diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c --- a/sys/dev/ufshci/ufshci_sim.c +++ b/sys/dev/ufshci/ufshci_sim.c @@ -231,11 +231,15 @@ return; case XPT_PATH_INQ: { struct ccb_pathinq *cpi = &ccb->cpi; + uint32_t need_scan_wluns = 0; + + if (!(ctrlr->quirks & UFSHCI_QUIRK_SKIP_WELL_KNOWN_LUNS)) + need_scan_wluns = PIM_WLUNS; cpi->version_num = 1; cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE; cpi->target_sprt = 0; - cpi->hba_misc = PIM_UNMAPPED | PIM_NO_6_BYTE; + cpi->hba_misc = need_scan_wluns | PIM_UNMAPPED | PIM_NO_6_BYTE; cpi->hba_eng_cnt = 0; cpi->max_target = 0; cpi->max_lun = ctrlr->max_lun_count;