Merge the 3 copies of devlist2h.awk that deal with 16 bit key and value
pairs to the compressed one that matt wrote.
This commit is contained in:
parent
bb4d9fb08c
commit
9eaee4f495
94
sys/dev/dev_verbose.c
Normal file
94
sys/dev/dev_verbose.c
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/* $NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
#include <sys/systm.h>
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <dev/dev_verbose.h>
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
dev_untokenstring(const char *words, const uint16_t *token, char *buf,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
char *cp = buf;
|
||||||
|
|
||||||
|
buf[0] = '\0';
|
||||||
|
for (; *token != 0; token++) {
|
||||||
|
cp = buf + strlcat(buf, words + *token, len - 2);
|
||||||
|
cp[0] = ' ';
|
||||||
|
cp[1] = '\0';
|
||||||
|
}
|
||||||
|
*cp = '\0';
|
||||||
|
return cp != buf ? buf : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
dev_findvendor(char *buf, size_t len, const char *words, size_t nwords,
|
||||||
|
const uint16_t *vendors, size_t nvendors, uint16_t vendor)
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
for (n = 0; n < nvendors; n++) {
|
||||||
|
if (vendors[n] == vendor)
|
||||||
|
return dev_untokenstring(words, &vendors[n + 1],
|
||||||
|
buf, len);
|
||||||
|
|
||||||
|
/* Skip Tokens */
|
||||||
|
n++;
|
||||||
|
while (vendors[n] != 0 && n < nvendors)
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
snprintf(buf, len, "vendor %4.4x", vendor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
dev_findproduct(char *buf, size_t len, const char *words, size_t nwords,
|
||||||
|
const uint16_t *products, size_t nproducts, uint16_t vendor,
|
||||||
|
uint16_t product)
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
for (n = 0; n < nproducts; n++) {
|
||||||
|
if (products[n] == vendor && products[n + 1] == product)
|
||||||
|
return dev_untokenstring(words, &products[n + 2],
|
||||||
|
buf, len);
|
||||||
|
|
||||||
|
/* Skip Tokens */
|
||||||
|
n += 2;
|
||||||
|
while (products[n] != 0 && n < nproducts)
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
snprintf(buf, len, "product %4.4x", product);
|
||||||
|
return NULL;
|
||||||
|
}
|
145
sys/dev/dev_verbose.h
Normal file
145
sys/dev/dev_verbose.h
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/* $NetBSD: dev_verbose.h,v 1.1 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _DEV_DEV_VERBOSE_H_
|
||||||
|
#define _DEV_DEV_VERBOSE_H_
|
||||||
|
|
||||||
|
const char *dev_findvendor(char *, size_t, const char *, size_t,
|
||||||
|
const uint16_t *, size_t, uint16_t);
|
||||||
|
const char *dev_findproduct(char *, size_t, const char *, size_t,
|
||||||
|
const uint16_t *, size_t, uint16_t, uint16_t);
|
||||||
|
|
||||||
|
#define DEV_VERBOSE_COMMON_DEFINE(tag) \
|
||||||
|
static const char * \
|
||||||
|
tag ## _findvendor_real(char *buf, size_t len, uint16_t vendor) \
|
||||||
|
{ \
|
||||||
|
return dev_findvendor(buf, len, tag ## _words, \
|
||||||
|
__arraycount(tag ## _words), tag ## _vendors, \
|
||||||
|
__arraycount(tag ## _vendors), vendor); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
static const char * \
|
||||||
|
tag ## _findproduct_real(char *buf, size_t len, uint16_t vendor, \
|
||||||
|
uint16_t product) \
|
||||||
|
{ \
|
||||||
|
return dev_findproduct(buf, len, tag ## _words, \
|
||||||
|
__arraycount(tag ## _words), tag ## _products, \
|
||||||
|
__arraycount(tag ## _products), vendor, product); \
|
||||||
|
} \
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
|
||||||
|
#define DEV_VERBOSE_MODULE_DEFINE(tag, deps) \
|
||||||
|
DEV_VERBOSE_COMMON_DEFINE(tag) \
|
||||||
|
extern int tag ## verbose_loaded; \
|
||||||
|
\
|
||||||
|
static int \
|
||||||
|
tag ## verbose_modcmd(modcmd_t cmd, void *arg) \
|
||||||
|
{ \
|
||||||
|
static const char *(*saved_findvendor)(char *, size_t, \
|
||||||
|
uint16_t); \
|
||||||
|
static const char *(*saved_findproduct)(char *, size_t, \
|
||||||
|
uint16_t, uint16_t); \
|
||||||
|
\
|
||||||
|
switch (cmd) { \
|
||||||
|
case MODULE_CMD_INIT: \
|
||||||
|
saved_findvendor = tag ## _findvendor; \
|
||||||
|
saved_findproduct = tag ## _findproduct; \
|
||||||
|
tag ## _findvendor = tag ## _findvendor_real; \
|
||||||
|
tag ## _findproduct = tag ## _findproduct_real; \
|
||||||
|
tag ## verbose_loaded = 1; \
|
||||||
|
return 0; \
|
||||||
|
case MODULE_CMD_FINI: \
|
||||||
|
tag ## _findvendor = saved_findvendor; \
|
||||||
|
tag ## _findproduct = saved_findproduct; \
|
||||||
|
tag ## verbose_loaded = 0; \
|
||||||
|
return 0; \
|
||||||
|
default: \
|
||||||
|
return ENOTTY; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
MODULE(MODULE_CLASS_MISC, tag ## verbose, deps)
|
||||||
|
|
||||||
|
#endif /* KERNEL */
|
||||||
|
|
||||||
|
#define DEV_VERBOSE_DECLARE(tag) \
|
||||||
|
extern const char * (*tag ## _findvendor)(char *, size_t, uint16_t); \
|
||||||
|
extern const char * (*tag ## _findproduct)(char *, size_t, uint16_t, uint16_t)
|
||||||
|
|
||||||
|
#if defined(_KERNEL)
|
||||||
|
#define DEV_VERBOSE_DEFINE(tag) \
|
||||||
|
int tag ## verbose_loaded = 0; \
|
||||||
|
\
|
||||||
|
static void \
|
||||||
|
tag ## _load_verbose(void) \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
if (tag ## verbose_loaded == 0) \
|
||||||
|
module_autoload(# tag "verbose", MODULE_CLASS_MISC); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
static const char * \
|
||||||
|
tag ## _findvendor_stub(char *buf, size_t len, uint16_t vendor) \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
tag ## _load_verbose(); \
|
||||||
|
if (tag ## verbose_loaded) \
|
||||||
|
return tag ## _findvendor(buf, len, vendor); \
|
||||||
|
else { \
|
||||||
|
snprintf(buf, len, "vendor %4.4x", vendor); \
|
||||||
|
return NULL; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
static const char * \
|
||||||
|
tag ## _findproduct_stub(char *buf, size_t len, uint16_t vendor, \
|
||||||
|
uint16_t product) \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
tag ## _load_verbose(); \
|
||||||
|
if (tag ## verbose_loaded) \
|
||||||
|
return tag ## _findproduct(buf, len, vendor, product); \
|
||||||
|
else { \
|
||||||
|
snprintf(buf, len, "product %4.4x", product); \
|
||||||
|
return NULL; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
const char *(*tag ## _findvendor)(char *, size_t, uint16_t) = \
|
||||||
|
tag ## _findvendor_stub; \
|
||||||
|
const char *(*tag ## _findproduct)(char *, size_t, uint16_t, uint16_t) =\
|
||||||
|
tag ## _findproduct_stub; \
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define DEV_VERBOSE_DEFINE(tag) \
|
||||||
|
DEV_VERBOSE_COMMON_DEFINE(tag) \
|
||||||
|
const char *(*tag ## _findvendor)(char *, size_t, uint16_t) = \
|
||||||
|
tag ## _findvendor_real; \
|
||||||
|
const char *(*tag ## _findproduct)(char *, size_t, uint16_t, uint16_t) =\
|
||||||
|
tag ## _findproduct_real; \
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#endif /* _DEV_DEV_VERBOSE_H_ */
|
@ -1,5 +1,5 @@
|
|||||||
#! /usr/bin/awk -f
|
#! /usr/bin/awk -f
|
||||||
# $NetBSD: devlist2h.awk,v 1.13 2008/11/17 23:33:42 matt Exp $
|
# $NetBSD: devlist2h.awk,v 1.1 2014/09/21 14:30:22 christos Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1995, 1996 Christopher G. Demetriou
|
# Copyright (c) 1995, 1996 Christopher G. Demetriou
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -29,13 +29,14 @@
|
|||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
# (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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
BEGIN {
|
NR == 1 {
|
||||||
nproducts = nvendors = blanklines = 0
|
nproducts = nvendors = blanklines = 0
|
||||||
nchars = 1
|
nchars = 1
|
||||||
dfile="pcidevs_data.h"
|
dfile= FILENAME "_data.h"
|
||||||
hfile="pcidevs.h"
|
hfile= FILENAME ".h"
|
||||||
}
|
prefix = FILENAME
|
||||||
NR == 1 {
|
gsub("devs", "", prefix)
|
||||||
|
PREFIX = toupper(prefix)
|
||||||
VERSION = $0
|
VERSION = $0
|
||||||
gsub("\\$", "", VERSION)
|
gsub("\\$", "", VERSION)
|
||||||
gsub(/ $/, "", VERSION)
|
gsub(/ $/, "", VERSION)
|
||||||
@ -66,7 +67,7 @@ NF > 0 && $1 == "vendor" {
|
|||||||
vendorindex[$2] = nvendors; # record index for this name, for later.
|
vendorindex[$2] = nvendors; # record index for this name, for later.
|
||||||
vendors[nvendors, 1] = $2; # name
|
vendors[nvendors, 1] = $2; # name
|
||||||
vendors[nvendors, 2] = $3; # id
|
vendors[nvendors, 2] = $3; # id
|
||||||
printf("#define\tPCI_VENDOR_%s\t%s", vendors[nvendors, 1],
|
printf("#define\t%s_VENDOR_%s\t%s", PREFIX, vendors[nvendors, 1],
|
||||||
vendors[nvendors, 2]) > hfile
|
vendors[nvendors, 2]) > hfile
|
||||||
|
|
||||||
i = 3; f = 4;
|
i = 3; f = 4;
|
||||||
@ -124,7 +125,7 @@ NF > 0 && $1 == "product" {
|
|||||||
products[nproducts, 1] = $2; # vendor name
|
products[nproducts, 1] = $2; # vendor name
|
||||||
products[nproducts, 2] = $3; # product id
|
products[nproducts, 2] = $3; # product id
|
||||||
products[nproducts, 3] = $4; # id
|
products[nproducts, 3] = $4; # id
|
||||||
printf("#define\tPCI_PRODUCT_%s_%s\t%s", products[nproducts, 1],
|
printf("#define\t%s_PRODUCT_%s_%s\t%s", PREFIX, products[nproducts, 1],
|
||||||
products[nproducts, 2], products[nproducts, 3]) > hfile
|
products[nproducts, 2], products[nproducts, 3]) > hfile
|
||||||
|
|
||||||
i=4; f = 5;
|
i=4; f = 5;
|
||||||
@ -187,9 +188,9 @@ END {
|
|||||||
|
|
||||||
printf("\n") > dfile
|
printf("\n") > dfile
|
||||||
|
|
||||||
printf("static const uint16_t pci_vendors[] = {\n") > dfile
|
printf("static const uint16_t %s_vendors[] = {\n", prefix) > dfile
|
||||||
for (i = 1; i <= nvendors; i++) {
|
for (i = 1; i <= nvendors; i++) {
|
||||||
printf("\t PCI_VENDOR_%s", vendors[i, 1]) \
|
printf("\t %s_VENDOR_%s", PREFIX, vendors[i, 1]) \
|
||||||
> dfile
|
> dfile
|
||||||
|
|
||||||
j = 3;
|
j = 3;
|
||||||
@ -207,11 +208,11 @@ END {
|
|||||||
|
|
||||||
printf("\n") > dfile
|
printf("\n") > dfile
|
||||||
|
|
||||||
printf("static const uint16_t pci_products[] = {\n") > dfile
|
printf("static const uint16_t %s_products[] = {\n", prefix) > dfile
|
||||||
for (i = 1; i <= nproducts; i++) {
|
for (i = 1; i <= nproducts; i++) {
|
||||||
printf("\t PCI_VENDOR_%s, PCI_PRODUCT_%s_%s, \n",
|
printf("\t %s_VENDOR_%s, %s_PRODUCT_%s_%s, \n",
|
||||||
products[i, 1], products[i, 1], products[i, 2]) \
|
PREFIX, products[i, 1], PREFIX, products[i, 1],
|
||||||
> dfile
|
products[i, 2]) > dfile
|
||||||
|
|
||||||
printf("\t ") > dfile
|
printf("\t ") > dfile
|
||||||
j = 4
|
j = 4
|
||||||
@ -229,13 +230,13 @@ END {
|
|||||||
}
|
}
|
||||||
printf("};\n") > dfile
|
printf("};\n") > dfile
|
||||||
|
|
||||||
printf("static const char pci_words[] = { \".\" \n") > dfile
|
printf("static const char %s_words[] = { \".\" \n", prefix) > dfile
|
||||||
for (i = 1; i <= nwords; i++) {
|
for (i = 1; i <= nwords; i++) {
|
||||||
printf("\t \"%s\\0\" /* %d refs @ %d */\n",
|
printf("\t \"%s\\0\" /* %d refs @ %d */\n",
|
||||||
wordlist[i, 1], wordlist[i, 2], wordlist[i, 3]) > dfile
|
wordlist[i, 1], wordlist[i, 2], wordlist[i, 3]) > dfile
|
||||||
}
|
}
|
||||||
printf("};\n") > dfile
|
printf("};\n") > dfile
|
||||||
printf("const int pci_nwords = %d;\n", nwords) > dfile
|
printf("const int %s_nwords = %d;\n", prefix, nwords) > dfile
|
||||||
|
|
||||||
printf("\n") > dfile
|
printf("\n") > dfile
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: Makefile.pcidevs,v 1.5 2008/10/19 22:05:23 apb Exp $
|
# $NetBSD: Makefile.pcidevs,v 1.6 2014/09/21 14:30:22 christos Exp $
|
||||||
#
|
#
|
||||||
# As per tron@NetBSD.org, the proper procedure is
|
# As per tron@NetBSD.org, the proper procedure is
|
||||||
#
|
#
|
||||||
@ -9,6 +9,6 @@
|
|||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
pcidevs.h pcidevs_data.h: pcidevs devlist2h.awk
|
pcidevs.h pcidevs_data.h: ${.CURDIR}/../devlist2h.awk pcidevs
|
||||||
/bin/rm -f pcidevs.h pcidevs_data.h
|
/bin/rm -f pcidevs.h pcidevs_data.h
|
||||||
${TOOL_AWK} -f devlist2h.awk pcidevs
|
${TOOL_AWK} -f ${.ALLSRC}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: azalia.c,v 1.81 2014/03/29 19:28:24 christos Exp $ */
|
/* $NetBSD: azalia.c,v 1.82 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
|
||||||
@ -41,7 +41,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.81 2014/03/29 19:28:24 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.82 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
@ -303,8 +303,8 @@ azalia_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
pcireg_t v;
|
pcireg_t v;
|
||||||
pci_intr_handle_t ih;
|
pci_intr_handle_t ih;
|
||||||
const char *intrrupt_str;
|
const char *intrrupt_str;
|
||||||
const char *name;
|
char vendor[PCI_VENDORSTR_LEN];
|
||||||
const char *vendor;
|
char product[PCI_PRODUCTSTR_LEN];
|
||||||
char intrbuf[PCI_INTRSTR_LEN];
|
char intrbuf[PCI_INTRSTR_LEN];
|
||||||
|
|
||||||
sc->dev = self;
|
sc->dev = self;
|
||||||
@ -353,16 +353,11 @@ azalia_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
aprint_error_dev(self, "couldn't establish power handler\n");
|
aprint_error_dev(self, "couldn't establish power handler\n");
|
||||||
|
|
||||||
sc->pciid = pa->pa_id;
|
sc->pciid = pa->pa_id;
|
||||||
vendor = pci_findvendor(pa->pa_id);
|
pci_findvendor(vendor, sizeof(vendor), PCI_VENDOR(pa->pa_id));
|
||||||
name = pci_findproduct(pa->pa_id);
|
pci_findproduct(product, sizeof(product), PCI_VENDOR(pa->pa_id),
|
||||||
if (vendor != NULL && name != NULL) {
|
PCI_PRODUCT(pa->pa_id));
|
||||||
aprint_normal_dev(self, "host: %s %s (rev. %d)",
|
aprint_normal_dev(self, "host: %s %s (rev. %d)",
|
||||||
vendor, name, PCI_REVISION(pa->pa_class));
|
vendor, product, PCI_REVISION(pa->pa_class));
|
||||||
} else {
|
|
||||||
aprint_normal_dev(self, "host: 0x%4.4x/0x%4.4x (rev. %d)",
|
|
||||||
PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id),
|
|
||||||
PCI_REVISION(pa->pa_class));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (azalia_attach(sc)) {
|
if (azalia_attach(sc)) {
|
||||||
aprint_error_dev(self, "initialization failure\n");
|
aprint_error_dev(self, "initialization failure\n");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: cs4280.c,v 1.66 2014/03/29 19:28:24 christos Exp $ */
|
/* $NetBSD: cs4280.c,v 1.67 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved.
|
* Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved.
|
||||||
@ -52,7 +52,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.66 2014/03/29 19:28:24 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.67 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include "midi.h"
|
#include "midi.h"
|
||||||
|
|
||||||
@ -245,6 +245,8 @@ cs4280_attach(device_t parent, device_t self, void *aux)
|
|||||||
pcireg_t reg;
|
pcireg_t reg;
|
||||||
uint32_t mem;
|
uint32_t mem;
|
||||||
int error;
|
int error;
|
||||||
|
chae vendor[PCI_VENDORSTR_LEN];
|
||||||
|
chae product[PCI_PRODUCTSTR_LEN];
|
||||||
char intrbuf[PCI_INTRSTR_LEN];
|
char intrbuf[PCI_INTRSTR_LEN];
|
||||||
|
|
||||||
sc = device_private(self);
|
sc = device_private(self);
|
||||||
@ -256,19 +258,10 @@ cs4280_attach(device_t parent, device_t self, void *aux)
|
|||||||
|
|
||||||
cs_card = cs4280_identify_card(pa);
|
cs_card = cs4280_identify_card(pa);
|
||||||
if (cs_card != NULL) {
|
if (cs_card != NULL) {
|
||||||
vendor = pci_findvendor(cs_card->id);
|
pci_findvendor(vendor, sizeof(vendor), PCI_VENDOR(cs_card->id));
|
||||||
product = pci_findproduct(cs_card->id);
|
pci_findproduct(product, sizeof(product),
|
||||||
if (vendor == NULL)
|
PCI_VENDOR(cs_card->id), PCI_PRODUCT(cs_card->id));
|
||||||
aprint_normal_dev(sc->sc_dev,
|
aprint_normal_dev(sc->sc_dev, "%s %s\n", vendor, product);
|
||||||
"vendor 0x%04x product 0x%04x\n",
|
|
||||||
PCI_VENDOR(cs_card->id),
|
|
||||||
PCI_PRODUCT(cs_card->id));
|
|
||||||
else if (product == NULL)
|
|
||||||
aprint_normal_dev(sc->sc_dev, "%s product 0x%04x\n",
|
|
||||||
vendor, PCI_PRODUCT(cs_card->id));
|
|
||||||
else
|
|
||||||
aprint_normal_dev(sc->sc_dev, "%s %s\n",
|
|
||||||
vendor, product);
|
|
||||||
sc->sc_flags = cs_card->flags;
|
sc->sc_flags = cs_card->flags;
|
||||||
} else {
|
} else {
|
||||||
sc->sc_flags = CS428X_FLAG_NONE;
|
sc->sc_flags = CS428X_FLAG_NONE;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ehci_pci.c,v 1.58 2014/03/29 19:28:24 christos Exp $ */
|
/* $NetBSD: ehci_pci.c,v 1.59 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.58 2014/03/29 19:28:24 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.59 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -119,7 +119,6 @@ ehci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
char const *intrstr;
|
char const *intrstr;
|
||||||
pci_intr_handle_t ih;
|
pci_intr_handle_t ih;
|
||||||
pcireg_t csr;
|
pcireg_t csr;
|
||||||
const char *vendor;
|
|
||||||
usbd_status r;
|
usbd_status r;
|
||||||
int ncomp;
|
int ncomp;
|
||||||
struct usb_pci *up;
|
struct usb_pci *up;
|
||||||
@ -204,14 +203,9 @@ ehci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out vendor for root hub descriptor. */
|
/* Figure out vendor for root hub descriptor. */
|
||||||
vendor = pci_findvendor(pa->pa_id);
|
|
||||||
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
||||||
if (vendor)
|
pci_findvendor(sc->sc.sc_vendor,
|
||||||
strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
|
sizeof(sc->sc.sc_vendor), sc->sc.sc_id_vendor);
|
||||||
else
|
|
||||||
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
|
|
||||||
"vendor 0x%04x", PCI_VENDOR(pa->pa_id));
|
|
||||||
|
|
||||||
/* Enable workaround for dropped interrupts as required */
|
/* Enable workaround for dropped interrupts as required */
|
||||||
switch (sc->sc.sc_id_vendor) {
|
switch (sc->sc.sc_id_vendor) {
|
||||||
case PCI_VENDOR_ATI:
|
case PCI_VENDOR_ATI:
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
# $NetBSD: Makefile.hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp $
|
# $NetBSD: Makefile.hdaudiodevs,v 1.2 2014/09/21 14:30:22 christos Exp $
|
||||||
|
|
||||||
# The header files depend on the correct version of hdaudiodevs.
|
|
||||||
#
|
#
|
||||||
# Thus, the procedure is:
|
# As per tron@NetBSD.org, the proper procedure is
|
||||||
# 1) change hdaudiodevs
|
#
|
||||||
# 2) commit hdaudiodevs
|
# 1.) Change "src/sys/dev/hdaudio/hdaudiodevs".
|
||||||
# 3) _then_ generate header files
|
# 2.) Commit "src/sys/dev/hdaudio/hdaudiodevs".
|
||||||
# 4) commit them
|
# 3.) Execute "make -f Makefile.hdaudiodevs" in "src/sys/dev/pci/hdaudio".
|
||||||
|
# 4.) Commit "src/sys/dev/hdaudio/hdaudiodevs.h" and "src/sys/dev/pci/hdaudio/hdaudiodevs_data.h".
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
UNAME= uname
|
hdaudiodevs.h hdaudiodevs_data.h: ${.CURDIR}/../../devlist2h.awk hdaudiodevs
|
||||||
RM= rm
|
/bin/rm -f hdaudiodevs.h hdaudiodevs_data.h
|
||||||
|
${TOOL_AWK} -f ${.ALLSRC}
|
||||||
hdaudiodevs.h hdaudiodevs_data.h: hdaudiodevs devlist2h.awk
|
|
||||||
${RM} -f hdaudiodevs.h hdaudiodevs_data.h
|
|
||||||
${TOOL_AWK} -v os=`${UNAME} -s` -f devlist2h.awk hdaudiodevs
|
|
||||||
|
@ -1,227 +0,0 @@
|
|||||||
#! /usr/bin/awk -f
|
|
||||||
# $NetBSD: devlist2h.awk,v 1.1 2014/09/19 17:24:23 christos 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 = blanklines = 0
|
|
||||||
dfile="hdaudiodevs_data.h"
|
|
||||||
hfile="hdaudiodevs.h"
|
|
||||||
}
|
|
||||||
NR == 1 {
|
|
||||||
VERSION = $0
|
|
||||||
gsub("\\$", "", VERSION)
|
|
||||||
gsub(/ $/, "", VERSION)
|
|
||||||
|
|
||||||
if (os == "NetBSD")
|
|
||||||
printf("/*\t$NetBSD" "$\t*/\n\n") > dfile
|
|
||||||
else if (os == "FreeBSD")
|
|
||||||
printf("/*\t$FreeBSD" "$\t*/\n\n") > dfile
|
|
||||||
else if (os == "OpenBSD")
|
|
||||||
printf("/*\t$OpenBSD" "$\t*/\n\n") > dfile
|
|
||||||
else
|
|
||||||
printf("/* ??? */\n\n") > dfile
|
|
||||||
printf("/*\n") > dfile
|
|
||||||
printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
|
|
||||||
> dfile
|
|
||||||
printf(" *\n") > dfile
|
|
||||||
printf(" * generated from:\n") > dfile
|
|
||||||
printf(" *\t%s\n", VERSION) > dfile
|
|
||||||
printf(" */\n") > dfile
|
|
||||||
|
|
||||||
if (os == "NetBSD")
|
|
||||||
printf("/*\t$NetBSD" "$\t*/\n\n") > hfile
|
|
||||||
else if (os == "FreeBSD")
|
|
||||||
printf("/*\t$FreeBSD" "$\t*/\n\n") > hfile
|
|
||||||
else if (os == "OpenBSD")
|
|
||||||
printf("/*\t$OpenBSD" "$\t*/\n\n") > hfile
|
|
||||||
else
|
|
||||||
printf("/* ??? */\n\n") > hfile
|
|
||||||
printf("/*\n") > hfile
|
|
||||||
printf(" * THIS FILE IS 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
|
|
||||||
}
|
|
||||||
NF > 0 && $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\tHDAUDIO_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
|
|
||||||
}
|
|
||||||
NF > 0 && $1 == "product" {
|
|
||||||
nproducts++
|
|
||||||
|
|
||||||
products[nproducts, 1] = $2; # vendor name
|
|
||||||
products[nproducts, 2] = $3; # product id
|
|
||||||
products[nproducts, 3] = $4; # id
|
|
||||||
printf("#define\tHDAUDIO_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("const struct hdaudio_vendor hdaudio_vendors[] = {\n") > dfile
|
|
||||||
for (i = 1; i <= nvendors; i++) {
|
|
||||||
printf("\t{\n") > dfile
|
|
||||||
printf("\t HDAUDIO_VENDOR_%s,\n", vendors[i, 1]) \
|
|
||||||
> dfile
|
|
||||||
|
|
||||||
printf("\t \"") > dfile
|
|
||||||
j = 3;
|
|
||||||
needspace = 0;
|
|
||||||
while ((i, j) in vendors) {
|
|
||||||
if (needspace)
|
|
||||||
printf(" ") > dfile
|
|
||||||
printf("%s", vendors[i, j]) > dfile
|
|
||||||
needspace = 1
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
printf("\",\n") > dfile
|
|
||||||
printf("\t},\n") > dfile
|
|
||||||
}
|
|
||||||
printf("};\n") > dfile
|
|
||||||
printf("const int hdaudio_nvendors = %d;\n", nvendors) > dfile
|
|
||||||
|
|
||||||
printf("\n") > dfile
|
|
||||||
|
|
||||||
printf("const struct hdaudio_product hdaudio_products[] = {\n") > dfile
|
|
||||||
for (i = 1; i <= nproducts; i++) {
|
|
||||||
printf("\t{\n") > dfile
|
|
||||||
printf("\t HDAUDIO_VENDOR_%s, HDAUDIO_PRODUCT_%s_%s,\n",
|
|
||||||
products[i, 1], products[i, 1], products[i, 2]) \
|
|
||||||
> dfile
|
|
||||||
|
|
||||||
printf("\t \"") > dfile
|
|
||||||
j = 4;
|
|
||||||
needspace = 0;
|
|
||||||
while ((i, j) in products) {
|
|
||||||
if (needspace)
|
|
||||||
printf(" ") > dfile
|
|
||||||
printf("%s", products[i, j]) > dfile
|
|
||||||
needspace = 1
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
printf("\",\n") > dfile
|
|
||||||
printf("\t},\n") > dfile
|
|
||||||
}
|
|
||||||
printf("};\n") > dfile
|
|
||||||
printf("const int hdaudio_nproducts = %d;\n", nproducts) > dfile
|
|
||||||
|
|
||||||
close(dfile)
|
|
||||||
close(hfile)
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat Exp $ */
|
/* $NetBSD: hdafg.c,v 1.24 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
|
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.23 2014/09/21 10:41:22 nat Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.24 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -3614,8 +3614,8 @@ hdafg_attach(device_t parent, device_t self, void *opaque)
|
|||||||
|
|
||||||
prop_dictionary_get_uint16(args, "vendor-id", &sc->sc_vendor);
|
prop_dictionary_get_uint16(args, "vendor-id", &sc->sc_vendor);
|
||||||
prop_dictionary_get_uint16(args, "product-id", &sc->sc_product);
|
prop_dictionary_get_uint16(args, "product-id", &sc->sc_product);
|
||||||
get_hdaudio_vendor(vendor, sizeof(vendor), sc->sc_vendor);
|
hdaudio_findvendor(vendor, sizeof(vendor), sc->sc_vendor);
|
||||||
get_hdaudio_product(product, sizeof(product), sc->sc_vendor,
|
hdaudio_findproduct(product, sizeof(product), sc->sc_vendor,
|
||||||
sc->sc_product);
|
sc->sc_product);
|
||||||
hda_print1(sc, ": %s %s%s\n", vendor, product,
|
hda_print1(sc, ": %s %s%s\n", vendor, product,
|
||||||
sc->sc_config ? " (custom configuration)" : "");
|
sc->sc_config ? " (custom configuration)" : "");
|
||||||
@ -3969,9 +3969,9 @@ hdafg_getdev(void *opaque, struct audio_device *audiodev)
|
|||||||
struct hdaudio_audiodev *ad = opaque;
|
struct hdaudio_audiodev *ad = opaque;
|
||||||
struct hdafg_softc *sc = ad->ad_sc;
|
struct hdafg_softc *sc = ad->ad_sc;
|
||||||
|
|
||||||
get_hdaudio_vendor(audiodev->name, sizeof(audiodev->name),
|
hdaudio_findvendor(audiodev->name, sizeof(audiodev->name),
|
||||||
sc->sc_vendor);
|
sc->sc_vendor);
|
||||||
get_hdaudio_product(audiodev->version, sizeof(audiodev->version),
|
hdaudio_findproduct(audiodev->version, sizeof(audiodev->version),
|
||||||
sc->sc_vendor, sc->sc_product);
|
sc->sc_vendor, sc->sc_product);
|
||||||
snprintf(audiodev->config, sizeof(audiodev->config) - 1,
|
snprintf(audiodev->config, sizeof(audiodev->config) - 1,
|
||||||
"%02Xh", sc->sc_nid);
|
"%02Xh", sc->sc_nid);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: hdaudio.c,v 1.23 2014/09/19 17:23:35 christos Exp $ */
|
/* $NetBSD: hdaudio.c,v 1.24 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
|
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.23 2014/09/19 17:23:35 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.24 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -1631,43 +1631,4 @@ hdaudio_modcmd(modcmd_t cmd, void *opaque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hdaudio_load_verbose(void);
|
DEV_VERBOSE_DEFINE(hdaudio);
|
||||||
|
|
||||||
void get_hdaudio_vendor_stub(char *, size_t, hdaudio_vendor_id_t);
|
|
||||||
void get_hdaudio_product_stub(char *, size_t, hdaudio_vendor_id_t,
|
|
||||||
hdaudio_product_id_t);
|
|
||||||
|
|
||||||
void (*get_hdaudio_vendor)(char *, size_t, hdaudio_vendor_id_t) =
|
|
||||||
get_hdaudio_vendor_stub;
|
|
||||||
void (*get_hdaudio_product)(char *, size_t, hdaudio_vendor_id_t,
|
|
||||||
hdaudio_product_id_t) = get_hdaudio_product_stub;
|
|
||||||
|
|
||||||
int hdaudio_verbose_loaded = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load the hdaudioverbose module
|
|
||||||
*/
|
|
||||||
void hdaudio_load_verbose(void)
|
|
||||||
{
|
|
||||||
if (hdaudio_verbose_loaded == 0)
|
|
||||||
module_autoload("hdaudioverbose", MODULE_CLASS_MISC);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_hdaudio_vendor_stub(char *v, size_t l, hdaudio_vendor_id_t v_id)
|
|
||||||
{
|
|
||||||
hdaudio_load_verbose();
|
|
||||||
if (hdaudio_verbose_loaded)
|
|
||||||
get_hdaudio_vendor(v, l, v_id);
|
|
||||||
else
|
|
||||||
snprintf(v, l, "vendor 0x%.4x", v_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_hdaudio_product_stub(char *p, size_t l, hdaudio_vendor_id_t v_id,
|
|
||||||
hdaudio_product_id_t p_id)
|
|
||||||
{
|
|
||||||
hdaudio_load_verbose();
|
|
||||||
if (hdaudio_verbose_loaded)
|
|
||||||
get_hdaudio_product(p, l, v_id, p_id);
|
|
||||||
else
|
|
||||||
snprintf(p, l, "product 0x%.4x", p_id);
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/* $NetBSD: hdaudio_verbose.c,v 1.1 2014/09/19 17:23:35 christos Exp $ */
|
/* $NetBSD: hdaudio_verbose.c,v 1.2 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by Lennart Augustsson (lennart@augustsson.net) at
|
|
||||||
* Carlstedt Research & Technology.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -31,83 +27,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: hdaudio_verbose.c,v 1.1 2014/09/19 17:23:35 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: hdaudio_verbose.c,v 1.2 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
|
|
||||||
#include <dev/pci/hdaudio/hdaudio_verbose.h>
|
#include <dev/pci/hdaudio/hdaudio_verbose.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Descriptions of known vendors and devices ("products").
|
|
||||||
*/
|
|
||||||
struct hdaudio_vendor {
|
|
||||||
hdaudio_vendor_id_t vendor;
|
|
||||||
const char *vendorname;
|
|
||||||
};
|
|
||||||
struct hdaudio_product {
|
|
||||||
hdaudio_vendor_id_t vendor;
|
|
||||||
hdaudio_product_id_t product;
|
|
||||||
const char *productname;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include <dev/pci/hdaudio/hdaudiodevs.h>
|
#include <dev/pci/hdaudio/hdaudiodevs.h>
|
||||||
#include <dev/pci/hdaudio/hdaudiodevs_data.h>
|
#include <dev/pci/hdaudio/hdaudiodevs_data.h>
|
||||||
|
|
||||||
void get_hdaudio_vendor_real(char *, size_t, hdaudio_vendor_id_t);
|
DEV_VERBOSE_MODULE_DEFINE(hdaudio, NULL)
|
||||||
void get_hdaudio_product_real(char *, size_t, hdaudio_vendor_id_t, hdaudio_product_id_t);
|
|
||||||
|
|
||||||
MODULE(MODULE_CLASS_MISC, hdaudioverbose, NULL);
|
|
||||||
|
|
||||||
static int
|
|
||||||
hdaudioverbose_modcmd(modcmd_t cmd, void *arg)
|
|
||||||
{
|
|
||||||
static void (*saved_hdaudio_vendor)(char *, size_t, hdaudio_vendor_id_t);
|
|
||||||
static void (*saved_hdaudio_product)(char *, size_t, hdaudio_vendor_id_t,
|
|
||||||
hdaudio_product_id_t);
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case MODULE_CMD_INIT:
|
|
||||||
saved_hdaudio_vendor = get_hdaudio_vendor;
|
|
||||||
saved_hdaudio_product = get_hdaudio_product;
|
|
||||||
get_hdaudio_vendor = get_hdaudio_vendor_real;
|
|
||||||
get_hdaudio_product = get_hdaudio_product_real;
|
|
||||||
hdaudio_verbose_loaded = 1;
|
|
||||||
return 0;
|
|
||||||
case MODULE_CMD_FINI:
|
|
||||||
get_hdaudio_vendor = saved_hdaudio_vendor;
|
|
||||||
get_hdaudio_product = saved_hdaudio_product;
|
|
||||||
hdaudio_verbose_loaded = 0;
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
return ENOTTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_hdaudio_vendor_real(char *v, size_t vl, hdaudio_vendor_id_t v_id)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* There is no need for strlcpy below. */
|
|
||||||
for (n = 0; n < hdaudio_nvendors; n++)
|
|
||||||
if (hdaudio_vendors[n].vendor == v_id) {
|
|
||||||
strlcpy(v, hdaudio_vendors[n].vendorname, vl);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
snprintf(v, vl, "vendor 0x%.x", v_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_hdaudio_product_real(char *p, size_t pl, hdaudio_vendor_id_t v_id,
|
|
||||||
hdaudio_product_id_t p_id)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* There is no need for strlcpy below. */
|
|
||||||
for (n = 0; n < hdaudio_nproducts; n++)
|
|
||||||
if (hdaudio_products[n].vendor == v_id &&
|
|
||||||
hdaudio_products[n].product == p_id) {
|
|
||||||
strlcpy(p, hdaudio_products[n].productname, pl);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
snprintf(p, pl, "product 0x%.x", v_id);
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/* $NetBSD: hdaudio_verbose.h,v 1.1 2014/09/19 17:23:35 christos Exp $ */
|
/* $NetBSD: hdaudio_verbose.h,v 1.2 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by Lennart Augustsson (lennart@augustsson.net) at
|
|
||||||
* Carlstedt Research & Technology.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -33,13 +29,8 @@
|
|||||||
#ifndef _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_
|
#ifndef _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_
|
||||||
#define _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_
|
#define _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_
|
||||||
|
|
||||||
typedef u_int16_t hdaudio_vendor_id_t;
|
#include <dev/dev_verbose.h>
|
||||||
typedef u_int16_t hdaudio_product_id_t;
|
|
||||||
|
|
||||||
extern void (*get_hdaudio_vendor)(char *, size_t, hdaudio_vendor_id_t);
|
DEV_VERBOSE_DECLARE(hdaudio);
|
||||||
extern void (*get_hdaudio_product)(char *, size_t, hdaudio_vendor_id_t,
|
|
||||||
hdaudio_product_id_t);
|
|
||||||
|
|
||||||
extern int hdaudio_verbose_loaded;
|
|
||||||
|
|
||||||
#endif /* _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_ */
|
#endif /* _DEV_PCI_HDAUDIO_HDAUDIO_VERBOSE_H_ */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ohci_pci.c,v 1.52 2014/03/29 19:28:25 christos Exp $ */
|
/* $NetBSD: ohci_pci.c,v 1.53 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.52 2014/03/29 19:28:25 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.53 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include "ehci.h"
|
#include "ehci.h"
|
||||||
|
|
||||||
@ -90,7 +90,6 @@ ohci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
pci_intr_handle_t ih;
|
pci_intr_handle_t ih;
|
||||||
pcireg_t csr;
|
pcireg_t csr;
|
||||||
usbd_status r;
|
usbd_status r;
|
||||||
const char *vendor;
|
|
||||||
char intrbuf[PCI_INTRSTR_LEN];
|
char intrbuf[PCI_INTRSTR_LEN];
|
||||||
|
|
||||||
sc->sc.sc_dev = self;
|
sc->sc.sc_dev = self;
|
||||||
@ -154,14 +153,9 @@ ohci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
|
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
|
||||||
|
|
||||||
/* Figure out vendor for root hub descriptor. */
|
/* Figure out vendor for root hub descriptor. */
|
||||||
vendor = pci_findvendor(pa->pa_id);
|
|
||||||
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
||||||
if (vendor)
|
pci_findvendor(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
|
||||||
strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
|
sc->sc.sc_id_vendor);
|
||||||
else
|
|
||||||
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
|
|
||||||
"vendor 0x%04x", PCI_VENDOR(pa->pa_id));
|
|
||||||
|
|
||||||
r = ohci_init(&sc->sc);
|
r = ohci_init(&sc->sc);
|
||||||
if (r != USBD_NORMAL_COMPLETION) {
|
if (r != USBD_NORMAL_COMPLETION) {
|
||||||
aprint_error_dev(self, "init failed, error=%d\n", r);
|
aprint_error_dev(self, "init failed, error=%d\n", r);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: pci_subr.c,v 1.125 2014/09/05 05:29:16 matt Exp $ */
|
/* $NetBSD: pci_subr.c,v 1.126 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 Zubin D. Dittia. All rights reserved.
|
* Copyright (c) 1997 Zubin D. Dittia. All rights reserved.
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.125 2014/09/05 05:29:16 matt Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.126 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_pci.h"
|
#include "opt_pci.h"
|
||||||
@ -62,6 +62,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.125 2014/09/05 05:29:16 matt Exp $");
|
|||||||
#include <dev/pci/pcireg.h>
|
#include <dev/pci/pcireg.h>
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#include <dev/pci/pcivar.h>
|
#include <dev/pci/pcivar.h>
|
||||||
|
#else
|
||||||
|
#include <dev/pci/pci_verbose.h>
|
||||||
|
#include <dev/pci/pcidevs.h>
|
||||||
|
#include <dev/pci/pcidevs_data.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -538,92 +542,30 @@ static const struct pci_class pci_class[] = {
|
|||||||
NULL, },
|
NULL, },
|
||||||
};
|
};
|
||||||
|
|
||||||
void pci_load_verbose(void);
|
DEV_VERBOSE_DEFINE(pci);
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
|
||||||
/*
|
|
||||||
* In kernel, these routines are provided and linked via the
|
|
||||||
* pciverbose module.
|
|
||||||
*/
|
|
||||||
const char *pci_findvendor_stub(pcireg_t);
|
|
||||||
const char *pci_findproduct_stub(pcireg_t);
|
|
||||||
|
|
||||||
const char *(*pci_findvendor)(pcireg_t) = pci_findvendor_stub;
|
|
||||||
const char *(*pci_findproduct)(pcireg_t) = pci_findproduct_stub;
|
|
||||||
const char *pci_unmatched = "";
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* For userland we just set the vectors here.
|
|
||||||
*/
|
|
||||||
const char *(*pci_findvendor)(pcireg_t id_reg) = pci_findvendor_real;
|
|
||||||
const char *(*pci_findproduct)(pcireg_t id_reg) = pci_findproduct_real;
|
|
||||||
const char *pci_unmatched = "unmatched ";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int pciverbose_loaded = 0;
|
|
||||||
|
|
||||||
#if defined(_KERNEL)
|
|
||||||
/*
|
|
||||||
* Routine to load the pciverbose kernel module as needed
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pci_load_verbose(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (pciverbose_loaded == 0)
|
|
||||||
module_autoload("pciverbose", MODULE_CLASS_MISC);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
pci_findvendor_stub(pcireg_t id_reg)
|
|
||||||
{
|
|
||||||
|
|
||||||
pci_load_verbose();
|
|
||||||
if (pciverbose_loaded)
|
|
||||||
return pci_findvendor(id_reg);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
pci_findproduct_stub(pcireg_t id_reg)
|
|
||||||
{
|
|
||||||
|
|
||||||
pci_load_verbose();
|
|
||||||
if (pciverbose_loaded)
|
|
||||||
return pci_findproduct(id_reg);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp,
|
pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp,
|
||||||
size_t l)
|
size_t l)
|
||||||
{
|
{
|
||||||
pci_vendor_id_t vendor;
|
|
||||||
pci_product_id_t product;
|
|
||||||
pci_class_t pciclass;
|
pci_class_t pciclass;
|
||||||
pci_subclass_t subclass;
|
pci_subclass_t subclass;
|
||||||
pci_interface_t interface;
|
pci_interface_t interface;
|
||||||
pci_revision_t revision;
|
pci_revision_t revision;
|
||||||
const char *unmatched = pci_unmatched;
|
char vendor[PCI_VENDORSTR_LEN], product[PCI_PRODUCTSTR_LEN];
|
||||||
const char *vendor_namep, *product_namep;
|
|
||||||
const struct pci_class *classp, *subclassp, *interfacep;
|
const struct pci_class *classp, *subclassp, *interfacep;
|
||||||
char *ep;
|
char *ep;
|
||||||
|
|
||||||
ep = cp + l;
|
ep = cp + l;
|
||||||
|
|
||||||
vendor = PCI_VENDOR(id_reg);
|
|
||||||
product = PCI_PRODUCT(id_reg);
|
|
||||||
|
|
||||||
pciclass = PCI_CLASS(class_reg);
|
pciclass = PCI_CLASS(class_reg);
|
||||||
subclass = PCI_SUBCLASS(class_reg);
|
subclass = PCI_SUBCLASS(class_reg);
|
||||||
interface = PCI_INTERFACE(class_reg);
|
interface = PCI_INTERFACE(class_reg);
|
||||||
revision = PCI_REVISION(class_reg);
|
revision = PCI_REVISION(class_reg);
|
||||||
|
|
||||||
vendor_namep = pci_findvendor(id_reg);
|
pci_findvendor(vendor, sizeof(vendor), PCI_VENDOR(id_reg));
|
||||||
product_namep = pci_findproduct(id_reg);
|
pci_findproduct(product, sizeof(product), PCI_VENDOR(id_reg),
|
||||||
|
PCI_PRODUCT(id_reg));
|
||||||
|
|
||||||
classp = pci_class;
|
classp = pci_class;
|
||||||
while (classp->name != NULL) {
|
while (classp->name != NULL) {
|
||||||
@ -647,15 +589,7 @@ pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp,
|
|||||||
interfacep++;
|
interfacep++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vendor_namep == NULL)
|
cp += snprintf(cp, ep - cp, "%s %s", vendor, product);
|
||||||
cp += snprintf(cp, ep - cp, "%svendor 0x%04x product 0x%04x",
|
|
||||||
unmatched, vendor, product);
|
|
||||||
else if (product_namep != NULL)
|
|
||||||
cp += snprintf(cp, ep - cp, "%s %s", vendor_namep,
|
|
||||||
product_namep);
|
|
||||||
else
|
|
||||||
cp += snprintf(cp, ep - cp, "%s product 0x%04x",
|
|
||||||
vendor_namep, product);
|
|
||||||
if (showclass) {
|
if (showclass) {
|
||||||
cp += snprintf(cp, ep - cp, " (");
|
cp += snprintf(cp, ep - cp, " (");
|
||||||
if (classp->name == NULL)
|
if (classp->name == NULL)
|
||||||
@ -735,17 +669,20 @@ pci_conf_print_common(
|
|||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const struct pci_class *classp, *subclassp;
|
const struct pci_class *classp, *subclassp;
|
||||||
|
char vendor[PCI_VENDORSTR_LEN];
|
||||||
|
char product[PCI_PRODUCTSTR_LEN];
|
||||||
pcireg_t rval;
|
pcireg_t rval;
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
|
|
||||||
rval = regs[o2i(PCI_ID_REG)];
|
rval = regs[o2i(PCI_ID_REG)];
|
||||||
name = pci_findvendor(rval);
|
name = pci_findvendor(vendor, sizeof(vendor), PCI_VENDOR(rval));
|
||||||
if (name)
|
if (name)
|
||||||
printf(" Vendor Name: %s (0x%04x)\n", name,
|
printf(" Vendor Name: %s (0x%04x)\n", name,
|
||||||
PCI_VENDOR(rval));
|
PCI_VENDOR(rval));
|
||||||
else
|
else
|
||||||
printf(" Vendor ID: 0x%04x\n", PCI_VENDOR(rval));
|
printf(" Vendor ID: 0x%04x\n", PCI_VENDOR(rval));
|
||||||
name = pci_findproduct(rval);
|
name = pci_findproduct(product, sizeof(product), PCI_VENDOR(rval),
|
||||||
|
PCI_PRODUCT(rval));
|
||||||
if (name)
|
if (name)
|
||||||
printf(" Device Name: %s (0x%04x)\n", name,
|
printf(" Device Name: %s (0x%04x)\n", name,
|
||||||
PCI_PRODUCT(rval));
|
PCI_PRODUCT(rval));
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* $NetBSD: pci_verbose.c,v 1.8 2011/08/29 14:47:08 jmcneill Exp $ */
|
/* $NetBSD: pci_verbose.c,v 1.9 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 Zubin D. Dittia. All rights reserved.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* Copyright (c) 1995, 1996, 1998, 2000
|
* All rights reserved.
|
||||||
* Christopher G. Demetriou. All rights reserved.
|
|
||||||
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -14,22 +12,18 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* 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 Charles M. Hannum.
|
|
||||||
* 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
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -40,7 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: pci_verbose.c,v 1.8 2011/08/29 14:47:08 jmcneill Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: pci_verbose.c,v 1.9 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
@ -48,111 +42,12 @@ __KERNEL_RCSID(0, "$NetBSD: pci_verbose.c,v 1.8 2011/08/29 14:47:08 jmcneill Exp
|
|||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
#else
|
#else
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <dev/pci/pcireg.h>
|
#include <dev/pci/pcireg.h>
|
||||||
#include <dev/pci/pcidevs.h>
|
#include <dev/pci/pcidevs.h>
|
||||||
#ifdef _KERNEL
|
|
||||||
#include <dev/pci/pci_verbose.h>
|
#include <dev/pci/pci_verbose.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Descriptions of of known vendors and devices ("products").
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <dev/pci/pcidevs_data.h>
|
#include <dev/pci/pcidevs_data.h>
|
||||||
|
|
||||||
#ifndef _KERNEL
|
DEV_VERBOSE_MODULE_DEFINE(pci, "pci")
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
|
||||||
static int pciverbose_modcmd(modcmd_t, void *);
|
|
||||||
|
|
||||||
MODULE(MODULE_CLASS_MISC, pciverbose, "pci");
|
|
||||||
|
|
||||||
static int
|
|
||||||
pciverbose_modcmd(modcmd_t cmd, void *arg)
|
|
||||||
{
|
|
||||||
static const char *(*saved_findvendor)(pcireg_t);
|
|
||||||
static const char *(*saved_findproduct)(pcireg_t);
|
|
||||||
static const char *saved_unmatched;
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case MODULE_CMD_INIT:
|
|
||||||
saved_findvendor = pci_findvendor;
|
|
||||||
saved_findproduct = pci_findproduct;
|
|
||||||
saved_unmatched = pci_unmatched;
|
|
||||||
pci_findvendor = pci_findvendor_real;
|
|
||||||
pci_findproduct = pci_findproduct_real;
|
|
||||||
pci_unmatched = "unmatched ";
|
|
||||||
pciverbose_loaded = 1;
|
|
||||||
return 0;
|
|
||||||
case MODULE_CMD_FINI:
|
|
||||||
pci_findvendor = saved_findvendor;
|
|
||||||
pci_findproduct = saved_findproduct;
|
|
||||||
pci_unmatched = saved_unmatched;
|
|
||||||
pciverbose_loaded = 0;
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
return ENOTTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* KERNEL */
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
pci_untokenstring(const uint16_t *token, char *buf, size_t len)
|
|
||||||
{
|
|
||||||
char *cp = buf;
|
|
||||||
|
|
||||||
buf[0] = '\0';
|
|
||||||
for (; *token != 0; token++) {
|
|
||||||
cp = buf + strlcat(buf, pci_words + *token, len - 2);
|
|
||||||
cp[0] = ' ';
|
|
||||||
cp[1] = '\0';
|
|
||||||
}
|
|
||||||
*cp = '\0';
|
|
||||||
return cp != buf ? buf : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
pci_findvendor_real(pcireg_t id_reg)
|
|
||||||
{
|
|
||||||
static char buf[256];
|
|
||||||
pci_vendor_id_t vendor = PCI_VENDOR(id_reg);
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
for (n = 0; n < __arraycount(pci_vendors); n++) {
|
|
||||||
if (pci_vendors[n] == vendor)
|
|
||||||
return pci_untokenstring(&pci_vendors[n+1], buf,
|
|
||||||
sizeof(buf));
|
|
||||||
|
|
||||||
/* Skip Tokens */
|
|
||||||
n++;
|
|
||||||
while (pci_vendors[n] != 0 && n < __arraycount(pci_vendors))
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
pci_findproduct_real(pcireg_t id_reg)
|
|
||||||
{
|
|
||||||
static char buf[256];
|
|
||||||
pci_vendor_id_t vendor = PCI_VENDOR(id_reg);
|
|
||||||
pci_product_id_t product = PCI_PRODUCT(id_reg);
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
for (n = 0; n < __arraycount(pci_products); n++) {
|
|
||||||
if (pci_products[n] == vendor && pci_products[n+1] == product)
|
|
||||||
return pci_untokenstring(&pci_products[n+2], buf,
|
|
||||||
sizeof(buf));
|
|
||||||
|
|
||||||
/* Skip Tokens */
|
|
||||||
n += 2;
|
|
||||||
while (pci_products[n] != 0 && n < __arraycount(pci_products))
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* $NetBSD: pci_verbose.h,v 1.3 2010/06/06 18:58:24 pgoyette Exp $ */
|
/* $NetBSD: pci_verbose.h,v 1.4 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -12,39 +12,32 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* 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 Charles M. Hannum.
|
|
||||||
* 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
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DEV_PCI_PCIVERBOSE_H_
|
#ifndef _DEV_PCI_PCIVERBOSE_H_
|
||||||
#define _DEV_PCI_PCIVERBOSE_H_
|
#define _DEV_PCI_PCIVERBOSE_H_
|
||||||
|
|
||||||
/*
|
#include <dev/dev_verbose.h>
|
||||||
* Misc.
|
|
||||||
*/
|
|
||||||
typedef u_int32_t pcireg_t; /* configuration space register XXX */
|
|
||||||
|
|
||||||
const char *pci_findvendor_real(pcireg_t);
|
#ifdef _KERNEL
|
||||||
const char *pci_findproduct_real(pcireg_t);
|
typedef uint32_t pcireg_t; /* configuration space register XXX */
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int pciverbose_loaded;
|
#define PCI_VENDORSTR_LEN 64
|
||||||
|
#define PCI_PRODUCTSTR_LEN 64
|
||||||
|
|
||||||
extern const char *(*pci_findvendor)(pcireg_t);
|
DEV_VERBOSE_DECLARE(pci);
|
||||||
extern const char *(*pci_findproduct)(pcireg_t);
|
|
||||||
extern const char *pci_unmatched;
|
|
||||||
|
|
||||||
#endif /* _DEV_PCI_PCIVERBOSE_H_ */
|
#endif /* _DEV_PCI_PCIVERBOSE_H_ */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: uhci_pci.c,v 1.57 2014/03/29 19:28:25 christos Exp $ */
|
/* $NetBSD: uhci_pci.c,v 1.58 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.57 2014/03/29 19:28:25 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.58 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include "ehci.h"
|
#include "ehci.h"
|
||||||
|
|
||||||
@ -93,7 +93,6 @@ uhci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
char const *intrstr;
|
char const *intrstr;
|
||||||
pci_intr_handle_t ih;
|
pci_intr_handle_t ih;
|
||||||
pcireg_t csr;
|
pcireg_t csr;
|
||||||
const char *vendor;
|
|
||||||
usbd_status r;
|
usbd_status r;
|
||||||
int s;
|
int s;
|
||||||
char intrbuf[PCI_INTRSTR_LEN];
|
char intrbuf[PCI_INTRSTR_LEN];
|
||||||
@ -171,14 +170,9 @@ uhci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out vendor for root hub descriptor. */
|
/* Figure out vendor for root hub descriptor. */
|
||||||
vendor = pci_findvendor(pa->pa_id);
|
|
||||||
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
||||||
if (vendor)
|
pci_findvendor(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
|
||||||
strlcpy(sc->sc.sc_vendor, vendor, sizeof(sc->sc.sc_vendor));
|
sc->sc.sc_id_vendor);
|
||||||
else
|
|
||||||
snprintf(sc->sc.sc_vendor, sizeof(sc->sc.sc_vendor),
|
|
||||||
"vendor 0x%04x", PCI_VENDOR(pa->pa_id));
|
|
||||||
|
|
||||||
r = uhci_init(&sc->sc);
|
r = uhci_init(&sc->sc);
|
||||||
if (r != USBD_NORMAL_COMPLETION) {
|
if (r != USBD_NORMAL_COMPLETION) {
|
||||||
aprint_error_dev(self, "init failed, error=%d\n", r);
|
aprint_error_dev(self, "init failed, error=%d\n", r);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: xhci_pci.c,v 1.3 2014/03/29 19:28:25 christos Exp $ */
|
/* $NetBSD: xhci_pci.c,v 1.4 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.3 2014/03/29 19:28:25 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.4 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -156,13 +156,9 @@ xhci_pci_attach(device_t parent, device_t self, void *aux)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Figure out vendor for root hub descriptor. */
|
/* Figure out vendor for root hub descriptor. */
|
||||||
vendor = pci_findvendor(pa->pa_id);
|
|
||||||
sc->sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
sc->sc_id_vendor = PCI_VENDOR(pa->pa_id);
|
||||||
if (vendor)
|
pci_findvendor(sc->sc_vendor, sizeof(sc->sc_vendor),
|
||||||
strlcpy(sc->sc_vendor, vendor, sizeof(sc->sc_vendor));
|
sc->sc_id_vendor);
|
||||||
else
|
|
||||||
snprintf(sc->sc_vendor, sizeof(sc->sc_vendor),
|
|
||||||
"vendor 0x%04x", PCI_VENDOR(pa->pa_id));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
err = xhci_init(sc);
|
err = xhci_init(sc);
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
# $NetBSD: Makefile.usbdevs,v 1.6 2009/10/12 22:28:47 wiz Exp $
|
# $NetBSD: Makefile.usbdevs,v 1.7 2014/09/21 14:30:22 christos Exp $
|
||||||
|
|
||||||
# The header files depend on the correct version of usbdevs.
|
|
||||||
#
|
#
|
||||||
# Thus, the procedure is:
|
# As per tron@NetBSD.org, the proper procedure is
|
||||||
# 1) change usbdevs
|
#
|
||||||
# 2) commit usbdevs
|
# 1.) Change "src/sys/dev/usb/usbdevs".
|
||||||
# 3) _then_ generate header files
|
# 2.) Commit "src/sys/dev/usb/usbdevs".
|
||||||
# 4) commit them
|
# 3.) Execute "make -f Makefile.usbdevs" in "src/sys/dev/usb".
|
||||||
|
# 4.) Commit "src/sys/dev/usb/usbdevs.h" and "src/sys/dev/usb/usbdevs_data.h".
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
UNAME= uname
|
usbdevs.h usbdevs_data.h: ${.CURDIR}/../devlist2h.awk usbdevs
|
||||||
RM= rm
|
/bin/rm -f usbdevs.h usbdevs_data.h
|
||||||
|
${TOOL_AWK} -f ${.ALLSRC}
|
||||||
usbdevs.h usbdevs_data.h: usbdevs devlist2h.awk
|
|
||||||
${RM} -f usbdevs.h usbdevs_data.h
|
|
||||||
${TOOL_AWK} -v os=`${UNAME} -s` -f devlist2h.awk usbdevs
|
|
||||||
|
@ -1,227 +0,0 @@
|
|||||||
#! /usr/bin/awk -f
|
|
||||||
# $NetBSD: devlist2h.awk,v 1.14 2005/12/11 12:24:00 christos 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 = blanklines = 0
|
|
||||||
dfile="usbdevs_data.h"
|
|
||||||
hfile="usbdevs.h"
|
|
||||||
}
|
|
||||||
NR == 1 {
|
|
||||||
VERSION = $0
|
|
||||||
gsub("\\$", "", VERSION)
|
|
||||||
gsub(/ $/, "", VERSION)
|
|
||||||
|
|
||||||
if (os == "NetBSD")
|
|
||||||
printf("/*\t$NetBSD" "$\t*/\n\n") > dfile
|
|
||||||
else if (os == "FreeBSD")
|
|
||||||
printf("/*\t$FreeBSD" "$\t*/\n\n") > dfile
|
|
||||||
else if (os == "OpenBSD")
|
|
||||||
printf("/*\t$OpenBSD" "$\t*/\n\n") > dfile
|
|
||||||
else
|
|
||||||
printf("/* ??? */\n\n") > dfile
|
|
||||||
printf("/*\n") > dfile
|
|
||||||
printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
|
|
||||||
> dfile
|
|
||||||
printf(" *\n") > dfile
|
|
||||||
printf(" * generated from:\n") > dfile
|
|
||||||
printf(" *\t%s\n", VERSION) > dfile
|
|
||||||
printf(" */\n") > dfile
|
|
||||||
|
|
||||||
if (os == "NetBSD")
|
|
||||||
printf("/*\t$NetBSD" "$\t*/\n\n") > hfile
|
|
||||||
else if (os == "FreeBSD")
|
|
||||||
printf("/*\t$FreeBSD" "$\t*/\n\n") > hfile
|
|
||||||
else if (os == "OpenBSD")
|
|
||||||
printf("/*\t$OpenBSD" "$\t*/\n\n") > hfile
|
|
||||||
else
|
|
||||||
printf("/* ??? */\n\n") > hfile
|
|
||||||
printf("/*\n") > hfile
|
|
||||||
printf(" * THIS FILE IS 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
|
|
||||||
}
|
|
||||||
NF > 0 && $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\tUSB_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
|
|
||||||
}
|
|
||||||
NF > 0 && $1 == "product" {
|
|
||||||
nproducts++
|
|
||||||
|
|
||||||
products[nproducts, 1] = $2; # vendor name
|
|
||||||
products[nproducts, 2] = $3; # product id
|
|
||||||
products[nproducts, 3] = $4; # id
|
|
||||||
printf("#define\tUSB_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("const struct usb_vendor usb_vendors[] = {\n") > dfile
|
|
||||||
for (i = 1; i <= nvendors; i++) {
|
|
||||||
printf("\t{\n") > dfile
|
|
||||||
printf("\t USB_VENDOR_%s,\n", vendors[i, 1]) \
|
|
||||||
> dfile
|
|
||||||
|
|
||||||
printf("\t \"") > dfile
|
|
||||||
j = 3;
|
|
||||||
needspace = 0;
|
|
||||||
while ((i, j) in vendors) {
|
|
||||||
if (needspace)
|
|
||||||
printf(" ") > dfile
|
|
||||||
printf("%s", vendors[i, j]) > dfile
|
|
||||||
needspace = 1
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
printf("\",\n") > dfile
|
|
||||||
printf("\t},\n") > dfile
|
|
||||||
}
|
|
||||||
printf("};\n") > dfile
|
|
||||||
printf("const int usb_nvendors = %d;\n", nvendors) > dfile
|
|
||||||
|
|
||||||
printf("\n") > dfile
|
|
||||||
|
|
||||||
printf("const struct usb_product usb_products[] = {\n") > dfile
|
|
||||||
for (i = 1; i <= nproducts; i++) {
|
|
||||||
printf("\t{\n") > dfile
|
|
||||||
printf("\t USB_VENDOR_%s, USB_PRODUCT_%s_%s,\n",
|
|
||||||
products[i, 1], products[i, 1], products[i, 2]) \
|
|
||||||
> dfile
|
|
||||||
|
|
||||||
printf("\t \"") > dfile
|
|
||||||
j = 4;
|
|
||||||
needspace = 0;
|
|
||||||
while ((i, j) in products) {
|
|
||||||
if (needspace)
|
|
||||||
printf(" ") > dfile
|
|
||||||
printf("%s", products[i, j]) > dfile
|
|
||||||
needspace = 1
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
printf("\",\n") > dfile
|
|
||||||
printf("\t},\n") > dfile
|
|
||||||
}
|
|
||||||
printf("};\n") > dfile
|
|
||||||
printf("const int usb_nproducts = %d;\n", nproducts) > dfile
|
|
||||||
|
|
||||||
close(dfile)
|
|
||||||
close(hfile)
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: usb_subr.c,v 1.197 2014/09/12 16:40:38 skrll Exp $ */
|
/* $NetBSD: usb_subr.c,v 1.198 2014/09/21 14:30:22 christos Exp $ */
|
||||||
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
|
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.197 2014/09/12 16:40:38 skrll Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_compat_netbsd.h"
|
#include "opt_compat_netbsd.h"
|
||||||
@ -109,40 +109,7 @@ Static const char * const usbd_error_strs[] = {
|
|||||||
"XXX",
|
"XXX",
|
||||||
};
|
};
|
||||||
|
|
||||||
void usb_load_verbose(void);
|
DEV_VERBOSE_DEFINE(usb);
|
||||||
|
|
||||||
void get_usb_vendor_stub(char *, size_t, usb_vendor_id_t);
|
|
||||||
void get_usb_product_stub(char *, size_t, usb_vendor_id_t, usb_product_id_t);
|
|
||||||
|
|
||||||
void (*get_usb_vendor)(char *, size_t, usb_vendor_id_t) = get_usb_vendor_stub;
|
|
||||||
void (*get_usb_product)(char *, size_t, usb_vendor_id_t, usb_product_id_t) =
|
|
||||||
get_usb_product_stub;
|
|
||||||
|
|
||||||
int usb_verbose_loaded = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load the usbverbose module
|
|
||||||
*/
|
|
||||||
void usb_load_verbose(void)
|
|
||||||
{
|
|
||||||
if (usb_verbose_loaded == 0)
|
|
||||||
module_autoload("usbverbose", MODULE_CLASS_MISC);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_usb_vendor_stub(char *v, size_t l, usb_vendor_id_t v_id)
|
|
||||||
{
|
|
||||||
usb_load_verbose();
|
|
||||||
if (usb_verbose_loaded)
|
|
||||||
get_usb_vendor(v, l, v_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_usb_product_stub(char *p, size_t l, usb_vendor_id_t v_id,
|
|
||||||
usb_product_id_t p_id)
|
|
||||||
{
|
|
||||||
usb_load_verbose();
|
|
||||||
if (usb_verbose_loaded)
|
|
||||||
get_usb_product(p, l, v_id, p_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
usbd_errstr(usbd_status err)
|
usbd_errstr(usbd_status err)
|
||||||
@ -226,15 +193,10 @@ usbd_devinfo_vp(usbd_device_handle dev, char *v, size_t vl, char *p,
|
|||||||
usbd_trim_spaces(p);
|
usbd_trim_spaces(p);
|
||||||
}
|
}
|
||||||
if (v[0] == '\0')
|
if (v[0] == '\0')
|
||||||
get_usb_vendor(v, vl, UGETW(udd->idVendor));
|
usb_findvendor(v, vl, UGETW(udd->idVendor));
|
||||||
if (p[0] == '\0')
|
if (p[0] == '\0')
|
||||||
get_usb_product(p, pl, UGETW(udd->idVendor),
|
usb_findproduct(p, pl, UGETW(udd->idVendor),
|
||||||
UGETW(udd->idProduct));
|
UGETW(udd->idProduct));
|
||||||
|
|
||||||
if (v[0] == '\0')
|
|
||||||
snprintf(v, vl, "vendor 0x%04x", UGETW(udd->idVendor));
|
|
||||||
if (p[0] == '\0')
|
|
||||||
snprintf(p, pl, "product 0x%04x", UGETW(udd->idProduct));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
/* $NetBSD: usb_verbose.c,v 1.6 2011/12/23 00:51:48 jakllsch Exp $ */
|
/* $NetBSD: usb_verbose.c,v 1.7 2014/09/21 14:30:22 christos Exp $ */
|
||||||
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by Lennart Augustsson (lennart@augustsson.net) at
|
|
||||||
* Carlstedt Research & Technology.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -32,82 +27,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: usb_verbose.c,v 1.6 2011/12/23 00:51:48 jakllsch Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: usb_verbose.c,v 1.7 2014/09/21 14:30:22 christos Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
|
|
||||||
#include <dev/usb/usb.h>
|
#include <dev/usb/usb.h>
|
||||||
#include <dev/usb/usbdevs.h>
|
#include <dev/usb/usbdevs.h>
|
||||||
|
#include <dev/usb/usbdevs_data.h>
|
||||||
#include <dev/usb/usb_verbose.h>
|
#include <dev/usb/usb_verbose.h>
|
||||||
|
|
||||||
/*
|
DEV_VERBOSE_MODULE_DEFINE(usb, NULL)
|
||||||
* Descriptions of known vendors and devices ("products").
|
|
||||||
*/
|
|
||||||
struct usb_vendor {
|
|
||||||
usb_vendor_id_t vendor;
|
|
||||||
const char *vendorname;
|
|
||||||
};
|
|
||||||
struct usb_product {
|
|
||||||
usb_vendor_id_t vendor;
|
|
||||||
usb_product_id_t product;
|
|
||||||
const char *productname;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include <dev/usb/usbdevs_data.h>
|
|
||||||
|
|
||||||
void get_usb_vendor_real(char *, size_t, usb_vendor_id_t);
|
|
||||||
void get_usb_product_real(char *, size_t, usb_vendor_id_t, usb_product_id_t);
|
|
||||||
|
|
||||||
MODULE(MODULE_CLASS_MISC, usbverbose, NULL);
|
|
||||||
|
|
||||||
static int
|
|
||||||
usbverbose_modcmd(modcmd_t cmd, void *arg)
|
|
||||||
{
|
|
||||||
static void (*saved_usb_vendor)(char *, size_t, usb_vendor_id_t);
|
|
||||||
static void (*saved_usb_product)(char *, size_t, usb_vendor_id_t,
|
|
||||||
usb_product_id_t);
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
case MODULE_CMD_INIT:
|
|
||||||
saved_usb_vendor = get_usb_vendor;
|
|
||||||
saved_usb_product = get_usb_product;
|
|
||||||
get_usb_vendor = get_usb_vendor_real;
|
|
||||||
get_usb_product = get_usb_product_real;
|
|
||||||
usb_verbose_loaded = 1;
|
|
||||||
return 0;
|
|
||||||
case MODULE_CMD_FINI:
|
|
||||||
get_usb_vendor = saved_usb_vendor;
|
|
||||||
get_usb_product = saved_usb_product;
|
|
||||||
usb_verbose_loaded = 0;
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
return ENOTTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_usb_vendor_real(char *v, size_t vl, usb_vendor_id_t v_id)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* There is no need for strlcpy below. */
|
|
||||||
for (n = 0; n < usb_nvendors; n++)
|
|
||||||
if (usb_vendors[n].vendor == v_id) {
|
|
||||||
strlcpy(v, usb_vendors[n].vendorname, vl);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_usb_product_real(char *p, size_t pl, usb_vendor_id_t v_id,
|
|
||||||
usb_product_id_t p_id)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* There is no need for strlcpy below. */
|
|
||||||
for (n = 0; n < usb_nproducts; n++)
|
|
||||||
if (usb_products[n].vendor == v_id &&
|
|
||||||
usb_products[n].product == p_id) {
|
|
||||||
strlcpy(p, usb_products[n].productname, pl);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/* $NetBSD: usb_verbose.h,v 1.3 2010/08/07 21:09:48 christos Exp $ */
|
/* $NetBSD: usb_verbose.h,v 1.4 2014/09/21 14:30:22 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
|
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to The NetBSD Foundation
|
|
||||||
* by Lennart Augustsson (lennart@augustsson.net) at
|
|
||||||
* Carlstedt Research & Technology.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -33,13 +29,8 @@
|
|||||||
#ifndef _DEV_USB_USBVERBOSE_H_
|
#ifndef _DEV_USB_USBVERBOSE_H_
|
||||||
#define _DEV_USB_USBVERBOSE_H_
|
#define _DEV_USB_USBVERBOSE_H_
|
||||||
|
|
||||||
typedef u_int16_t usb_vendor_id_t;
|
#include <dev/dev_verbose.h>
|
||||||
typedef u_int16_t usb_product_id_t;
|
|
||||||
|
|
||||||
extern void (*get_usb_vendor)(char *, size_t, usb_vendor_id_t);
|
DEV_VERBOSE_DECLARE(usb);
|
||||||
extern void (*get_usb_product)(char *, size_t, usb_vendor_id_t,
|
|
||||||
usb_product_id_t);
|
|
||||||
|
|
||||||
extern int usb_verbose_loaded;
|
|
||||||
|
|
||||||
#endif /* _DEV_USB_USBVERBOSE_H_ */
|
#endif /* _DEV_USB_USBVERBOSE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user