Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Jan 2001 15:43:02 -0700
From:      "Justin T. Gibbs" <gibbs@scsiguy.com>
To:        Paul Richards <paul@originative.co.uk>
Cc:        freebsd-arch@FreeBSD.ORG
Subject:   Re: Inheritance in new-bus. 
Message-ID:  <200101052243.f05Mh2s40409@aslan.scsiguy.com>
In-Reply-To: Your message of "Fri, 05 Jan 2001 22:05:38 GMT." <3A564532.ADE40E6E@originative.co.uk> 

next in thread | previous in thread | raw e-mail | index | archive | help
>I looked at implementing kobj inheritance while I was working on my
>talk.
>
>My original thinking was that the upcalls could be done away with if a
>child device inherited its methods from its parent bus, filling in the
>child's kobj method table with the parent bus' methods. However, when I
>discussed it with Doug at the conference he didn't see things being
>related in that way and having spent some time pondering that I can see
>what he meant.
>
>For instance, an ethernet driver may be a child of a PCI device and at
>the moment it performs upcalls to the PCI card to carry out various
>functions, but method inheritance based on the device hierarchy wouldn't
>be correct since an ethernet kobj is in no way a child of a PCI kobj,
>they're only related because of their physical association. Cardbus on
>the other hand is related to PCI and so it would make sense to inherit
>from PCI. So I think that adding inheritance to kobj would be good
>thing, so that cardbus can inherit from PCI, but it wouldn't be right if
>inheritance was based on devclasses or on any other aspect of the device
>hierarchy, particularly since kobj is meant to be a generic OO mechanism
>rather than a part of newbus.

Cardbus is no different than your ethernet card example.  Cardbus is
not a child bus of PCI, but is rather a specialized implementation of
PCI.  Perhaps my understanding of the devclass is wrong.  I didn't
think that it had anything to do with the bus hierarchy, but was simply
a place for a particular class to store data about that class (for instance
drivers for children of the bus implemented by that class).  As I metioned
in my email, I think the devclass thing won't work.  I'd rathre see
the method table be an array of "interface structs" with the interfave
structs having a list of method overides and an optional pointer to
the parent interface to inherit from.

>I don't know which particular take on inheritance you've implemented, I
>wouldn't mind getting a look at the patches :-)

Several of PCI's methods are now exported in pci_private.h.  Cardbus's
method table now references several of these methods and occassionally
one or more of its method overrides also calls into the PCI code to get
some amount of work done.

I'll be posting the patches RSN.

--
Justin


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101052243.f05Mh2s40409>