diff options
author | Robert Wing <rew@FreeBSD.org> | 2024-02-01 02:33:05 +0000 |
---|---|---|
committer | Robert Wing <rew@FreeBSD.org> | 2024-02-01 02:33:05 +0000 |
commit | d9b3bba2f3022f1b577fb7a18c523c92551d8257 (patch) | |
tree | 483d0fde933a475776b3ed71b85aa1f07bcadfa4 /sys/dev/mpr | |
parent | 2c191ba6b0b5d1b3729a5ac428d51cfc5d5f3d2e (diff) | |
download | src-d9b3bba2f3022f1b577fb7a18c523c92551d8257.tar.gz src-d9b3bba2f3022f1b577fb7a18c523c92551d8257.zip |
mpr: endianess fix for set/get dpm page0
Reviewed by: oshogbo, imp
Sponsored by: Klara, Inc.
Sponsored by: Datazap
Differential Revision: https://reviews.freebsd.org/D43505
Diffstat (limited to 'sys/dev/mpr')
-rw-r--r-- | sys/dev/mpr/mpr_config.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/dev/mpr/mpr_config.c b/sys/dev/mpr/mpr_config.c index 768f69cdc89f..b7882feed158 100644 --- a/sys/dev/mpr/mpr_config.c +++ b/sys/dev/mpr/mpr_config.c @@ -547,8 +547,8 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; request->Header.PageNumber = 0; request->ExtPageLength = request->Header.PageVersion = 0; - request->PageAddress = sc->max_dpm_entries << - MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; + request->PageAddress = htole32(sc->max_dpm_entries << + MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); @@ -597,8 +597,8 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; request->Header.PageNumber = 0; request->Header.PageVersion = mpi_reply->Header.PageVersion; - request->PageAddress = sc->max_dpm_entries << - MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; + request->PageAddress = htole32(sc->max_dpm_entries << + MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT); request->ExtPageLength = mpi_reply->ExtPageLength; cm->cm_length = le16toh(request->ExtPageLength) * 4; cm->cm_sge = &request->PageBufferSGE; @@ -684,9 +684,8 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; request->Header.PageNumber = 0; request->ExtPageLength = request->Header.PageVersion = 0; - /* We can remove below two lines ????*/ - request->PageAddress = 1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; - request->PageAddress |= htole16(entry_idx); + request->PageAddress = htole32( + (1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT) | entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); @@ -736,8 +735,8 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageNumber = 0; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->ExtPageLength = mpi_reply->ExtPageLength; - request->PageAddress = 1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; - request->PageAddress |= htole16(entry_idx); + request->PageAddress = htole32( + (1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT) | entry_idx); cm->cm_length = le16toh(mpi_reply->ExtPageLength) * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); |