Page MenuHomeFreeBSD

Make miibus.ko module on par with using 'device miibus' in kernel config
ClosedPublic

Authored by bsd_dino.sk on Feb 12 2022, 8:15 AM.

Details

Summary

As of today, git revision 39a36707bd33b86a115651678028baeb616c8365, using 'kldload miibus' is not equivalent to using 'device miibus' in kernel config. Newly introduced PHY drivers are missing (DP83822, DP83867, VSCPHY) and source files/PHY driver for FDT enabled kernels only are missing. Without including them, kernel modules using any function from dev/mii/mii_fdt.c refuse load (searching in sources, this should be if_dws.ko and if_ffec.ko, driver for genet device has no kernel module Makefile in main repository, also locally used module for cgem driver modified to use connection type is the same case).
PolarFire SoC hardware sponsored by Conclusive Engineering

Test Plan

Checked locally on Zybo Z7 board (arm architecture) with if_cgem.ko module, also on PolarFire SoC based RCHD-PF board from Conclusive Engineering (riscv architecture) with the same module, module loads and works

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

Original patch missed inclusion of VSCPHY driver, corrected here.

I think it might be better to keep the file sorted the way it was before this change.
This will make this patch much easier to read.

In order to test the changes I'd recommend to do the following:

  1. Set MAKEOBJDIRPREFIX, TARGET, etc.
  2. make buildenv
  3. cd sys/modules/mii
  4. make

This way you'll check if the standalone build works.

sys/modules/mii/Makefile
16

I think you've missed ofw_bus_if.h, it's needed to build mii_fdt.c.
It should be added under the OPT_FDT umbrella.

In D34256#775528, @mindal_semihalf.com wrote:

I think it might be better to keep the file sorted the way it was before this change.
This will make this patch much easier to read.

I partially disagree, but accept. Next try comes without this. I feel, however, some logical grouping could be usefull. How to achieve this?

In order to test the changes I'd recommend to do the following:

  1. Set MAKEOBJDIRPREFIX, TARGET, etc.
  2. make buildenv
  3. cd sys/modules/mii
  4. make

This way you'll check if the standalone build works.

... but only without options. I found with plain make module is build without FDT dependent sources. I can use 'env OPT_FDT=yes make' but I am not sure it does what I need...

sys/modules/mii/Makefile
16

I think so as well, testing...

Minimal diff with new files added at the end.

Testing with 'make buildenv' revealed opt_platform.h is necessary as well. As part of normal buildkernel, this file is already created.

New revision is just being created, https://reviews.freebsd.org/D34687, for building if_cgem.ko kernel module, used to test changes proposed here for miibus.ko kernel module

mhorne added a subscriber: mhorne.

Tested on my HiFive Unmatched with the if_cgem driver.

@mindal_semihalf.com are you happy with the changes?

sys/modules/mii/Makefile
15

The source files are listed alphabetically, so these should be added in the same manner. I can take care of this before committing.

This revision is now accepted and ready to land.Mar 30 2022, 8:44 PM
sys/modules/mii/Makefile
15

Original patch was sorted alphabetically, maybe you could check it. Just FYI.

@mindal_semihalf.com are you happy with the changes?

LGTM

This revision was automatically updated to reflect the committed changes.