Page MenuHomeFreeBSD

mpi3mr V3 : Add mpi3mr Driver to sys/conf/files and GENERIC file for Kernel Inclusion
ClosedPublic

Authored by chandrakanth.patil_broadcom.com on Apr 10 2025, 6:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 5:01 AM
Unknown Object (File)
Mon, Sep 29, 12:51 PM
Unknown Object (File)
Thu, Sep 18, 12:53 AM
Unknown Object (File)
Sep 10 2025, 9:53 PM
Unknown Object (File)
Sep 4 2025, 1:15 PM
Unknown Object (File)
Aug 29 2025, 4:11 AM
Unknown Object (File)
Aug 28 2025, 2:50 PM
Unknown Object (File)
Aug 28 2025, 5:07 AM
Subscribers
None

Details

Summary

Registered the mpi3mr driver source files in sys/conf/files, enabling
it to be compiled into the base kernel image. This matches the approach
used for existing Broadcom drivers such as mrsas, mps, and mpr.

Also updated sys/conf/NOTES with an entry for the mpi3mr driver.

With this change, the mpi3mr driver will be built as part of the base
kernel, allowing automatic loading during boot when supported hardware
is detected.

Below changes are suggested by Chuck.

Changes from V1 to V2:

  • Corrected the file name typo mistake in /sys/conf/files from mpi3mr_app.c.c to mpi3mr_app.c
  • Added mpi3mr driver entries in "sys/amd64/conf/GENERIC" and "sys/i386/conf/GENERIC"

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

in addition the changes you have here already, you'll also need to add the same line that you added to sys/conf/NOTES to sys/amd64/conf/GENERIC and sys/i386/conf/GENERIC.

sys/conf/files
2470

looks like a typo... should be mpi3mr_app.c rather than mpi3mr_app.c.c

chandrakanth.patil_broadcom.com retitled this revision from mpi3mr: Add mpi3mr Driver to sys/conf/files for Kernel Inclusion to mpi3mr V2 : Add mpi3mr Driver to sys/conf/files and GENERIC file for Kernel Inclusion.Apr 10 2025, 4:41 PM
chandrakanth.patil_broadcom.com edited the summary of this revision. (Show Details)

Below changes are suggested by Chuck.

Changes from V1 to V2:

  • Corrected the file name typo mistake in /sys/conf/files from mpi3mr_app.c.c to mpi3mr_app.c
  • Added mpi3mr driver entries in "sys/amd64/conf/GENERIC" and "sys/i386/conf/GENERIC"
In D49754#1134431, @chs wrote:

in addition the changes you have here already, you'll also need to add the same line that you added to sys/conf/NOTES to sys/amd64/conf/GENERIC and sys/i386/conf/GENERIC.

I have updated the new patch with mpi3mr entries in suggested GENERIC files

sys/conf/files
2470

yes, it is typo. Thanks for catching it.

I tried building with the new patch and found more problems:

  • mpi3mr_cam.c uses some linux kernel interfaces and so that entry in sys/conf/files for that source file needs to have this added at the end of the line: compile-with "${LINUXKPI_C}"
  • there are a bunch of compile errors when building for i386 (aka. 32-bit x86). most of the errors are just mismatches between printf format strings and the corresponding values, and those would be easy to fix, but there are some that might be harder to fix. mpi3mr.h defines mpi3mr_regread64() and mpi3mr_regwrite64() that use bus_space_read_8() and bus_space_write_8() to access 64-bit registers in the card, but 32-bit x86 hardware does not have the ability to do 64-bit reads and writes. if these accesses really have to be 64-bit accesses then this card just can't work on 32-bit x86. but if the 64 bits can be read or written as two 32-bit values then the driver could do that instead of one 64-bit read or write. or, if you don't care about 32-bit x86 then the simplest thing would just be to leave out this change to sys/i386/conf/GENERIC.
In D49754#1134464, @chs wrote:

I tried building with the new patch and found more problems:

  • mpi3mr_cam.c uses some linux kernel interfaces and so that entry in sys/conf/files for that source file needs to have this added at the end of the line: compile-with "${LINUXKPI_C}"
  • there are a bunch of compile errors when building for i386 (aka. 32-bit x86). most of the errors are just mismatches between printf format strings and the corresponding values, and those would be easy to fix, but there are some that might be harder to fix. mpi3mr.h defines mpi3mr_regread64() and mpi3mr_regwrite64() that use bus_space_read_8() and bus_space_write_8() to access 64-bit registers in the card, but 32-bit x86 hardware does not have the ability to do 64-bit reads and writes. if these accesses really have to be 64-bit accesses then this card just can't work on 32-bit x86. but if the 64 bits can be read or written as two 32-bit values then the driver could do that instead of one 64-bit read or write. or, if you don't care about 32-bit x86 then the simplest thing would just be to leave out this change to sys/i386/conf/GENERIC.

I will add the LINUXKPI_C for mpi3mr_cam.c in sys/conf/files and upload the updated patch.
Can we skip adding support for i386 now.

chandrakanth.patil_broadcom.com retitled this revision from mpi3mr V2 : Add mpi3mr Driver to sys/conf/files and GENERIC file for Kernel Inclusion to mpi3mr V3 : Add mpi3mr Driver to sys/conf/files and GENERIC file for Kernel Inclusion.
  • Added compile-with "${LINUXKPI_C}" for mpi3mr_cam.c
  • Removed the mpi3mr entry from "sys/i386/conf/GENERIC"
This revision is now accepted and ready to land.Apr 10 2025, 11:37 PM

Thank you check for reviewing and suggesting the required changes.

Can we skip adding support for i386 now.

Yes. It's not needed and doesn't work...

Should you include this for aarch64? Or is that not supported by broadcomm yet?

In D49754#1134788, @imp wrote:

Should you include this for aarch64? Or is that not supported by broadcomm yet?

Driver does not support aarch64 platform.