summaryrefslogtreecommitdiff
path: root/sys/dev/pci/devlist2h.awk
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>2004-08-02 18:43:38 +0000
committermycroft <mycroft@NetBSD.org>2004-08-02 18:43:38 +0000
commit31a80e2d68e1aded54fd4df2d64616fec11e6633 (patch)
tree07ecabf0042915b380872902c96c3128f20a1b81 /sys/dev/pci/devlist2h.awk
parent08adc832cfa7df88c86695a57b1b02c89de83a35 (diff)
For the PCIVERBOSE case, separate vendors and products into separate tables.
Eliminating redundant pointers in the tables saves nearly 20K (20% of the table size). In the process, add a pci_findproduct() and make that and pci_findvendor() return a "const char *".
Diffstat (limited to 'sys/dev/pci/devlist2h.awk')
-rw-r--r--sys/dev/pci/devlist2h.awk53
1 files changed, 21 insertions, 32 deletions
diff --git a/sys/dev/pci/devlist2h.awk b/sys/dev/pci/devlist2h.awk
index 03955e3862f..8676560c80a 100644
--- a/sys/dev/pci/devlist2h.awk
+++ b/sys/dev/pci/devlist2h.awk
@@ -1,5 +1,5 @@
#! /usr/bin/awk -f
-# $NetBSD: devlist2h.awk,v 1.8 2003/12/15 07:32:21 jmc Exp $
+# $NetBSD: devlist2h.awk,v 1.9 2004/08/02 18:43:38 mycroft Exp $
#
# Copyright (c) 1995, 1996 Christopher G. Demetriou
# All rights reserved.
@@ -160,64 +160,53 @@ END {
printf("\n") > dfile
- printf("const struct pci_knowndev pci_knowndevs[] = {\n") > dfile
- for (i = 1; i <= nproducts; i++) {
+ printf("const struct pci_vendor pci_vendors[] = {\n") > dfile
+ for (i = 1; i <= nvendors; i++) {
printf("\t{\n") > dfile
- printf("\t PCI_VENDOR_%s, PCI_PRODUCT_%s_%s,\n",
- products[i, 1], products[i, 1], products[i, 2]) \
+ printf("\t PCI_VENDOR_%s,\n", vendors[i, 1]) \
> dfile
- printf("\t ") > dfile
- printf("0") > dfile
- printf(",\n") > dfile
- vendi = vendorindex[products[i, 1]];
printf("\t \"") > dfile
j = 3;
needspace = 0;
- while ((vendi, j) in vendors) {
- if (needspace)
- printf(" ") > dfile
- printf("%s", vendors[vendi, j]) > dfile
- needspace = 1
- j++
- }
- printf("\",\n") > dfile
-
- printf("\t \"") > dfile
- j = 4;
- needspace = 0;
- while ((i, j) in products) {
+ while ((i, j) in vendors) {
if (needspace)
printf(" ") > dfile
- printf("%s", products[i, j]) > dfile
+ printf("%s", vendors[i, j]) > dfile
needspace = 1
j++
}
printf("\",\n") > dfile
printf("\t},\n") > dfile
}
- for (i = 1; i <= nvendors; i++) {
+ printf("};\n") > dfile
+ printf("const int pci_nvendors = %d;\n", nvendors) > dfile
+
+ printf("\n") > dfile
+
+ printf("const struct pci_product pci_products[] = {\n") > dfile
+ for (i = 1; i <= nproducts; i++) {
printf("\t{\n") > dfile
- printf("\t PCI_VENDOR_%s, 0,\n", vendors[i, 1]) \
- > dfile
- printf("\t PCI_KNOWNDEV_NOPROD,\n") \
+ printf("\t PCI_VENDOR_%s, PCI_PRODUCT_%s_%s,\n",
+ products[i, 1], products[i, 1], products[i, 2]) \
> dfile
+
printf("\t \"") > dfile
- j = 3;
+ j = 4;
needspace = 0;
- while ((i, j) in vendors) {
+ while ((i, j) in products) {
if (needspace)
printf(" ") > dfile
- printf("%s", vendors[i, j]) > dfile
+ printf("%s", products[i, j]) > dfile
needspace = 1
j++
}
printf("\",\n") > dfile
- printf("\t NULL,\n") > dfile
printf("\t},\n") > dfile
}
- printf("\t{ 0, 0, 0, NULL, NULL, }\n") > dfile
printf("};\n") > dfile
+ printf("const int pci_nproducts = %d;\n", nproducts) >dfile
+
close(dfile)
close(hfile)
}