Page MenuHomeFreeBSD

Introduce sim_dev and cam_sim_alloc_dev().
ClosedPublic

Authored by bz on Mar 29 2019, 9:46 AM.

Details

Summary

Introduce sim_dev and cam_sim_alloc_dev().

Add cam_sim_alloc_dev() as a wrapper to cam_sim_alloc() which takes
a device_t instead of the unit_number (which we can derive from the
dev again).

Add device_t sim_dev to struct cam_sim. It will be used to pass through
the bus for cases when both sides of CAM speak newbus already and we want
to link them (yet make the calls through CAM for now).

SDIO will be the first consumer of this. For that make use of
cam_sim_alloc_dev() in sdhci under MMCCAM.

This will also allow people to start iterating more on the idea
to newbus-ify CAM without changing 50+ device drivers from the start.
Also to be clear there are callers to cam_sim_alloc() which do not
have a device_t (e.g., XPT) or provide their own unit number so we cannot
simply switch the KPI entirely.

Submitted by: kibab (original idea, see D12467)
Sponsored by: The FreeBSD Foundation
MFC After: 2 weeks

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz created this revision.Mar 29 2019, 9:46 AM
bz updated this revision to Diff 55655.Mar 31 2019, 7:31 PM

Use the correct field `sim_dev`` not `sim``.
Last minute cleanup changes are never a good idea without compiling/booting them,

bz added a comment.Jun 1 2019, 5:45 PM

I'd like to commit this the next days. Can someone please review? If not it'll go in by Sat 8 June.

chuck added a subscriber: chuck.Jun 4 2019, 5:08 PM

The change looks reasonable to me. Are there any ABI issues with changing the size of struct cam_sim?

imp accepted this revision.Jun 4 2019, 10:58 PM
This revision is now accepted and ready to land.Jun 4 2019, 10:58 PM
imp added a comment.Jun 4 2019, 11:02 PM

The change looks reasonable to me. Are there any ABI issues with changing the size of struct cam_sim?

I think that's fine. The size of cam_sim is known only to cam_alloc_sim functions.

This revision was automatically updated to reflect the committed changes.