Page MenuHomeFreeBSD

INTRNG generalization step 2 - extending struct resource
ClosedPublic

Authored by skra on May 29 2016, 3:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 12:41 PM
Unknown Object (File)
Feb 10 2024, 6:02 PM
Unknown Object (File)
Dec 20 2023, 12:16 AM
Unknown Object (File)
Nov 20 2023, 2:04 PM
Unknown Object (File)
Nov 13 2023, 12:09 PM
Unknown Object (File)
Nov 11 2023, 5:00 AM
Unknown Object (File)
Nov 10 2023, 10:23 AM
Unknown Object (File)
Nov 10 2023, 9:58 AM
Subscribers

Details

Summary

Interrupts are described by compound data in modern SOCs and a single number is no more enough. However, newbus API is only oriented to a single number. And so are almost all (if not all) bus drivers as they use struct resource_list API or some modification of that. In fact, there is nothing wrong about a single number, but we need such a number to be connected to data describing associated interrupt (resource). And this data should be accessible by bus drivers in a convenient way.

In INTRNG generalization step 1 (D5730), we created own storage for such data associated with a global scope interrupt number as a temporary solution. This was/is both orthogonal and local solution to this problem. Further, as data is associated with a driver (not with an interrupt), the solution is not correct. Now, we would like to make newbus like solution. And we would like to do that by extending bus drivers, not by reworking them. This change is about that.

The idea is that there may be bus drivers which cannot call bus_set_resource() on their child drivers in time when they are added as the information needed for that is not available at this time. Thus bus_extend_resource() method is introduced which is called internally during bus_alloc_resource() call. This function allows a device parent to do what bus_set_resource() does, but in time when a child driver is being attached. Further, this function may return data which describes the resource. And this data is stored in this resource to be available later.

This is exactly the situation in OFW (FDT) case. An OFW bus driver can read a description of an interrupt for its child driver, but it's not able to convert it to an interrupt number as it does not understand the description. It's not even able to save this description for later use. Only an interrupt controller understands the description which belongs to it, but it may not be attached at this time.

As mainline release is coming, the idea is implemented only for interrupt resources and only in INTRNG case now. And r_virtual member of struct resource_i is used to store the data associated with an interrupt. It should be safe for resources with SYS_RES_IRQ type.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

skra retitled this revision from to INTRNG generalization step 2 - extending struct resource.
skra updated this object.
skra edited the test plan for this revision. (Show Details)
skra added reviewers: imp, jhb.
skra set the repository for this revision to rS FreeBSD src repository - subversion.
This revision was automatically updated to reflect the committed changes.