From: aaron Date: Thu, 2 Mar 2000 23:03:26 +0000 (+0000) Subject: Prep for CardBus support; from NetBSD. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a835b940885032a856ac4222806450fc2c68e4af;p=openbsd Prep for CardBus support; from NetBSD. --- diff --git a/sys/dev/cardbus/Makefile.cardbusdevs b/sys/dev/cardbus/Makefile.cardbusdevs new file mode 100644 index 00000000000..ad75924aa68 --- /dev/null +++ b/sys/dev/cardbus/Makefile.cardbusdevs @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile.cardbusdevs,v 1.1 2000/03/02 23:03:26 aaron Exp $ +# $NetBSD: Makefile.cardbusdevs,v 1.2 1999/10/15 06:42:21 haya Exp $ + +AWK= awk + +cardbusdevs.h cardbusdevs_data.h: cardbusdevs devlist2h.awk + /bin/rm -f cardbusdevs.h cardbusdevs_data.h + ${AWK} -f devlist2h.awk cardbusdevs diff --git a/sys/dev/cardbus/cardbusdevs b/sys/dev/cardbus/cardbusdevs new file mode 100644 index 00000000000..3553c5754a3 --- /dev/null +++ b/sys/dev/cardbus/cardbusdevs @@ -0,0 +1,82 @@ +$OpenBSD: cardbusdevs,v 1.1 2000/03/02 23:03:26 aaron Exp $ +$NetBSD: cardbusdevs,v 1.7 1999/12/11 22:22:34 explorer Exp $ + +/* + * Copyright (C) 1999 Hayakawa Koichi. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the author + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This code is stolen from sys/dev/pci/pcidevs. + */ + + +/* + * List of known CardBus vendors + */ + +vendor DEC 0x1011 Digital Equipment +vendor 3COM 0x10B7 3Com +vendor ADP 0x9004 Adaptec +vendor ADP2 0x9005 Adaptec (2nd PCI Vendor ID) +vendor OPTI 0x1045 Opti +vendor XIRCOM 0x115d Xircom +vendor INTEL 0x8086 Intel +vendor INVALID 0xffff INVALID VENDOR ID + +/* + * List of known products. Grouped by vendor. + */ + +/* 3COM Products */ + +product 3COM 3C575TX 0x5057 3c575 100Base-TX +product 3COM 3C575BTX 0x5157 3c575B 100Base-TX +product 3COM 3CCFE575CT 0x5257 3CCFE575CT 100Base-TX + +/* Adaptec products */ +product ADP 1480 0x6075 APA-1480 + +/* DEC products */ +product DEC 21142 0x0019 DECchip 21142/3 + +/* Intel products */ +product INTEL 82557 0x1229 82557 Fast Ethernet LAN Controller +/* XXX product name? */ +product INTEL MODEM56 0x1002 Modem + +/* Opti products */ +product OPTI 82C861 0xc861 82C861 USB Host Controller (OHCI) + +/* Xircom products */ +/* is the `-3' here just indicating revision 3, or is it really part + of the device name? */ +product XIRCOM X3201_3 0x0002 X3201-3 Fast Ethernet Controller +/* this is the device id `indicating 21143 driver compatibility' */ +product XIRCOM X3201_3_21143 0x0003 X3201-3 Fast Ethernet Controller (21143) diff --git a/sys/dev/cardbus/cardbusdevs.h b/sys/dev/cardbus/cardbusdevs.h new file mode 100644 index 00000000000..d127e0faf61 --- /dev/null +++ b/sys/dev/cardbus/cardbusdevs.h @@ -0,0 +1,89 @@ +/* $OpenBSD: cardbusdevs.h,v 1.1 2000/03/02 23:03:26 aaron Exp $ */ +/* $NetBSD: cardbusdevs.h,v 1.5 1999/12/11 22:22:54 explorer Exp $ */ + +/* + * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * generated from: + * NetBSD: cardbusdevs,v 1.7 1999/12/11 22:22:34 explorer Exp + */ + +/* + * Copyright (C) 1999 Hayakawa Koichi. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the author + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This code is stolen from sys/dev/pci/pcidevs. + */ + + +/* + * List of known CardBus vendors + */ + +#define CARDBUS_VENDOR_DEC 0x1011 /* Digital Equipment */ +#define CARDBUS_VENDOR_3COM 0x10B7 /* 3Com */ +#define CARDBUS_VENDOR_ADP 0x9004 /* Adaptec */ +#define CARDBUS_VENDOR_ADP2 0x9005 /* Adaptec (2nd PCI Vendor ID) */ +#define CARDBUS_VENDOR_OPTI 0x1045 /* Opti */ +#define CARDBUS_VENDOR_XIRCOM 0x115d /* Xircom */ +#define CARDBUS_VENDOR_INTEL 0x8086 /* Intel */ +#define CARDBUS_VENDOR_INVALID 0xffff /* INVALID VENDOR ID */ + +/* + * List of known products. Grouped by vendor. + */ + +/* 3COM Products */ + +#define CARDBUS_PRODUCT_3COM_3C575TX 0x5057 /* 3c575 100Base-TX */ +#define CARDBUS_PRODUCT_3COM_3C575BTX 0x5157 /* 3c575B 100Base-TX */ +#define CARDBUS_PRODUCT_3COM_3CCFE575CT 0x5257 /* 3CCFE575CT 100Base-TX */ + +/* Adaptec products */ +#define CARDBUS_PRODUCT_ADP_1480 0x6075 /* APA-1480 */ + +/* DEC products */ +#define CARDBUS_PRODUCT_DEC_21142 0x0019 /* DECchip 21142/3 */ + +/* Intel products */ +#define CARDBUS_PRODUCT_INTEL_82557 0x1229 /* 82557 Fast Ethernet LAN Controller */ +/* XXX product name? */ +#define CARDBUS_PRODUCT_INTEL_MODEM56 0x1002 /* Modem */ + +/* Opti products */ +#define CARDBUS_PRODUCT_OPTI_82C861 0xc861 /* 82C861 USB Host Controller (OHCI) */ + +/* Xircom products */ +/* is the `-3' here just indicating revision 3, or is it really part + of the device name? */ +#define CARDBUS_PRODUCT_XIRCOM_X3201_3 0x0002 /* X3201-3 Fast Ethernet Controller */ +/* this is the device id `indicating 21143 driver compatibility' */ +#define CARDBUS_PRODUCT_XIRCOM_X3201_3_21143 0x0003 /* X3201-3 Fast Ethernet Controller (21143) */ diff --git a/sys/dev/cardbus/cardbusdevs_data.h b/sys/dev/cardbus/cardbusdevs_data.h new file mode 100644 index 00000000000..bf71af2fbd3 --- /dev/null +++ b/sys/dev/cardbus/cardbusdevs_data.h @@ -0,0 +1,152 @@ +/* $OpenBSD: cardbusdevs_data.h,v 1.1 2000/03/02 23:03:26 aaron Exp $ */ +/* $NetBSD: cardbusdevs_data.h,v 1.5 1999/12/11 22:22:54 explorer Exp $ */ + +/* + * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * generated from: + * NetBSD: cardbusdevs,v 1.7 1999/12/11 22:22:34 explorer Exp + */ + +/* + * Copyright (C) 1999 Hayakawa Koichi. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the author + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +struct cardbus_knowndev cardbus_knowndevs[] = { + { + CARDBUS_VENDOR_3COM, CARDBUS_PRODUCT_3COM_3C575TX, + 0, + "3Com", + "3c575 100Base-TX", + }, + { + CARDBUS_VENDOR_3COM, CARDBUS_PRODUCT_3COM_3C575BTX, + 0, + "3Com", + "3c575B 100Base-TX", + }, + { + CARDBUS_VENDOR_3COM, CARDBUS_PRODUCT_3COM_3CCFE575CT, + 0, + "3Com", + "3CCFE575CT 100Base-TX", + }, + { + CARDBUS_VENDOR_ADP, CARDBUS_PRODUCT_ADP_1480, + 0, + "Adaptec", + "APA-1480", + }, + { + CARDBUS_VENDOR_DEC, CARDBUS_PRODUCT_DEC_21142, + 0, + "Digital Equipment", + "DECchip 21142/3", + }, + { + CARDBUS_VENDOR_INTEL, CARDBUS_PRODUCT_INTEL_82557, + 0, + "Intel", + "82557 Fast Ethernet LAN Controller", + }, + { + CARDBUS_VENDOR_INTEL, CARDBUS_PRODUCT_INTEL_MODEM56, + 0, + "Intel", + "Modem", + }, + { + CARDBUS_VENDOR_OPTI, CARDBUS_PRODUCT_OPTI_82C861, + 0, + "Opti", + "82C861 USB Host Controller (OHCI)", + }, + { + CARDBUS_VENDOR_XIRCOM, CARDBUS_PRODUCT_XIRCOM_X3201_3, + 0, + "Xircom", + "X3201-3 Fast Ethernet Controller", + }, + { + CARDBUS_VENDOR_XIRCOM, CARDBUS_PRODUCT_XIRCOM_X3201_3_21143, + 0, + "Xircom", + "X3201-3 Fast Ethernet Controller (21143)", + }, + { + CARDBUS_VENDOR_DEC, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Digital Equipment", + NULL, + }, + { + CARDBUS_VENDOR_3COM, 0, + CARDBUS_KNOWNDEV_NOPROD, + "3Com", + NULL, + }, + { + CARDBUS_VENDOR_ADP, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Adaptec", + NULL, + }, + { + CARDBUS_VENDOR_ADP2, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Adaptec (2nd PCI Vendor ID)", + NULL, + }, + { + CARDBUS_VENDOR_OPTI, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Opti", + NULL, + }, + { + CARDBUS_VENDOR_XIRCOM, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Xircom", + NULL, + }, + { + CARDBUS_VENDOR_INTEL, 0, + CARDBUS_KNOWNDEV_NOPROD, + "Intel", + NULL, + }, + { + CARDBUS_VENDOR_INVALID, 0, + CARDBUS_KNOWNDEV_NOPROD, + "INVALID VENDOR ID", + NULL, + }, + { 0, 0, 0, NULL, NULL, } +}; diff --git a/sys/dev/cardbus/devlist2h.awk b/sys/dev/cardbus/devlist2h.awk new file mode 100644 index 00000000000..bc0666d0d7c --- /dev/null +++ b/sys/dev/cardbus/devlist2h.awk @@ -0,0 +1,222 @@ +#! /usr/bin/awk -f +# $OpenBSD: devlist2h.awk,v 1.1 2000/03/02 23:03:26 aaron Exp $ +# $NetBSD: devlist2h.awk,v 1.1 1999/10/15 06:07:22 haya Exp $ +# +# Copyright (c) 1995, 1996 Christopher G. Demetriou +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Christopher G. Demetriou. +# 4. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +BEGIN { + nproducts = nvendors = 0 + dfile="cardbusdevs_data.h" + hfile="cardbusdevs.h" +} +NR == 1 { + VERSION = $0 + gsub("\\$", "", VERSION) + + printf("/*\t\$NetBSD\$\t*/\n\n") > dfile + printf("/*\n") > dfile + printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > dfile + printf(" *\n") > dfile + printf(" * generated from:\n") > dfile + printf(" *\t%s\n", VERSION) > dfile + printf(" */\n") > dfile + + printf("/*\t\$NetBSD\$\t*/\n\n") > hfile + printf("/*\n") > hfile + printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > hfile + printf(" *\n") > hfile + printf(" * generated from:\n") > hfile + printf(" *\t%s\n", VERSION) > hfile + printf(" */\n") > hfile + + next +} +$1 == "vendor" { + nvendors++ + + vendorindex[$2] = nvendors; # record index for this name, for later. + vendors[nvendors, 1] = $2; # name + vendors[nvendors, 2] = $3; # id + printf("#define\tCARDBUS_VENDOR_%s\t%s\t", vendors[nvendors, 1], + vendors[nvendors, 2]) > hfile + + i = 3; f = 4; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + printf("%s", $f) > hfile + if (f < NF) + printf(" ") > hfile + f++ + continue + } + vendors[nvendors, i] = $f + printf("%s", vendors[nvendors, i]) > hfile + if (f < NF) + printf(" ") > hfile + i++; f++; + } + if (oparen) + printf(")") > hfile + if (ocomment) + printf(" */") > hfile + printf("\n") > hfile + + next +} +$1 == "product" { + nproducts++ + + products[nproducts, 1] = $2; # vendor name + products[nproducts, 2] = $3; # product id + products[nproducts, 3] = $4; # id + printf("#define\tCARDBUS_PRODUCT_%s_%s\t%s\t", products[nproducts, 1], + products[nproducts, 2], products[nproducts, 3]) > hfile + + i=4; f = 5; + + # comments + ocomment = oparen = 0 + if (f <= NF) { + printf("\t/* ") > hfile + ocomment = 1; + } + while (f <= NF) { + if ($f == "#") { + printf("(") > hfile + oparen = 1 + f++ + continue + } + if (oparen) { + printf("%s", $f) > hfile + if (f < NF) + printf(" ") > hfile + f++ + continue + } + products[nproducts, i] = $f + printf("%s", products[nproducts, i]) > hfile + if (f < NF) + printf(" ") > hfile + i++; f++; + } + if (oparen) + printf(")") > hfile + if (ocomment) + printf(" */") > hfile + printf("\n") > hfile + + next +} +{ + if ($0 == "") + blanklines++ + print $0 > hfile + if (blanklines < 2) + print $0 > dfile +} +END { + # print out the match tables + + printf("\n") > dfile + + printf("struct cardbus_knowndev cardbus_knowndevs[] = {\n") > dfile + for (i = 1; i <= nproducts; i++) { + printf("\t{\n") > dfile + printf("\t CARDBUS_VENDOR_%s, CARDBUS_PRODUCT_%s_%s,\n", + products[i, 1], products[i, 1], products[i, 2]) \ + > dfile + printf("\t ") > dfile + printf("0") > dfile + printf(",\n") > dfile + + vendi = vendorindex[products[i, 1]]; + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[vendi, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[vendi, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + + printf("\t \"") > dfile + j = 4; + needspace = 0; + while (products[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", products[i, j]) > dfile + needspace = 1 + j++ + } + printf("\",\n") > dfile + printf("\t},\n") > dfile + } + for (i = 1; i <= nvendors; i++) { + printf("\t{\n") > dfile + printf("\t CARDBUS_VENDOR_%s, 0,\n", vendors[i, 1]) \ + > dfile + printf("\t CARDBUS_KNOWNDEV_NOPROD,\n") \ + > dfile + printf("\t \"") > dfile + j = 3; + needspace = 0; + while (vendors[i, j] != "") { + if (needspace) + printf(" ") > dfile + printf("%s", vendors[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 +}