Page MenuHomeFreeBSD

[aacraid] Port driver to big-endian
ClosedPublic

Authored by luporl on Feb 28 2020, 7:37 PM.
Referenced Files
Unknown Object (File)
Thu, Mar 28, 9:00 PM
Unknown Object (File)
Feb 24 2024, 9:23 AM
Unknown Object (File)
Feb 24 2024, 9:23 AM
Unknown Object (File)
Feb 24 2024, 9:23 AM
Unknown Object (File)
Feb 24 2024, 9:23 AM
Unknown Object (File)
Feb 23 2024, 12:19 PM
Unknown Object (File)
Jan 21 2024, 5:41 PM
Unknown Object (File)
Dec 20 2023, 7:25 AM

Details

Summary

Port aacraid driver to big-endian (BE) hosts.

The immediate goal of this change is to make it possible to use the
aacraid driver on PowerPC64 machines that have Adaptec Series 8 SAS
controllers.

Adapters supported by this driver expect FIB contents in little-endian
(LE) byte order. All FIBs have a fixed header part as well as a data
part that depends on the command being issued to the controller.

In this way, on BE hosts, the FIB header and all FIB data structures
used in aacraid.c and aacraid_cam.c need to be converted to LE before
being sent to the adapter and converted to BE when coming from it.

The functions to convert each struct are on aacraid_be.c.
For little-endian (LE) targets, they are macros that expand
to nothing.
In some cases, when only a few fields of a large structure are used,
the fields are converted inline, by the code using them.

Test Plan

This change, along with D23667, D23668, and D23859, was tested on FreeBSD's power9-devref machine, that has an Adaptec Series 8 SAS controller attached.
The plan is to also test this on Talos II machines, such as the one in PR 237463 was discovered.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29726
Build 27567: arc lint + arc unit

Event Timeline

  • enable aacraid module for powerpc
  • add aacraid_be.c in aacraid module's src list
jhibbits added inline comments.
sys/dev/aacraid/aacraid_be.h
1

I would name this aacraid_endian.h, or aacraid_fib_endian.h, or similar, along with the accompanying .c file.

sys/modules/aacraid/Makefile
10

I think aacraid_be.c is only needed for big endian platforms, so can be guarded with a MACHINE_CPUARCH == powerpc check (could add mips, too, but who uses mips with aacraid...)

luporl added a reviewer: jhibbits.

Address review's comments

  • renamed aacraid_be.[ch] to aacraid_endian.[ch]
  • moved aacraid_endian.c to conf/files.powerpc
  • moved aacraid device from amd64/conf/NOTES to conf/NOTES
  • include aacraid_endian.c in aacraid.ko for powerpc only
  • added device aacraid to powerpc/conf/GENERIC64, to be able to boot PowerNV machines from aacraid attached disks
This revision is now accepted and ready to land.Mar 4 2020, 9:16 PM

I did not review in detail but no objection from me, and the approach seems reasonable.

This revision was automatically updated to reflect the committed changes.