linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Domsch <Matt_Domsch@dell.com>
To: Greg KH <greg@kroah.com>, jgarzik@pobox.com
Cc: linux-kernel@vger.kernel.org, mochel@osdl.org
Subject: Re: Displaying/modifying PCI device id tables via sysfs
Date: 03 Mar 2003 22:56:15 -0600	[thread overview]
Message-ID: <1046753776.12441.92.camel@iguana> (raw)
In-Reply-To: <20030304003120.GB19721@kroah.com>

> I'd like to see what your patch looks like to add this kind of support.

I don't have any code that I'm proud enough of to post quite yet, I'm
just trying to get the overall design concept right first.  Your
feedback is appreciated.

Jeff said:
> Field-replacement of PCI id tables is a todo item for a while now :)

Replacement, or addition?  I've been picturing addition, not
modification or replacement.  For modification, we would have to export
the entries via sysfs, which Greg had just convinced me I didn't need to
do. :-)

As far as the sysfs layout could go, here's what I've in mind for
simplicity sake.

/sys
`-- bus
    `-- pci
        `-- drivers
            `-- 3c59x
                |-- dynamic_id_0  (these are simple DRIVER_ATTRs)
                |-- dynamic_id_1
                |-- dynamic_id_2
                `-- new_id

Where dynamic_id_[012] are new dynamic entries, created by writing
values into new_id.  Both file types would be of the format (analogous
to pci_show_resources):
echo "0x0000 0x0000 0x0000 0x0000 0x0000 0x0000" > new_id
with fields being vendor, device, subvendor, subdevice, class,
class_mask.

To be safe, the store method for new_id should walk the static table and
the dynamic ID table, ensuring it's not creating a duplicate.

The new entries would get added to a new list in struct pci_driver, and
struct pci_id_table would grow a struct list_head so new list entries
could be easily created and added to the list.  The N in dynamic_id_N
would be a per-driver atomic_t, monotonically increasing as new IDs are
given.

It's then simple to have a script run at shutdown/startup to
save/restore IDs if desired.

The next step is to get the system to probe for devices matching the new
IDs.  Two new functions similar to pci_device_probe() and
pci_match_device() need implementing, where given a struct pci_driver
and a struct pci_device_id, it would probe.  The logic of
pci_match_device could be used with two wrappers, one to walk the static
ID table, one to match a new ID.


If you'd prefer to see this:
3c59x/
`-- dynamic_id_table
    |-- 0
    |   |-- class
    |   |-- class_mask
    |   |-- device
    |   |-- subdevice
    |   |-- subvendor
    |   `-- vendor
    `-- new_id

then there needs to be a simple way in sysfs to export an attribute
hierarchy, beneath an object in the kobject hierarchy.  Right now it's
assumed that each kobject can have multiple attributes, but all are at a
single level.  Pat, is this hard to do?


How far off base am I? :-)

Thanks,
Matt

-- 
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com



  reply	other threads:[~2003-03-04  4:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 17:57 Displaying/modifying PCI device id tables via sysfs Matt Domsch
2003-03-03 18:25 ` Greg KH
2003-03-03 20:02   ` Alan Cox
2003-03-03 20:56   ` Matt Domsch
2003-03-04  0:31     ` Greg KH
2003-03-04  4:56       ` Matt Domsch [this message]
2003-03-04 14:10         ` Patrick Mochel
2003-03-04 20:22         ` Kai Germaschewski
2003-03-04 22:39           ` Alan Cox
2003-03-04 22:57           ` Jeff Garzik
2003-03-04  0:34     ` Jeff Garzik
2003-05-23  0:53   ` Rusty Russell
2003-05-24  0:37     ` Greg KH
2003-05-25  4:57       ` Rusty Russell
2003-05-23  2:27 Matt_Domsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1046753776.12441.92.camel@iguana \
    --to=matt_domsch@dell.com \
    --cc=greg@kroah.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).