tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sysctl question

As I indicated yesterday, I'm writing a device driver for on-DIMM memory temp sensors (such as those on DDR2 FB-DIMM, some DDR2 SORDIMM, and all DDR3). The sensors have hardware limit registers for lower, upper, and critical temp limits.

sysmon_envsys(9) doesn't seem to provide a mechanism for the limits to be set from userland, so I need some other way to get values into the registers. I've thought of three ways to do this:

        1. Hardcode the limits in the driver, and don't provide any way
           to change them.

        2. Modify sysmon_envsys to add a new mechanism

        3. Add a sysctl to the driver for specifying the limits

#1 seems rather restrictive and makes it difficult to adjust the limits for testing the driver.

#2 is a whole lot more work than I'm ready to sign up for at this time!

So that leaves #3.

Adding the sysctl itself is relatively straightforward. But there's a catch!

I need to use a sysctl helper function to validate the user-specified value, and then stuff it into the device's registers. The helper itself is once again relatively straightforward, except that it needs to find the dev_t->softc in order to update the hardware.

Any suggestions on an acceptable mechanism for associating the sysctl node with the device's dev_t ?

|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 |   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | |

Home | Main Index | Thread Index | Old Index