From: Rusty Russell <rusty@rustcorp.com.au>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Re-xmit: PCI IDs module alias fix
Date: Tue, 01 Apr 2003 09:18:01 +1000 [thread overview]
Message-ID: <20030331232358.F38B52C003@lists.samba.org> (raw)
Linus, please apply (OK'd by Greg Kroah-Hartmann).
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Subdivide PCI class for aliases
Author: Rusty Russell
Status: Tested on 2.5.66-bk2
D: The previous handling of PCI class masks was too primitive: the
D: class field is not "all or nothing" but has base class, subclass
D: and interface fields. This patch changes the alias form from:
D: pci:vNdNsvNsdNcN to pci:vNdNsvNsdNbcNscNiN.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/scripts/file2alias.c working-2.5.66-bk2-pci-alias/scripts/file2alias.c
--- linux-2.5.66-bk2/scripts/file2alias.c 2003-02-18 11:18:57.000000000 +1100
+++ working-2.5.66-bk2-pci-alias/scripts/file2alias.c 2003-03-27 16:35:37.000000000 +1100
@@ -81,10 +81,14 @@ static int do_usb_entry(const char *file
return 1;
}
-/* Looks like: pci:vNdNsvNsdNcN. */
+/* Looks like: pci:vNdNsvNsdNbcNscNiN. */
static int do_pci_entry(const char *filename,
struct pci_device_id *id, char *alias)
{
+ /* Class field can be divided into these three. */
+ unsigned char baseclass, subclass, interface,
+ baseclass_mask, subclass_mask, interface_mask;
+
id->vendor = TO_NATIVE(id->vendor);
id->device = TO_NATIVE(id->device);
id->subvendor = TO_NATIVE(id->subvendor);
@@ -97,13 +101,26 @@ static int do_pci_entry(const char *file
ADD(alias, "d", id->device != PCI_ANY_ID, id->device);
ADD(alias, "sv", id->subvendor != PCI_ANY_ID, id->subvendor);
ADD(alias, "sd", id->subdevice != PCI_ANY_ID, id->subdevice);
- if (id->class_mask != 0 && id->class_mask != ~0) {
+
+ baseclass = (id->class) >> 16;
+ baseclass_mask = (id->class_mask) >> 16;
+ subclass = (id->class) >> 8;
+ subclass_mask = (id->class_mask) >> 8;
+ interface = id->class;
+ interface_mask = id->class_mask;
+
+ if ((baseclass_mask != 0 && baseclass_mask != 0xFF)
+ || (subclass_mask != 0 && subclass_mask != 0xFF)
+ || (interface_mask != 0 && interface_mask != 0xFF)) {
fprintf(stderr,
- "*** Warning: Can't handle class_mask in %s:%04X\n",
+ "*** Warning: Can't handle masks in %s:%04X\n",
filename, id->class_mask);
return 0;
}
- ADD(alias, "c", id->class_mask == ~0, id->class);
+
+ ADD(alias, "bc", baseclass_mask == 0xFF, baseclass);
+ ADD(alias, "sc", subclass_mask == 0xFF, subclass);
+ ADD(alias, "i", interface_mask == 0xFF, interface);
return 1;
}
reply other threads:[~2003-03-31 23:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030331232358.F38B52C003@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®