From owner-freebsd-arch Fri Jan 5 14:43:30 2001 From owner-freebsd-arch@FreeBSD.ORG Fri Jan 5 14:43:28 2001 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from aslan.scsiguy.com (aslan.scsiguy.com [63.229.232.106]) by hub.freebsd.org (Postfix) with ESMTP id 6E50037B400 for ; Fri, 5 Jan 2001 14:43:27 -0800 (PST) Received: from scsiguy.com (localhost [127.0.0.1]) by aslan.scsiguy.com (8.11.0/8.9.3) with ESMTP id f05Mh2s40409; Fri, 5 Jan 2001 15:43:08 -0700 (MST) (envelope-from gibbs@scsiguy.com) Message-Id: <200101052243.f05Mh2s40409@aslan.scsiguy.com> To: Paul Richards Cc: freebsd-arch@FreeBSD.ORG Subject: Re: Inheritance in new-bus. In-Reply-To: Your message of "Fri, 05 Jan 2001 22:05:38 GMT." <3A564532.ADE40E6E@originative.co.uk> Date: Fri, 05 Jan 2001 15:43:02 -0700 From: "Justin T. Gibbs" Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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