NetBSD re-synchronization of the source tree

This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
This commit is contained in:
2016-01-13 20:32:14 +01:00
parent 8933525b85
commit 0a6a1f1d05
32425 changed files with 2998492 additions and 1342217 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
# $NetBSD: Makefile,v 1.35 2012/06/20 21:38:26 sjg Exp $
# $NetBSD: Makefile,v 1.37 2015/08/02 11:09:05 jmcneill Exp $
#__MINIX: a lot not imported
SUBDIR= \
i2c \
pci \
+205
View File
@@ -0,0 +1,205 @@
/* $NetBSD: clock_subr.c,v 1.26 2014/12/22 18:09:20 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*
* from: Utah $Hdr: clock.c 1.18 91/01/21$
*
* @(#)clock.c 8.2 (Berkeley) 1/12/94
*/
/*
* Generic routines to convert between a POSIX date
* (seconds since 1/1/1970) and yr/mo/day/hr/min/sec
* Derived from arch/hp300/hp300/clock.c
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif /* HAVE_NBTOOL_CONFIG_H */
#ifdef _KERNEL
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock_subr.c,v 1.26 2014/12/22 18:09:20 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#else /* ! _KERNEL */
#include <string.h>
#include <time.h>
#include <errno.h>
#endif /* ! _KERNEL */
#include "../sys/clock.h"
#include <dev/clock_subr.h>
#define FEBRUARY 2
/* for easier alignment:
* time from the epoch to 2000 (there were 7 leap years): */
#define DAYSTO2000 (365*30+7)
/* 4 year intervals include 1 leap year */
#define DAYS4YEARS (365*4+1)
/* 100 year intervals include 24 leap years */
#define DAYS100YEARS (365*100+24)
/* 400 year intervals include 97 leap years */
#define DAYS400YEARS (365*400+97)
time_t
clock_ymdhms_to_secs(struct clock_ymdhms *dt)
{
uint64_t secs, i, year, days;
year = dt->dt_year;
/*
* Compute days since start of time
* First from years, then from months.
*/
if (year < POSIX_BASE_YEAR)
return -1;
days = 0;
if (is_leap_year(year) && dt->dt_mon > FEBRUARY)
days++;
if (year < 2000) {
/* simple way for early years */
for (i = POSIX_BASE_YEAR; i < year; i++)
days += days_per_year(i);
} else {
/* years are properly aligned */
days += DAYSTO2000;
year -= 2000;
i = year / 400;
days += i * DAYS400YEARS;
year -= i * 400;
i = year / 100;
days += i * DAYS100YEARS;
year -= i * 100;
i = year / 4;
days += i * DAYS4YEARS;
year -= i * 4;
for (i = dt->dt_year-year; i < dt->dt_year; i++)
days += days_per_year(i);
}
/* Months */
for (i = 1; i < dt->dt_mon; i++)
days += days_in_month(i);
days += (dt->dt_day - 1);
/* Add hours, minutes, seconds. */
secs = (((uint64_t)days
* 24 + dt->dt_hour)
* 60 + dt->dt_min)
* 60 + dt->dt_sec;
if ((time_t)secs < 0 || secs > __type_max(time_t))
return -1;
return secs;
}
int
clock_secs_to_ymdhms(time_t secs, struct clock_ymdhms *dt)
{
int leap;
uint64_t i;
time_t days;
time_t rsec; /* remainder seconds */
if (secs < 0)
return EINVAL;
days = secs / SECS_PER_DAY;
rsec = secs % SECS_PER_DAY;
/* Day of week (Note: 1/1/1970 was a Thursday) */
dt->dt_wday = (days + 4) % 7;
if (days >= DAYSTO2000) {
days -= DAYSTO2000;
dt->dt_year = 2000;
i = days / DAYS400YEARS;
days -= i*DAYS400YEARS;
dt->dt_year += i*400;
i = days / DAYS100YEARS;
days -= i*DAYS100YEARS;
dt->dt_year += i*100;
i = days / DAYS4YEARS;
days -= i*DAYS4YEARS;
dt->dt_year += i*4;
for (i = dt->dt_year; days >= days_per_year(i); i++)
days -= days_per_year(i);
dt->dt_year = i;
} else {
/* Subtract out whole years, counting them in i. */
for (i = POSIX_BASE_YEAR; days >= days_per_year(i); i++)
days -= days_per_year(i);
dt->dt_year = i;
}
/* Subtract out whole months, counting them in i. */
for (leap = 0, i = 1; days >= days_in_month(i)+leap; i++) {
days -= days_in_month(i)+leap;
if (i == 1 && is_leap_year(dt->dt_year))
leap = 1;
else
leap = 0;
}
dt->dt_mon = i;
/* Days are what is left over (+1) from all that. */
dt->dt_day = days + 1;
/* Hours, minutes, seconds are easy */
dt->dt_hour = rsec / SECS_PER_HOUR;
rsec = rsec % SECS_PER_HOUR;
dt->dt_min = rsec / SECS_PER_MINUTE;
rsec = rsec % SECS_PER_MINUTE;
dt->dt_sec = rsec;
return 0;
}
+111
View File
@@ -0,0 +1,111 @@
/* $NetBSD: clock_subr.h,v 1.25 2014/11/20 16:26:34 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Gordon W. Ross
*
* 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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_CLOCK_SUBR_H_
#define _DEV_CLOCK_SUBR_H_
#include <sys/clock.h>
/*
* "POSIX time" to/from "YY/MM/DD/hh/mm/ss"
*/
struct clock_ymdhms {
uint64_t dt_year;
uint8_t dt_mon;
uint8_t dt_day;
uint8_t dt_wday; /* Day of week */
uint8_t dt_hour;
uint8_t dt_min;
uint8_t dt_sec;
};
time_t clock_ymdhms_to_secs(struct clock_ymdhms *);
int clock_secs_to_ymdhms(time_t, struct clock_ymdhms *);
/*
* BCD to binary and binary to BCD.
*/
static inline unsigned int
bcdtobin(unsigned int bcd)
{
return ((bcd >> 4) & 0x0f) * 10 + (bcd & 0x0f);
}
static inline unsigned int
bintobcd(unsigned int bin)
{
return (((bin / 10) << 4) & 0xf0) | (bin % 10);
}
/*
* Interface to time-of-day clock devices.
*
* todr_gettime: convert time-of-day clock into a `struct timeval'
* todr_settime: set time-of-day clock from a `struct timeval'
*
* (this is probably not so useful:)
* todr_setwen: provide a machine-dependent TOD clock write-enable callback
* function which takes one boolean argument:
* 1 to enable writes; 0 to disable writes.
*/
struct timeval;
struct todr_chip_handle {
void *cookie; /* Device specific data */
void *bus_cookie; /* Bus specific data */
time_t base_time; /* Base time (e.g. rootfs time) */
int (*todr_gettime)(struct todr_chip_handle *, struct timeval *);
int (*todr_settime)(struct todr_chip_handle *, struct timeval *);
int (*todr_gettime_ymdhms)(struct todr_chip_handle *,
struct clock_ymdhms *);
int (*todr_settime_ymdhms)(struct todr_chip_handle *,
struct clock_ymdhms *);
int (*todr_setwen)(struct todr_chip_handle *, int);
};
typedef struct todr_chip_handle *todr_chip_handle_t;
#define todr_wenable(ct, v) if ((ct)->todr_setwen) \
((*(ct)->todr_setwen)(ct, v))
/*
* Probably these should evolve into internal routines in kern_todr.c.
*/
extern int todr_gettime(todr_chip_handle_t, struct timeval *);
extern int todr_settime(todr_chip_handle_t, struct timeval *);
/*
* Machine-dependent function that machine-independent RTC drivers can
* use to register their todr_chip_handle_t with inittodr()/resettodr().
*/
void todr_attach(todr_chip_handle_t);
#endif /* _DEV_CLOCK_SUBR_H_ */
+94
View 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
View 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_ */
+5 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: comreg.h,v 1.22 2013/10/03 13:23:03 kiyohara Exp $ */
/* $NetBSD: comreg.h,v 1.24 2015/03/07 15:49:20 macallan Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -50,6 +50,7 @@
#define IER_ERTS 0x40 /* Enable RTS interrupt */
#define IER_ECTS 0x80 /* Enable CTS interrupt */
/* PXA2X0's ns16550 ports have extra bits in this register */
/* Ingenic's got this one too */
#define IER_ERXTOUT 0x10 /* Enable rx timeout interrupt */
#define IER_EUART 0x40 /* Enable UART */
@@ -72,6 +73,7 @@
#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
#define FIFO_DMA_MODE 0x08
#define FIFO_UART_ON 0x10 /* JZ47xx only */
#define FIFO_64B_ENABLE 0x20 /* 64byte FIFO Enable (16750) */
#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
@@ -110,7 +112,9 @@
/* modem control register */
#define MCR_PRESCALE 0x80 /* 16650/16950: Baud rate prescaler select */
#define MCR_MDCE 0x80 /* Ingenic: modem control enable */
#define MCR_TCR_TLR 0x40 /* OMAP: enables access to the TCR & TLR regs */
#define MCR_FCM 0x40 /* Ingenic: 1 - hardware flow control */
#define MCR_XONENABLE 0x20 /* OMAP XON_EN */
#define MCR_AFE 0x20 /* tl16c750: Flow Control Enable */
#define MCR_LOOPBACK 0x10 /* Loop test: echos from TX to RX */
+1 -1
View File
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 2009/09/16 20:58:07 sborrill Exp $
# $NetBSD: Makefile,v 1.14 2015/03/28 14:41:28 msaitoh Exp $
# use 'make -f Makefile.pcidevs' to make pcidevs.h and pcidevs_data.h
+4 -1
View File
@@ -1,5 +1,5 @@
/*-
* $NetBSD: if_lmc.h,v 1.21 2012/10/27 17:18:33 chs Exp $
* $NetBSD: if_lmc.h,v 1.22 2015/09/06 06:01:00 dholland Exp $
*
* Copyright (c) 2002-2006 David Boggs. (boggs@boggs.palo-alto.ca.us)
* All rights reserved.
@@ -47,6 +47,9 @@
#ifndef IF_LMC_H
#define IF_LMC_H
#include <sys/ioccom.h>
#define DEVICE_NAME "lmc"
#define VER_YEAR 2006
+4 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: mlyio.h,v 1.4 2008/04/28 20:23:55 martin Exp $ */
/* $NetBSD: mlyio.h,v 1.5 2015/09/06 06:01:00 dholland Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -68,6 +68,9 @@
#ifndef _PCI_MLYIO_H_
#define _PCI_MLYIO_H_
#include <sys/ioccom.h>
struct mly_user_command {
unsigned char ControllerNumber;
union mly_cmd_packet CommandMailbox;
+2312 -671
View File
File diff suppressed because it is too large Load Diff
+17 -122
View File
@@ -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) 1995, 1996, 1998, 2000
* Christopher G. Demetriou. All rights reserved.
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -14,22 +12,18 @@
* 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 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
* 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 SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/*
@@ -40,7 +34,7 @@
*/
#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>
@@ -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>
#else
#include <pci.h>
#include <string.h>
#endif
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#ifdef _KERNEL
#include <dev/pci/pci_verbose.h>
#endif
/*
* Descriptions of of known vendors and devices ("products").
*/
#include <dev/pci/pcidevs_data.h>
#ifndef _KERNEL
#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);
}
DEV_VERBOSE_MODULE_DEFINE(pci, "pci")
+43
View File
@@ -0,0 +1,43 @@
/* $NetBSD: pci_verbose.h,v 1.4 2014/09/21 14:30:22 christos Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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_PCI_PCIVERBOSE_H_
#define _DEV_PCI_PCIVERBOSE_H_
#include <dev/dev_verbose.h>
#ifdef _KERNEL
typedef uint32_t pcireg_t; /* configuration space register XXX */
#endif
#define PCI_VENDORSTR_LEN 64
#define PCI_PRODUCTSTR_LEN 64
DEV_VERBOSE_DECLARE(pci);
#endif /* _DEV_PCI_PCIVERBOSE_H_ */
+620 -19
View File
File diff suppressed because it is too large Load Diff
+619 -18
View File
File diff suppressed because it is too large Load Diff
+9542 -8105
View File
File diff suppressed because it is too large Load Diff
+18 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: pciio.h,v 1.3 2009/06/06 12:56:43 cegger Exp $ */
/* $NetBSD: pciio.h,v 1.4 2014/07/25 01:38:26 mrg Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -93,6 +93,23 @@ struct pciio_businfo {
#define PCI_IOC_BUSINFO _IOR('P', 4, struct pciio_businfo)
/*
* pciio_drvname:
*
* Driver info for a PCI device (autoconfiguration node) instance.
* Must be run on the correct bus.
*/
#define PCI_IO_DRVNAME_LEN 16
struct pciio_drvname {
u_int device; /* in: device number */
u_int function; /* in: function number */
char name[PCI_IO_DRVNAME_LEN];
};
#define PCI_IOC_DRVNAME _IOWR('P', 5, struct pciio_drvname)
#if defined(__minix)
struct pciio_map {
int flags; /* reserved, must be 0 */
+880 -77
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: edid.c,v 1.12 2013/02/08 16:35:10 skrll Exp $ */
/* $NetBSD: edid.c,v 1.13 2014/11/17 00:46:04 jmcneill Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.12 2013/02/08 16:35:10 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.13 2014/11/17 00:46:04 jmcneill Exp $");
#include <sys/param.h>
#if defined(__minix)
@@ -295,6 +295,8 @@ edid_print(struct edid_info *edid)
DIVIDE(DIVIDE(edid->edid_preferred_mode->dot_clock * 1000,
edid->edid_preferred_mode->htotal),
edid->edid_preferred_mode->vtotal));
printf("Number of extension blocks: %d\n", edid->edid_ext_block_count);
}
static const struct videomode *
@@ -578,6 +580,8 @@ edid_parse(uint8_t *data, struct edid_info *edid)
edid->edid_chroma.ec_whitex = EDID_CHROMA_WHITEX(data);
edid->edid_chroma.ec_whitey = EDID_CHROMA_WHITEY(data);
edid->edid_ext_block_count = EDID_EXT_BLOCK_COUNT(data);
/* lookup established modes */
edid->edid_nmodes = 0;
edid->edid_preferred_mode = NULL;
+3 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: edidreg.h,v 1.3 2011/03/30 18:49:56 jdc Exp $ */
/* $NetBSD: edidreg.h,v 1.4 2014/11/17 00:46:04 jmcneill Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -250,4 +250,6 @@
#define EDID_DESC_STD_TIMING_START 5
#define EDID_DESC_STD_TIMING_COUNT 6
#define EDID_EXT_BLOCK_COUNT(ptr) ((ptr)[126])
#endif /* _DEV_VIDEOMODE_EDIDREG_H */
+2 -1
View File
@@ -1,4 +1,4 @@
/* $NetBSD: edidvar.h,v 1.2 2006/05/11 19:05:41 gdamore Exp $ */
/* $NetBSD: edidvar.h,v 1.3 2014/11/17 00:46:04 jmcneill Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -75,6 +75,7 @@ struct edid_info {
uint8_t edid_max_vsize; /* in cm */
uint8_t edid_gamma;
uint8_t edid_features;
uint8_t edid_ext_block_count;
int edid_have_range;
struct edid_range edid_range;
+1 -3
View File
@@ -36,11 +36,9 @@ __KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.4 2011/04/09 20:53:39 christos Exp $"
#if !defined(__minix)
#include "opt_videomode.h"
#else
#include <lib/libkern/libkern.h>
#include <minix/sysutil.h>
#endif /* !defined(__minix) */
#ifndef abs
#define abs(x) (((x) < 0) ? -(x) : (x))
#endif
#ifdef PICKMODE_DEBUG
#define DPRINTF printf
+6 -6
View File
@@ -1,4 +1,4 @@
/* $NetBSD: vesagtf.c,v 1.2 2013/09/15 15:56:07 martin Exp $ */
/* $NetBSD: vesagtf.c,v 1.3 2014/03/21 22:00:00 dholland Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -38,7 +38,7 @@
* Note that I have heavily modified the program for use in the EDID
* kernel code for NetBSD, including removing the use of floating
* point operations and making significant adjustments to minimize
* error propogation while operating with integer only math.
* error propagation while operating with integer only math.
*
* This has required the use of 64-bit integers in a few places, but
* the upshot is that for a calculation of 1920x1200x85 (as an
@@ -153,7 +153,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vesagtf.c,v 1.2 2013/09/15 15:56:07 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: vesagtf.c,v 1.3 2014/03/21 22:00:00 dholland Exp $");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -343,7 +343,7 @@ vesagtf_mode_params(unsigned h_pixels, unsigned v_lines, unsigned freq,
*
* Finally we multiply by another 1000, to get value in picosec.
* Why picosec? To minimize rounding errors. Gotta love integer
* math and error propogation.
* math and error propagation.
*/
h_period_est = DIVIDE(((DIVIDE(2000000000000ULL, v_field_rqd)) -
@@ -402,7 +402,7 @@ vesagtf_mode_params(unsigned h_pixels, unsigned v_lines, unsigned freq,
* [V FIELD RATE EST] = 1000000000 / [H PERIOD EST] / [TOTAL V LINES]
*
* This is all scaled to get the result in uHz. Again, we're trying to
* minimize error propogation.
* minimize error propagation.
*/
v_field_est = DIVIDE(DIVIDE(1000000000000000ULL, h_period_est),
total_v_lines);
@@ -495,7 +495,7 @@ vesagtf_mode_params(unsigned h_pixels, unsigned v_lines, unsigned freq,
*
* The ending result is that our ideal_duty_cycle is 256000x larger
* than the duty cycle used by VESA. But again, this reduces error
* propogation.
* propagation.
*/
ideal_duty_cycle =
+3 -2
View File
@@ -1,4 +1,4 @@
/* $NetBSD: vndvar.h,v 1.33 2013/06/03 16:42:32 christos Exp $ */
/* $NetBSD: vndvar.h,v 1.35 2015/09/06 06:00:59 dholland Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -70,6 +70,7 @@
#ifndef _SYS_DEV_VNDVAR_H_
#define _SYS_DEV_VNDVAR_H_
#include <sys/ioccom.h>
#if !defined(__minix)
#include <sys/pool.h>
#endif /* defined(__minix) */
@@ -115,7 +116,7 @@ struct vnode;
* A vnode disk's state information.
*/
struct vnd_softc {
device_t sc_dev;
device_t sc_dev;
int sc_flags; /* flags */
uint64_t sc_size; /* size of vnd */
struct vnode *sc_vp; /* vnode */