MFC
This commit is contained in:
commit
b38f2c5884
@ -107,14 +107,12 @@ static const char *syntax[513];
|
||||
static int base;
|
||||
static int size; /* number of values which a char variable can have */
|
||||
static int nbits; /* number of bits in a character */
|
||||
static int digit_contig;/* true if digits are contiguous */
|
||||
|
||||
static void filltable(const char *);
|
||||
static void init(void);
|
||||
static void add(const char *, const char *);
|
||||
static void print(const char *);
|
||||
static void output_type_macros(void);
|
||||
static void digit_convert(void);
|
||||
|
||||
int
|
||||
main(int argc __unused, char **argv __unused)
|
||||
@ -125,7 +123,6 @@ main(int argc __unused, char **argv __unused)
|
||||
int i;
|
||||
char buf[80];
|
||||
int pos;
|
||||
static char digit[] = "0123456789";
|
||||
|
||||
/* Create output files */
|
||||
if ((cfile = fopen("syntax.c", "w")) == NULL) {
|
||||
@ -158,11 +155,6 @@ main(int argc __unused, char **argv __unused)
|
||||
base = 1;
|
||||
if (sign)
|
||||
base += 1 << (nbits - 1);
|
||||
digit_contig = 1;
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
if (digit[i] != '0' + i)
|
||||
digit_contig = 0;
|
||||
}
|
||||
|
||||
fputs("#include <sys/cdefs.h>\n", hfile);
|
||||
|
||||
@ -248,8 +240,6 @@ main(int argc __unused, char **argv __unused)
|
||||
add("_", "ISUNDER");
|
||||
add("#?$!-*@", "ISSPECL");
|
||||
print("is_type");
|
||||
if (! digit_contig)
|
||||
digit_convert();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -341,12 +331,13 @@ print(const char *name)
|
||||
*/
|
||||
|
||||
static const char *macro[] = {
|
||||
"#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)",
|
||||
"#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)",
|
||||
"#define is_eof(c)\t((c) == PEOF)",
|
||||
"#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))",
|
||||
"#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))",
|
||||
"#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))",
|
||||
"#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))",
|
||||
"#define digit_val(c)\t((c) - '0')",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -355,41 +346,6 @@ output_type_macros(void)
|
||||
{
|
||||
const char **pp;
|
||||
|
||||
if (digit_contig)
|
||||
macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
|
||||
for (pp = macro ; *pp ; pp++)
|
||||
fprintf(hfile, "%s\n", *pp);
|
||||
if (digit_contig)
|
||||
fputs("#define digit_val(c)\t((c) - '0')\n", hfile);
|
||||
else
|
||||
fputs("#define digit_val(c)\t(digit_value[c])\n", hfile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Output digit conversion table (if digits are not contiguous).
|
||||
*/
|
||||
|
||||
static void
|
||||
digit_convert(void)
|
||||
{
|
||||
int maxdigit;
|
||||
static char digit[] = "0123456789";
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
maxdigit = 0;
|
||||
for (p = digit ; *p ; p++)
|
||||
if (*p > maxdigit)
|
||||
maxdigit = *p;
|
||||
fputs("extern const char digit_value[];\n", hfile);
|
||||
fputs("\n\nconst char digit_value[] = {\n", cfile);
|
||||
for (i = 0 ; i <= maxdigit ; i++) {
|
||||
for (p = digit ; *p && *p != i ; p++);
|
||||
if (*p == '\0')
|
||||
p = digit;
|
||||
fprintf(cfile, " %d,\n", (int)(p - digit));
|
||||
}
|
||||
fputs("};\n", cfile);
|
||||
}
|
||||
|
@ -100,6 +100,8 @@
|
||||
dev
|
||||
acpica
|
||||
..
|
||||
agp
|
||||
..
|
||||
an
|
||||
..
|
||||
bktr
|
||||
@ -136,6 +138,8 @@
|
||||
..
|
||||
pbio
|
||||
..
|
||||
pci
|
||||
..
|
||||
powermac_nvram
|
||||
..
|
||||
ppbus
|
||||
|
@ -35,6 +35,7 @@ pfsync_start()
|
||||
if [ -n "${pfsync_syncpeer}" ]; then
|
||||
_syncpeer="syncpeer ${pfsync_syncpeer}"
|
||||
fi
|
||||
load_kld pfsync
|
||||
ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up
|
||||
}
|
||||
|
||||
|
@ -11437,233 +11437,6 @@ two new uses for sheep. Meat and wool.
|
||||
%
|
||||
Runners do it alone.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(1) The greatest threat to the human spirit is liberalism.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(10) Liberalism poisons the soul.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(11) Neither the United States, nor anyone else, "imposes" freedom on
|
||||
the people of other nations. Freedom is not an imposition.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(12) Freedom is God-given.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(13) To dictatorships, peace means the absence of opposition.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(14) To free people, peace means the absence of threat.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(15) The Peace Movement in the United States was, whether by accident or
|
||||
design, pro-communist.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(16) The collective knowledge and wisdom of seasoned citizens is the
|
||||
most valuable, yet untapped, resource our young people have.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(17) The greatest football team in the history of civilization was the
|
||||
Pittsburgh Steelers of 1975 through 1980.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(18) There is no such thing as "war atrocities." War is an atrocity.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(19) Regardless of the pain in our memories, nostalgia only reminds us
|
||||
of the good times in our past.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(2) The single greatest threat to the free people of the world is posed
|
||||
by the heinous idea of centralized government control.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(20) There is a God.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(21) Abortion is wrong.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(22) Morality is not defined by individual choice.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(23) Evolution cannot explain creation.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(24) Feminism was established so that unattractive women could have
|
||||
easier access to the mainstream of society.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(25) Love is the only human emotion which cannot be controlled. You
|
||||
either do or you don't. You can't fake it. (Except women, and
|
||||
thank God they can.)
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(26) The only difference between Mikhail Gorbachev and previous Soviet
|
||||
leaders is that he is alive.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(27) Soviet leaders were actually left-wing dictators.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(28) Abraham Lincoln saved this nation.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(29) The Los Angeles Raiders will never be the team they were when they
|
||||
called Oakland home.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(3) Peace does not mean the elimination of nuclear weapons.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(30) The United States will again go to war.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(31) To more and more American intellectuals, a victorious United States
|
||||
is a sinful United States.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(32) The fact that American intellectuals rue a victorious United States
|
||||
is frightening and ominous.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(33) There will always be poor people.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(34) The fact that there will always be poor people is not the fault of
|
||||
the rich.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(35) Rather than feel guilty as some do, you should thank God for making
|
||||
you an American.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(4) Peace does not mean the absence of war.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(5) War is not obsolete.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(6) Ours is a world governed by the aggressive use of force.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(7) There is only one way to eliminate nuclear weapons. Use them.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(8) Peace cannot be achieved merely by developing an "understanding"
|
||||
among peoples.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Rush Limbaugh's 35 Undeniable Truths of Life:
|
||||
|
||||
(9) Americans opposing America is not always sacred nor courageous ...
|
||||
it is sometimes dangerous.
|
||||
|
||||
-- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc.
|
||||
%
|
||||
Said a dainty young whore named Ms. Meggs,
|
||||
"The men like to spread my two legs,
|
||||
Then slip in between,
|
||||
|
@ -42,9 +42,10 @@ LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
|
||||
sys vm
|
||||
|
||||
LSUBDIRS= cam/ata cam/scsi \
|
||||
dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \
|
||||
dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
|
||||
dev/hwpmc \
|
||||
dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
|
||||
dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
|
||||
dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
|
||||
dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
|
||||
fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
|
||||
fs/procfs fs/udf fs/unionfs \
|
||||
@ -154,7 +155,7 @@ copies:
|
||||
done
|
||||
.endif
|
||||
.endfor
|
||||
.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
|
||||
.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
|
||||
cd ${.CURDIR}/../sys; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
|
||||
${DESTDIR}${INCLUDEDIR}/$i
|
||||
@ -162,6 +163,9 @@ copies:
|
||||
cd ${.CURDIR}/../sys/dev/acpica; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/acpica
|
||||
cd ${.CURDIR}/../sys/dev/agp; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/agp
|
||||
cd ${.CURDIR}/../sys/dev/bktr; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/bktr
|
||||
@ -172,6 +176,9 @@ copies:
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/nand
|
||||
.endif
|
||||
cd ${.CURDIR}/../sys/dev/pci; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/pci
|
||||
cd ${.CURDIR}/../sys/contrib/altq/altq; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
|
||||
${DESTDIR}${INCLUDEDIR}/altq
|
||||
@ -225,7 +232,7 @@ symlinks:
|
||||
ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
|
||||
done
|
||||
.endfor
|
||||
.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand}
|
||||
.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
|
||||
cd ${.CURDIR}/../sys/$i; \
|
||||
for h in *.h; do \
|
||||
ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
|
||||
@ -236,6 +243,11 @@ symlinks:
|
||||
ln -fs ../../../../sys/dev/acpica/$$h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/acpica; \
|
||||
done
|
||||
cd ${.CURDIR}/../sys/dev/agp; \
|
||||
for h in agpreg.h; do \
|
||||
ln -fs ../../../../sys/dev/agp/$$h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/agp; \
|
||||
done
|
||||
cd ${.CURDIR}/../sys/dev/bktr; \
|
||||
for h in ioctl_*.h; do \
|
||||
ln -fs ../../../../sys/dev/bktr/$$h \
|
||||
@ -248,6 +260,11 @@ symlinks:
|
||||
${DESTDIR}${INCLUDEDIR}/dev/nand; \
|
||||
done
|
||||
.endif
|
||||
cd ${.CURDIR}/../sys/dev/pci; \
|
||||
for h in pcireg.h; do \
|
||||
ln -fs ../../../../sys/dev/pci/$$h \
|
||||
${DESTDIR}${INCLUDEDIR}/dev/pci; \
|
||||
done
|
||||
.for i in ${LSUBSUBDIRS}
|
||||
cd ${.CURDIR}/../sys/$i; \
|
||||
for h in *.h; do \
|
||||
|
@ -188,6 +188,10 @@ SRCS+= ${file}.c
|
||||
.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
|
||||
SRCS+= aeabi_idivmod.S \
|
||||
aeabi_ldivmod.S \
|
||||
aeabi_memcmp.S \
|
||||
aeabi_memcpy.S \
|
||||
aeabi_memmove.S \
|
||||
aeabi_memset.S \
|
||||
aeabi_uidivmod.S \
|
||||
aeabi_uldivmod.S
|
||||
.endif
|
||||
|
@ -61,7 +61,20 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
.PATH: ${.CURDIR}/../libc/arm/gen
|
||||
|
||||
.if ${MK_ARM_EABI} == "no"
|
||||
SRCS+= divsi3.S
|
||||
.else
|
||||
# Compiler support functions
|
||||
.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
|
||||
SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
|
||||
SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
|
||||
|
||||
.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
|
||||
SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
|
||||
SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
|
||||
.endif
|
||||
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "ia64"
|
||||
.PATH: ${.CURDIR}/../libc/ia64/string
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 24, 2005
|
||||
.Dd January 30, 2013
|
||||
.Dt DEVD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -389,9 +389,13 @@ __T=${TARGET_ARCH}
|
||||
.else
|
||||
__T=${MACHINE_ARCH}
|
||||
.endif
|
||||
# Clang is only for x86 and powerpc right now, by default.
|
||||
# Clang is only for x86, powerpc and little-endian arm right now, by default.
|
||||
.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
|
||||
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
|
||||
.elif ${__T} == "arm" || ${__T} == "armv6"
|
||||
__DEFAULT_YES_OPTIONS+=CLANG
|
||||
# GCC is unable to build the full clang on arm, disable it by default.
|
||||
__DEFAULT_NO_OPTIONS+=CLANG_FULL
|
||||
.else
|
||||
__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
|
||||
.endif
|
||||
|
@ -232,7 +232,7 @@ minidumpsys(struct dumperinfo *di)
|
||||
/* Walk page table pages, set bits in vm_page_dump */
|
||||
pmapsize = 0;
|
||||
pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
|
||||
for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR,
|
||||
for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
|
||||
kernel_vm_end); ) {
|
||||
/*
|
||||
* We always write a page, even if it is zero. Each
|
||||
@ -364,7 +364,7 @@ minidumpsys(struct dumperinfo *di)
|
||||
/* Dump kernel page directory pages */
|
||||
bzero(fakepd, sizeof(fakepd));
|
||||
pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys);
|
||||
for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR,
|
||||
for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR,
|
||||
kernel_vm_end); va += NBPDP) {
|
||||
i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1);
|
||||
|
||||
|
@ -202,6 +202,10 @@ struct pmap kernel_pmap_store;
|
||||
vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */
|
||||
vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
|
||||
|
||||
int nkpt;
|
||||
SYSCTL_INT(_machdep, OID_AUTO, nkpt, CTLFLAG_RD, &nkpt, 0,
|
||||
"Number of kernel page table pages allocated on bootup");
|
||||
|
||||
static int ndmpdp;
|
||||
static vm_paddr_t dmaplimit;
|
||||
vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS;
|
||||
@ -496,17 +500,42 @@ allocpages(vm_paddr_t *firstaddr, int n)
|
||||
|
||||
CTASSERT(powerof2(NDMPML4E));
|
||||
|
||||
/* number of kernel PDP slots */
|
||||
#define NKPDPE(ptpgs) howmany((ptpgs), NPDEPG)
|
||||
|
||||
static void
|
||||
nkpt_init(vm_paddr_t addr)
|
||||
{
|
||||
int pt_pages;
|
||||
|
||||
#ifdef NKPT
|
||||
pt_pages = NKPT;
|
||||
#else
|
||||
pt_pages = howmany(addr, 1 << PDRSHIFT);
|
||||
pt_pages += NKPDPE(pt_pages);
|
||||
|
||||
/*
|
||||
* Add some slop beyond the bare minimum required for bootstrapping
|
||||
* the kernel.
|
||||
*
|
||||
* This is quite important when allocating KVA for kernel modules.
|
||||
* The modules are required to be linked in the negative 2GB of
|
||||
* the address space. If we run out of KVA in this region then
|
||||
* pmap_growkernel() will need to allocate page table pages to map
|
||||
* the entire 512GB of KVA space which is an unnecessary tax on
|
||||
* physical memory.
|
||||
*/
|
||||
pt_pages += 8; /* 16MB additional slop for kernel modules */
|
||||
#endif
|
||||
nkpt = pt_pages;
|
||||
}
|
||||
|
||||
static void
|
||||
create_pagetables(vm_paddr_t *firstaddr)
|
||||
{
|
||||
int i, j, ndm1g;
|
||||
|
||||
/* Allocate pages */
|
||||
KPTphys = allocpages(firstaddr, NKPT);
|
||||
KPML4phys = allocpages(firstaddr, 1);
|
||||
KPDPphys = allocpages(firstaddr, NKPML4E);
|
||||
KPDphys = allocpages(firstaddr, NKPDPE);
|
||||
int i, j, ndm1g, nkpdpe;
|
||||
|
||||
/* Allocate page table pages for the direct map */
|
||||
ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT;
|
||||
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
|
||||
ndmpdp = 4;
|
||||
@ -518,6 +547,22 @@ create_pagetables(vm_paddr_t *firstaddr)
|
||||
DMPDphys = allocpages(firstaddr, ndmpdp - ndm1g);
|
||||
dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT;
|
||||
|
||||
/* Allocate pages */
|
||||
KPML4phys = allocpages(firstaddr, 1);
|
||||
KPDPphys = allocpages(firstaddr, NKPML4E);
|
||||
|
||||
/*
|
||||
* Allocate the initial number of kernel page table pages required to
|
||||
* bootstrap. We defer this until after all memory-size dependent
|
||||
* allocations are done (e.g. direct map), so that we don't have to
|
||||
* build in too much slop in our estimate.
|
||||
*/
|
||||
nkpt_init(*firstaddr);
|
||||
nkpdpe = NKPDPE(nkpt);
|
||||
|
||||
KPTphys = allocpages(firstaddr, nkpt);
|
||||
KPDphys = allocpages(firstaddr, nkpdpe);
|
||||
|
||||
/* Fill in the underlying page table pages */
|
||||
/* Read-only from zero to physfree */
|
||||
/* XXX not fully used, underneath 2M pages */
|
||||
@ -527,7 +572,7 @@ create_pagetables(vm_paddr_t *firstaddr)
|
||||
}
|
||||
|
||||
/* Now map the page tables at their location within PTmap */
|
||||
for (i = 0; i < NKPT; i++) {
|
||||
for (i = 0; i < nkpt; i++) {
|
||||
((pd_entry_t *)KPDphys)[i] = KPTphys + (i << PAGE_SHIFT);
|
||||
((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V;
|
||||
}
|
||||
@ -540,7 +585,7 @@ create_pagetables(vm_paddr_t *firstaddr)
|
||||
}
|
||||
|
||||
/* And connect up the PD to the PDP */
|
||||
for (i = 0; i < NKPDPE; i++) {
|
||||
for (i = 0; i < nkpdpe; i++) {
|
||||
((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys +
|
||||
(i << PAGE_SHIFT);
|
||||
((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U;
|
||||
@ -769,7 +814,7 @@ pmap_init(void)
|
||||
* Initialize the vm page array entries for the kernel pmap's
|
||||
* page table pages.
|
||||
*/
|
||||
for (i = 0; i < NKPT; i++) {
|
||||
for (i = 0; i < nkpt; i++) {
|
||||
mpte = PHYS_TO_VM_PAGE(KPTphys + (i << PAGE_SHIFT));
|
||||
KASSERT(mpte >= vm_page_array &&
|
||||
mpte < &vm_page_array[vm_page_array_size],
|
||||
@ -2058,7 +2103,7 @@ pmap_growkernel(vm_offset_t addr)
|
||||
* any new kernel page table pages between "kernel_vm_end" and
|
||||
* "KERNBASE".
|
||||
*/
|
||||
if (KERNBASE < addr && addr <= KERNBASE + NKPT * NBPDR)
|
||||
if (KERNBASE < addr && addr <= KERNBASE + nkpt * NBPDR)
|
||||
return;
|
||||
|
||||
addr = roundup2(addr, NBPDR);
|
||||
|
@ -113,13 +113,7 @@
|
||||
((unsigned long)(l2) << PDRSHIFT) | \
|
||||
((unsigned long)(l1) << PAGE_SHIFT))
|
||||
|
||||
/* Initial number of kernel page tables. */
|
||||
#ifndef NKPT
|
||||
#define NKPT 32
|
||||
#endif
|
||||
|
||||
#define NKPML4E 1 /* number of kernel PML4 slots */
|
||||
#define NKPDPE howmany(NKPT, NPDEPG)/* number of kernel PDP slots */
|
||||
|
||||
#define NUPML4E (NPML4EPG/2) /* number of userland PML4 pages */
|
||||
#define NUPDPE (NUPML4E*NPDPEPG)/* number of userland PDP pages */
|
||||
@ -181,6 +175,7 @@ typedef u_int64_t pml4_entry_t;
|
||||
#define PML4map ((pd_entry_t *)(addr_PML4map))
|
||||
#define PML4pml4e ((pd_entry_t *)(addr_PML4pml4e))
|
||||
|
||||
extern int nkpt; /* Initial number of kernel page tables */
|
||||
extern u_int64_t KPDPphys; /* physical address of kernel level 3 */
|
||||
extern u_int64_t KPML4phys; /* physical address of kernel level 4 */
|
||||
|
||||
|
@ -62,10 +62,10 @@ struct a10_ccm_softc {
|
||||
|
||||
static struct a10_ccm_softc *a10_ccm_sc = NULL;
|
||||
|
||||
#define ccm_read_4(reg) \
|
||||
bus_space_read_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg)
|
||||
#define ccm_write_4(reg, val) \
|
||||
bus_space_write_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg, val)
|
||||
#define ccm_read_4(sc, reg) \
|
||||
bus_space_read_4((sc)->bst, (sc)->bsh, (reg))
|
||||
#define ccm_write_4(sc, reg, val) \
|
||||
bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val))
|
||||
|
||||
static int
|
||||
a10_ccm_probe(device_t dev)
|
||||
@ -121,24 +121,24 @@ int
|
||||
a10_clk_usb_activate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value = 0;
|
||||
uint32_t reg_value;
|
||||
|
||||
if (sc == NULL)
|
||||
return ENXIO;
|
||||
|
||||
/* Gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(CCM_AHB_GATING0);
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
|
||||
reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
|
||||
ccm_write_4(CCM_AHB_GATING0, reg_value);
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
|
||||
/* Enable clock for USB */
|
||||
reg_value = ccm_read_4(CCM_USB_CLK);
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value |= CCM_USB_PHY; /* USBPHY */
|
||||
reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */
|
||||
reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */
|
||||
reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */
|
||||
ccm_write_4(CCM_USB_CLK, reg_value);
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -147,24 +147,24 @@ int
|
||||
a10_clk_usb_deactivate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value = 0;
|
||||
uint32_t reg_value;
|
||||
|
||||
if (sc == NULL)
|
||||
return ENXIO;
|
||||
|
||||
/* Disable clock for USB */
|
||||
reg_value = ccm_read_4(CCM_USB_CLK);
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value &= ~CCM_USB_PHY; /* USBPHY */
|
||||
reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */
|
||||
reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */
|
||||
reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */
|
||||
ccm_write_4(CCM_USB_CLK, reg_value);
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
|
||||
/* Disable gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(CCM_AHB_GATING0);
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
|
||||
reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */
|
||||
ccm_write_4(CCM_AHB_GATING0, reg_value);
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/gpio.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
@ -58,6 +59,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/usb/controller/ehci.h>
|
||||
#include <dev/usb/controller/ehcireg.h>
|
||||
|
||||
#include "gpio_if.h"
|
||||
|
||||
#include "a10_clk.h"
|
||||
|
||||
#define EHCI_HC_DEVSTR "Allwinner Integrated USB 2.0 controller"
|
||||
@ -70,8 +73,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define SW_ULPI_BYPASS (1 << 0)
|
||||
#define SW_AHB_INCRX_ALIGN (1 << 8)
|
||||
#define SW_AHB_INCR4 (1 << 9)
|
||||
#define SW_AHB_INCR4 (1 << 9)
|
||||
#define SW_AHB_INCR8 (1 << 10)
|
||||
#define GPIO_USB2_PWR 227
|
||||
|
||||
#define A10_READ_4(sc, reg) \
|
||||
bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg)
|
||||
@ -101,6 +105,7 @@ a10_ehci_attach(device_t self)
|
||||
{
|
||||
ehci_softc_t *sc = device_get_softc(self);
|
||||
bus_space_handle_t bsh;
|
||||
device_t sc_gpio_dev;
|
||||
int err;
|
||||
int rid;
|
||||
uint32_t reg_value = 0;
|
||||
@ -153,6 +158,13 @@ a10_ehci_attach(device_t self)
|
||||
|
||||
sprintf(sc->sc_vendor, "Allwinner");
|
||||
|
||||
/* Get the GPIO device, we need this to give power to USB */
|
||||
sc_gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
|
||||
if (sc_gpio_dev == NULL) {
|
||||
device_printf(self, "Error: failed to get the GPIO device\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
|
||||
NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
|
||||
if (err) {
|
||||
@ -166,6 +178,10 @@ a10_ehci_attach(device_t self)
|
||||
/* Enable clock for USB */
|
||||
a10_clk_usb_activate();
|
||||
|
||||
/* Give power to USB */
|
||||
GPIO_PIN_SETFLAGS(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_OUTPUT);
|
||||
GPIO_PIN_SET(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_HIGH);
|
||||
|
||||
/* Enable passby */
|
||||
reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE);
|
||||
reg_value |= SW_AHB_INCR8; /* AHB INCR8 enable */
|
||||
|
521
sys/arm/allwinner/a10_gpio.c
Normal file
521
sys/arm/allwinner/a10_gpio.c
Normal file
@ -0,0 +1,521 @@
|
||||
/*-
|
||||
* Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@gmail.com>
|
||||
* Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
|
||||
* Copyright (c) 2012 Luiz Otavio O Souza.
|
||||
* 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/gpio.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/fdt.h>
|
||||
#include <machine/frame.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/fdt/fdt_common.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
|
||||
#include "gpio_if.h"
|
||||
|
||||
/*
|
||||
* A10 have 9 banks of gpio.
|
||||
* 32 pins per bank:
|
||||
* PA0 - PA17 | PB0 - PB23 | PC0 - PC24
|
||||
* PD0 - PD27 | PE0 - PE31 | PF0 - PF5
|
||||
* PG0 - PG9 | PH0 - PH27 | PI0 - PI12
|
||||
*/
|
||||
|
||||
#define A10_GPIO_PINS 288
|
||||
#define A10_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \
|
||||
GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
|
||||
|
||||
struct a10_gpio_softc {
|
||||
device_t sc_dev;
|
||||
struct mtx sc_mtx;
|
||||
struct resource * sc_mem_res;
|
||||
struct resource * sc_irq_res;
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
void * sc_intrhand;
|
||||
int sc_gpio_npins;
|
||||
struct gpio_pin sc_gpio_pins[A10_GPIO_PINS];
|
||||
};
|
||||
|
||||
enum a10_gpio_fsel {
|
||||
A10_GPIO_INPUT,
|
||||
A10_GPIO_OUTPUT,
|
||||
};
|
||||
|
||||
enum a10_gpio_pud {
|
||||
A10_GPIO_NONE,
|
||||
A10_GPIO_PULLDOWN,
|
||||
A10_GPIO_PULLUP,
|
||||
};
|
||||
|
||||
#define A10_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx)
|
||||
#define A10_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx)
|
||||
#define A10_GPIO_LOCK_ASSERT(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED)
|
||||
|
||||
#define A10_GPIO_GP_CFG(_bank, _pin) 0x00 + ((_bank) * 0x24) + ((_pin)<<2)
|
||||
#define A10_GPIO_GP_DAT(_bank) 0x10 + ((_bank) * 0x24)
|
||||
#define A10_GPIO_GP_DRV(_bank, _pin) 0x14 + ((_bank) * 0x24) + ((_pin)<<2)
|
||||
#define A10_GPIO_GP_PUL(_bank, _pin) 0x1c + ((_bank) * 0x24) + ((_pin)<<2)
|
||||
|
||||
#define A10_GPIO_GP_INT_CFG0 0x200
|
||||
#define A10_GPIO_GP_INT_CFG1 0x204
|
||||
#define A10_GPIO_GP_INT_CFG2 0x208
|
||||
#define A10_GPIO_GP_INT_CFG3 0x20c
|
||||
|
||||
#define A10_GPIO_GP_INT_CTL 0x210
|
||||
#define A10_GPIO_GP_INT_STA 0x214
|
||||
#define A10_GPIO_GP_INT_DEB 0x218
|
||||
|
||||
#define A10_GPIO_WRITE(_sc, _off, _val) \
|
||||
bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val)
|
||||
#define A10_GPIO_READ(_sc, _off) \
|
||||
bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off)
|
||||
|
||||
static uint32_t
|
||||
a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin)
|
||||
{
|
||||
uint32_t bank, func, offset;
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
func = pin >> 3;
|
||||
offset = ((pin & 0x07) << 2);
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
func = (A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func)) >> offset) & 7;
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (func);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
a10_gpio_func_flag(uint32_t nfunc)
|
||||
{
|
||||
|
||||
switch (nfunc) {
|
||||
case A10_GPIO_INPUT:
|
||||
return (GPIO_PIN_INPUT);
|
||||
case A10_GPIO_OUTPUT:
|
||||
return (GPIO_PIN_OUTPUT);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
|
||||
{
|
||||
uint32_t bank, func, data, offset;
|
||||
|
||||
/* Must be called with lock held. */
|
||||
A10_GPIO_LOCK_ASSERT(sc);
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
func = pin >> 3;
|
||||
offset = ((pin & 0x07) << 2);
|
||||
|
||||
data = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func));
|
||||
data &= ~(7 << offset);
|
||||
data |= (f << offset);
|
||||
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, func), data);
|
||||
}
|
||||
|
||||
static void
|
||||
a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t pin, uint32_t state)
|
||||
{
|
||||
uint32_t bank, offset, pull, val;
|
||||
|
||||
/* Must be called with lock held. */
|
||||
A10_GPIO_LOCK_ASSERT(sc);
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
pull = pin >> 4;
|
||||
offset = ((pin & 0x0f) << 1);
|
||||
|
||||
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pull));
|
||||
val &= ~(0x03 << offset);
|
||||
val |= (state << offset);
|
||||
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pull), val);
|
||||
}
|
||||
|
||||
static void
|
||||
a10_gpio_pin_configure(struct a10_gpio_softc *sc, struct gpio_pin *pin,
|
||||
unsigned int flags)
|
||||
{
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
|
||||
/*
|
||||
* Manage input/output.
|
||||
*/
|
||||
if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
|
||||
pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT);
|
||||
if (flags & GPIO_PIN_OUTPUT) {
|
||||
pin->gp_flags |= GPIO_PIN_OUTPUT;
|
||||
a10_gpio_set_function(sc, pin->gp_pin,
|
||||
A10_GPIO_OUTPUT);
|
||||
} else {
|
||||
pin->gp_flags |= GPIO_PIN_INPUT;
|
||||
a10_gpio_set_function(sc, pin->gp_pin,
|
||||
A10_GPIO_INPUT);
|
||||
}
|
||||
}
|
||||
|
||||
/* Manage Pull-up/pull-down. */
|
||||
pin->gp_flags &= ~(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN);
|
||||
if (flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) {
|
||||
if (flags & GPIO_PIN_PULLUP) {
|
||||
pin->gp_flags |= GPIO_PIN_PULLUP;
|
||||
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLUP);
|
||||
} else {
|
||||
pin->gp_flags |= GPIO_PIN_PULLDOWN;
|
||||
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLDOWN);
|
||||
}
|
||||
} else
|
||||
a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_NONE);
|
||||
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_max(device_t dev, int *maxpin)
|
||||
{
|
||||
|
||||
*maxpin = A10_GPIO_PINS - 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
*caps = sc->sc_gpio_pins[i].gp_caps;
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
*flags = sc->sc_gpio_pins[i].gp_flags;
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
memcpy(name, sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME);
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags. */
|
||||
if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together. */
|
||||
if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) ==
|
||||
(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT))
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix pull-up/pull-down together. */
|
||||
if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) ==
|
||||
(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN))
|
||||
return (EINVAL);
|
||||
|
||||
a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
uint32_t bank, offset, data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
offset = pin & 0x1f;
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
|
||||
if (value)
|
||||
data |= (1 << offset);
|
||||
else
|
||||
data &= ~(1 << offset);
|
||||
A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data);
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
uint32_t bank, offset, reg_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
offset = pin & 0x1f;
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
reg_data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
*val = (reg_data & (1 << offset)) ? 1 : 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_pin_toggle(device_t dev, uint32_t pin)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
uint32_t bank, data, offset;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sc->sc_gpio_npins; i++) {
|
||||
if (sc->sc_gpio_pins[i].gp_pin == pin)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
bank = pin / 32;
|
||||
pin = pin - 32 * bank;
|
||||
offset = pin & 0x1f;
|
||||
|
||||
A10_GPIO_LOCK(sc);
|
||||
data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank));
|
||||
if (data & (1 << offset))
|
||||
data &= ~(1 << offset);
|
||||
else
|
||||
data |= (1 << offset);
|
||||
A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data);
|
||||
A10_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_probe(device_t dev)
|
||||
{
|
||||
if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-gpio"))
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "Allwinner GPIO controller");
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_attach(device_t dev)
|
||||
{
|
||||
struct a10_gpio_softc *sc = device_get_softc(dev);
|
||||
uint32_t func;
|
||||
int i, rid;
|
||||
phandle_t gpio;
|
||||
|
||||
sc->sc_dev = dev;
|
||||
|
||||
mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_DEF);
|
||||
|
||||
rid = 0;
|
||||
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
||||
RF_ACTIVE);
|
||||
if (!sc->sc_mem_res) {
|
||||
device_printf(dev, "cannot allocate memory window\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
|
||||
sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res);
|
||||
|
||||
rid = 0;
|
||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
||||
RF_ACTIVE);
|
||||
if (!sc->sc_irq_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
|
||||
device_printf(dev, "cannot allocate interrupt\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/* Find our node. */
|
||||
gpio = ofw_bus_get_node(sc->sc_dev);
|
||||
|
||||
if (!OF_hasprop(gpio, "gpio-controller"))
|
||||
/* Node is not a GPIO controller. */
|
||||
goto fail;
|
||||
|
||||
/* Initialize the software controlled pins. */
|
||||
for (i = 0; i < A10_GPIO_PINS; i++) {
|
||||
snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,
|
||||
"pin %d", i);
|
||||
func = a10_gpio_get_function(sc, i);
|
||||
sc->sc_gpio_pins[i].gp_pin = i;
|
||||
sc->sc_gpio_pins[i].gp_caps = A10_GPIO_DEFAULT_CAPS;
|
||||
sc->sc_gpio_pins[i].gp_flags = a10_gpio_func_flag(func);
|
||||
}
|
||||
sc->sc_gpio_npins = i;
|
||||
|
||||
device_add_child(dev, "gpioc", device_get_unit(dev));
|
||||
device_add_child(dev, "gpiobus", device_get_unit(dev));
|
||||
return (bus_generic_attach(dev));
|
||||
|
||||
fail:
|
||||
if (sc->sc_irq_res)
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
|
||||
if (sc->sc_mem_res)
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_gpio_detach(device_t dev)
|
||||
{
|
||||
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
static device_method_t a10_gpio_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, a10_gpio_probe),
|
||||
DEVMETHOD(device_attach, a10_gpio_attach),
|
||||
DEVMETHOD(device_detach, a10_gpio_detach),
|
||||
|
||||
/* GPIO protocol */
|
||||
DEVMETHOD(gpio_pin_max, a10_gpio_pin_max),
|
||||
DEVMETHOD(gpio_pin_getname, a10_gpio_pin_getname),
|
||||
DEVMETHOD(gpio_pin_getflags, a10_gpio_pin_getflags),
|
||||
DEVMETHOD(gpio_pin_getcaps, a10_gpio_pin_getcaps),
|
||||
DEVMETHOD(gpio_pin_setflags, a10_gpio_pin_setflags),
|
||||
DEVMETHOD(gpio_pin_get, a10_gpio_pin_get),
|
||||
DEVMETHOD(gpio_pin_set, a10_gpio_pin_set),
|
||||
DEVMETHOD(gpio_pin_toggle, a10_gpio_pin_toggle),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t a10_gpio_devclass;
|
||||
|
||||
static driver_t a10_gpio_driver = {
|
||||
"gpio",
|
||||
a10_gpio_methods,
|
||||
sizeof(struct a10_gpio_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 0, 0);
|
@ -10,6 +10,7 @@ arm/arm/cpufunc_asm_armv7.S standard
|
||||
arm/arm/irq_dispatch.S standard
|
||||
|
||||
arm/allwinner/a10_clk.c standard
|
||||
arm/allwinner/a10_gpio.c optional gpio
|
||||
arm/allwinner/a10_ehci.c optional ehci
|
||||
arm/allwinner/timer.c standard
|
||||
arm/allwinner/aintc.c standard
|
||||
|
@ -99,7 +99,7 @@ device random # Entropy device
|
||||
#device iic
|
||||
|
||||
# GPIO
|
||||
#device gpio
|
||||
device gpio
|
||||
|
||||
device scbus # SCSI bus (required for SCSI)
|
||||
device da # Direct Access (disks)
|
||||
|
@ -112,8 +112,8 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
|
||||
# clang doesn't understand %D as a specifier to printf
|
||||
NO_WERROR.clang=
|
||||
|
||||
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} ${LIBGCC}
|
||||
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand -lgcc
|
||||
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND}
|
||||
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand
|
||||
|
||||
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
|
||||
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
||||
|
@ -76,6 +76,15 @@
|
||||
clock-frequency = < 24000000 >;
|
||||
};
|
||||
|
||||
GPIO: gpio@01c20800 {
|
||||
#gpio-cells = <3>;
|
||||
compatible = "allwinner,sun4i-gpio";
|
||||
gpio-controller;
|
||||
reg =< 0x01c20800 0x400 >;
|
||||
interrupts = < 28 >;
|
||||
interrupt-parent = <&AINTC>;
|
||||
};
|
||||
|
||||
usb1: usb@01c1c000 {
|
||||
compatible = "allwinner,usb-ehci", "usb-ehci";
|
||||
reg = <0x01c1c000 0x1000>;
|
||||
|
@ -42,13 +42,13 @@ OBJCOPY?= objcopy
|
||||
SYSCC?= cc
|
||||
|
||||
CFLAGS+= -DBOOTPROG=\"usbloader\"
|
||||
CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE="\"bsd_global.h\""
|
||||
CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\"bsd_global.h\"
|
||||
CFLAGS+= -ffunction-sections -fdata-sections
|
||||
CFLAGS+= -ffreestanding
|
||||
CFLAGS+= -Wformat -Wall
|
||||
CFLAGS+= -I ${S}
|
||||
CFLAGS+= -I ${T}
|
||||
CFLAGS+= -I ${.CURDIR}
|
||||
CFLAGS+= -I${S}
|
||||
CFLAGS+= -I${T}
|
||||
CFLAGS+= -I${.CURDIR}
|
||||
CFLAGS+= -g
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
||||
|
@ -60,4 +60,6 @@
|
||||
#include <dev/usb/quirk/usb_quirk.h>
|
||||
#include <dev/usb/template/usb_template.h>
|
||||
|
||||
extern struct usb_process usb_process[USB_PROC_MAX];
|
||||
|
||||
#endif /* _BSD_GLOBAL_H_ */
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
#include <bsd_global.h>
|
||||
|
||||
static struct usb_process usb_process[USB_PROC_MAX];
|
||||
struct usb_process usb_process[USB_PROC_MAX];
|
||||
|
||||
static device_t usb_pci_root;
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -977,41 +978,6 @@ repeat:
|
||||
return (worked);
|
||||
}
|
||||
|
||||
int
|
||||
usb_proc_create(struct usb_process *up, struct mtx *p_mtx,
|
||||
const char *pmesg, uint8_t prio)
|
||||
{
|
||||
#define USB_PROC_OFFSET(a,b) \
|
||||
((int)(((long)&((struct usb_bus *)0)->a) - \
|
||||
((long)&((struct usb_bus *)0)->b)))
|
||||
|
||||
/* figure out which process we are creating */
|
||||
switch ((int)((long)up - (long)p_mtx)) {
|
||||
case USB_PROC_OFFSET(giant_callback_proc, bus_mtx):
|
||||
up->up_ptr = (void *)(usb_process + 2);
|
||||
break;
|
||||
case USB_PROC_OFFSET(non_giant_callback_proc, bus_mtx):
|
||||
up->up_ptr = (void *)(usb_process + 2);
|
||||
break;
|
||||
case USB_PROC_OFFSET(explore_proc, bus_mtx):
|
||||
up->up_ptr = (void *)(usb_process + 0);
|
||||
break;
|
||||
case USB_PROC_OFFSET(control_xfer_proc, bus_mtx):
|
||||
up->up_ptr = (void *)(usb_process + 1);
|
||||
break;
|
||||
default:
|
||||
up->up_ptr = (void *)(usb_process + 1);
|
||||
break;
|
||||
}
|
||||
return (0); /* success */
|
||||
}
|
||||
|
||||
void
|
||||
usb_proc_free(struct usb_process *up)
|
||||
{
|
||||
/* NOP */
|
||||
}
|
||||
|
||||
void *
|
||||
usb_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1)
|
||||
{
|
||||
@ -1021,10 +987,6 @@ usb_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1)
|
||||
usb_size_t d;
|
||||
uint8_t t;
|
||||
|
||||
/* find the correct parent */
|
||||
while (up->up_ptr != NULL)
|
||||
up = (struct usb_process *)up->up_ptr;
|
||||
|
||||
t = 0;
|
||||
|
||||
if (pm0->pm_qentry.tqe_prev) {
|
||||
@ -1104,10 +1066,6 @@ usb_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1)
|
||||
struct usb_proc_msg *pm0 = _pm0;
|
||||
struct usb_proc_msg *pm1 = _pm1;
|
||||
|
||||
/* find the correct parent */
|
||||
while (up->up_ptr != NULL)
|
||||
up = (struct usb_process *)up->up_ptr;
|
||||
|
||||
/* Just remove the messages from the queue. */
|
||||
if (pm0->pm_qentry.tqe_prev) {
|
||||
TAILQ_REMOVE(&up->up_qhead, pm0, pm_qentry);
|
||||
|
@ -40,6 +40,10 @@
|
||||
#define M_USB 0
|
||||
#define M_USBDEV 0
|
||||
#define USB_PROC_MAX 3
|
||||
#define USB_BUS_GIANT_PROC(bus) (usb_process + 2)
|
||||
#define USB_BUS_NON_GIANT_PROC(bus) (usb_process + 2)
|
||||
#define USB_BUS_EXPLORE_PROC(bus) (usb_process + 0)
|
||||
#define USB_BUS_CONTROL_XFER_PROC(bus) (usb_process + 1)
|
||||
#define SYSCTL_DECL(...)
|
||||
#define SYSCTL_NODE(name,...) struct { } name __used
|
||||
#define SYSCTL_INT(...)
|
||||
|
@ -142,6 +142,9 @@ static int age_init_rx_ring(struct age_softc *);
|
||||
static void age_init_rr_ring(struct age_softc *);
|
||||
static void age_init_cmb_block(struct age_softc *);
|
||||
static void age_init_smb_block(struct age_softc *);
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
static struct mbuf *age_fixup_rx(struct ifnet *, struct mbuf *);
|
||||
#endif
|
||||
static int age_newbuf(struct age_softc *, struct age_rxdesc *);
|
||||
static void age_rxvlan(struct age_softc *);
|
||||
static void age_rxfilter(struct age_softc *);
|
||||
@ -1133,7 +1136,7 @@ again:
|
||||
/* Create tag for Rx buffers. */
|
||||
error = bus_dma_tag_create(
|
||||
sc->age_cdata.age_buffer_tag, /* parent */
|
||||
1, 0, /* alignment, boundary */
|
||||
AGE_RX_BUF_ALIGN, 0, /* alignment, boundary */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
@ -2268,16 +2271,53 @@ age_txintr(struct age_softc *sc, int tpd_cons)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
static struct mbuf *
|
||||
age_fixup_rx(struct ifnet *ifp, struct mbuf *m)
|
||||
{
|
||||
struct mbuf *n;
|
||||
int i;
|
||||
uint16_t *src, *dst;
|
||||
|
||||
src = mtod(m, uint16_t *);
|
||||
dst = src - 3;
|
||||
|
||||
if (m->m_next == NULL) {
|
||||
for (i = 0; i < (m->m_len / sizeof(uint16_t) + 1); i++)
|
||||
*dst++ = *src++;
|
||||
m->m_data -= 6;
|
||||
return (m);
|
||||
}
|
||||
/*
|
||||
* Append a new mbuf to received mbuf chain and copy ethernet
|
||||
* header from the mbuf chain. This can save lots of CPU
|
||||
* cycles for jumbo frame.
|
||||
*/
|
||||
MGETHDR(n, M_NOWAIT, MT_DATA);
|
||||
if (n == NULL) {
|
||||
ifp->if_iqdrops++;
|
||||
m_freem(m);
|
||||
return (NULL);
|
||||
}
|
||||
bcopy(m->m_data, n->m_data, ETHER_HDR_LEN);
|
||||
m->m_data += ETHER_HDR_LEN;
|
||||
m->m_len -= ETHER_HDR_LEN;
|
||||
n->m_len = ETHER_HDR_LEN;
|
||||
M_MOVE_PKTHDR(n, m);
|
||||
n->m_next = m;
|
||||
return (n);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Receive a frame. */
|
||||
static void
|
||||
age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
{
|
||||
struct age_rxdesc *rxd;
|
||||
struct rx_desc *desc;
|
||||
struct ifnet *ifp;
|
||||
struct mbuf *mp, *m;
|
||||
uint32_t status, index, vtag;
|
||||
int count, nsegs, pktlen;
|
||||
int count, nsegs;
|
||||
int rx_cons;
|
||||
|
||||
AGE_LOCK_ASSERT(sc);
|
||||
@ -2289,9 +2329,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
nsegs = AGE_RX_NSEGS(index);
|
||||
|
||||
sc->age_cdata.age_rxlen = AGE_RX_BYTES(le32toh(rxrd->len));
|
||||
if ((status & AGE_RRD_ERROR) != 0 &&
|
||||
(status & (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE |
|
||||
AGE_RRD_RUNT | AGE_RRD_OFLOW | AGE_RRD_TRUNC)) != 0) {
|
||||
if ((status & (AGE_RRD_ERROR | AGE_RRD_LENGTH_NOK)) != 0) {
|
||||
/*
|
||||
* We want to pass the following frames to upper
|
||||
* layer regardless of error status of Rx return
|
||||
@ -2301,33 +2339,31 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
* o frame length and protocol specific length
|
||||
* does not match.
|
||||
*/
|
||||
sc->age_cdata.age_rx_cons += nsegs;
|
||||
sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT;
|
||||
return;
|
||||
status |= AGE_RRD_IPCSUM_NOK | AGE_RRD_TCP_UDPCSUM_NOK;
|
||||
if ((status & (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE |
|
||||
AGE_RRD_RUNT | AGE_RRD_OFLOW | AGE_RRD_TRUNC)) != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
pktlen = 0;
|
||||
for (count = 0; count < nsegs; count++,
|
||||
AGE_DESC_INC(rx_cons, AGE_RX_RING_CNT)) {
|
||||
rxd = &sc->age_cdata.age_rxdesc[rx_cons];
|
||||
mp = rxd->rx_m;
|
||||
desc = rxd->rx_desc;
|
||||
/* Add a new receive buffer to the ring. */
|
||||
if (age_newbuf(sc, rxd) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
/* Reuse Rx buffers. */
|
||||
if (sc->age_cdata.age_rxhead != NULL) {
|
||||
if (sc->age_cdata.age_rxhead != NULL)
|
||||
m_freem(sc->age_cdata.age_rxhead);
|
||||
AGE_RXCHAIN_RESET(sc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* The length of the first mbuf is computed last. */
|
||||
if (count != 0) {
|
||||
mp->m_len = AGE_RX_BYTES(le32toh(desc->len));
|
||||
pktlen += mp->m_len;
|
||||
}
|
||||
/*
|
||||
* Assume we've received a full sized frame.
|
||||
* Actual size is fixed when we encounter the end of
|
||||
* multi-segmented frame.
|
||||
*/
|
||||
mp->m_len = AGE_RX_BUF_SIZE;
|
||||
|
||||
/* Chain received mbufs. */
|
||||
if (sc->age_cdata.age_rxhead == NULL) {
|
||||
@ -2342,14 +2378,20 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
}
|
||||
|
||||
if (count == nsegs - 1) {
|
||||
/* Last desc. for this frame. */
|
||||
m = sc->age_cdata.age_rxhead;
|
||||
m->m_flags |= M_PKTHDR;
|
||||
/*
|
||||
* It seems that L1 controller has no way
|
||||
* to tell hardware to strip CRC bytes.
|
||||
*/
|
||||
sc->age_cdata.age_rxlen -= ETHER_CRC_LEN;
|
||||
m->m_pkthdr.len = sc->age_cdata.age_rxlen -
|
||||
ETHER_CRC_LEN;
|
||||
if (nsegs > 1) {
|
||||
/* Set last mbuf size. */
|
||||
mp->m_len = sc->age_cdata.age_rxlen -
|
||||
((nsegs - 1) * AGE_RX_BUF_SIZE);
|
||||
/* Remove the CRC bytes in chained mbufs. */
|
||||
pktlen -= ETHER_CRC_LEN;
|
||||
if (mp->m_len <= ETHER_CRC_LEN) {
|
||||
sc->age_cdata.age_rxtail =
|
||||
sc->age_cdata.age_rxprev_tail;
|
||||
@ -2360,15 +2402,9 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
} else {
|
||||
mp->m_len -= ETHER_CRC_LEN;
|
||||
}
|
||||
}
|
||||
|
||||
m = sc->age_cdata.age_rxhead;
|
||||
m->m_flags |= M_PKTHDR;
|
||||
} else
|
||||
m->m_len = m->m_pkthdr.len;
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
m->m_pkthdr.len = sc->age_cdata.age_rxlen;
|
||||
/* Set the first mbuf length. */
|
||||
m->m_len = sc->age_cdata.age_rxlen - pktlen;
|
||||
|
||||
/*
|
||||
* Set checksum information.
|
||||
* It seems that L1 controller can compute partial
|
||||
@ -2383,9 +2419,9 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
*/
|
||||
if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 &&
|
||||
(status & AGE_RRD_IPV4) != 0) {
|
||||
m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED;
|
||||
if ((status & AGE_RRD_IPCSUM_NOK) == 0)
|
||||
m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
|
||||
m->m_pkthdr.csum_flags |=
|
||||
CSUM_IP_CHECKED | CSUM_IP_VALID;
|
||||
if ((status & (AGE_RRD_TCP | AGE_RRD_UDP)) &&
|
||||
(status & AGE_RRD_TCP_UDPCSUM_NOK) == 0) {
|
||||
m->m_pkthdr.csum_flags |=
|
||||
@ -2406,22 +2442,21 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
|
||||
m->m_pkthdr.ether_vtag = AGE_RX_VLAN_TAG(vtag);
|
||||
m->m_flags |= M_VLANTAG;
|
||||
}
|
||||
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
m = age_fixup_rx(ifp, m);
|
||||
if (m != NULL)
|
||||
#endif
|
||||
{
|
||||
/* Pass it on. */
|
||||
AGE_UNLOCK(sc);
|
||||
(*ifp->if_input)(ifp, m);
|
||||
AGE_LOCK(sc);
|
||||
|
||||
/* Reset mbuf chains. */
|
||||
AGE_RXCHAIN_RESET(sc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count != nsegs) {
|
||||
sc->age_cdata.age_rx_cons += nsegs;
|
||||
sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT;
|
||||
} else
|
||||
sc->age_cdata.age_rx_cons = rx_cons;
|
||||
/* Reset mbuf chains. */
|
||||
AGE_RXCHAIN_RESET(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2456,16 +2491,16 @@ age_rxintr(struct age_softc *sc, int rr_prod, int count)
|
||||
* I'm not sure whether this check is really needed.
|
||||
*/
|
||||
pktlen = AGE_RX_BYTES(le32toh(rxrd->len));
|
||||
if (nsegs != ((pktlen + (MCLBYTES - ETHER_ALIGN - 1)) /
|
||||
(MCLBYTES - ETHER_ALIGN)))
|
||||
if (nsegs != (pktlen + (AGE_RX_BUF_SIZE - 1)) / AGE_RX_BUF_SIZE)
|
||||
break;
|
||||
|
||||
prog++;
|
||||
/* Received a frame. */
|
||||
age_rxeof(sc, rxrd);
|
||||
/* Clear return ring. */
|
||||
rxrd->index = 0;
|
||||
AGE_DESC_INC(rr_cons, AGE_RR_RING_CNT);
|
||||
sc->age_cdata.age_rx_cons += nsegs;
|
||||
sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT;
|
||||
}
|
||||
|
||||
if (prog > 0) {
|
||||
@ -3065,7 +3100,9 @@ age_newbuf(struct age_softc *sc, struct age_rxdesc *rxd)
|
||||
if (m == NULL)
|
||||
return (ENOBUFS);
|
||||
m->m_len = m->m_pkthdr.len = MCLBYTES;
|
||||
m_adj(m, ETHER_ALIGN);
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
m_adj(m, AGE_RX_BUF_ALIGN);
|
||||
#endif
|
||||
|
||||
if (bus_dmamap_load_mbuf_sg(sc->age_cdata.age_rx_tag,
|
||||
sc->age_cdata.age_rx_sparemap, m, segs, &nsegs, 0) != 0) {
|
||||
|
@ -43,6 +43,12 @@
|
||||
#define AGE_TSO_MAXSEGSIZE 4096
|
||||
#define AGE_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header))
|
||||
#define AGE_MAXTXSEGS 32
|
||||
#define AGE_RX_BUF_ALIGN 8
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
#define AGE_RX_BUF_SIZE (MCLBYTES - AGE_RX_BUF_ALIGN)
|
||||
#else
|
||||
#define AGE_RX_BUF_SIZE (MCLBYTES)
|
||||
#endif
|
||||
|
||||
#define AGE_ADDR_LO(x) ((uint64_t) (x) & 0xFFFFFFFF)
|
||||
#define AGE_ADDR_HI(x) ((uint64_t) (x) >> 32)
|
||||
|
@ -35,7 +35,12 @@ __FBSDID("$FreeBSD$");
|
||||
#include "firmware/t4fw_interface.h"
|
||||
|
||||
#undef msleep
|
||||
#define msleep(x) pause("t4hw", (x) * hz / 1000)
|
||||
#define msleep(x) do { \
|
||||
if (cold) \
|
||||
DELAY((x) * 1000); \
|
||||
else \
|
||||
pause("t4hw", (x) * hz / 1000); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* t4_wait_op_done_val - wait until an operation is completed
|
||||
|
@ -253,11 +253,13 @@ static struct ttydevsw sc_ttydevsw = {
|
||||
};
|
||||
|
||||
static d_ioctl_t consolectl_ioctl;
|
||||
static d_close_t consolectl_close;
|
||||
|
||||
static struct cdevsw consolectl_devsw = {
|
||||
.d_version = D_VERSION,
|
||||
.d_flags = D_NEEDGIANT,
|
||||
.d_flags = D_NEEDGIANT | D_TRACKCLOSE,
|
||||
.d_ioctl = consolectl_ioctl,
|
||||
.d_close = consolectl_close,
|
||||
.d_name = "consolectl",
|
||||
};
|
||||
|
||||
@ -1561,6 +1563,23 @@ consolectl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
|
||||
return sctty_ioctl(dev->si_drv1, cmd, data, td);
|
||||
}
|
||||
|
||||
static int
|
||||
consolectl_close(struct cdev *dev, int flags, int mode, struct thread *td)
|
||||
{
|
||||
#ifndef SC_NO_SYSMOUSE
|
||||
mouse_info_t info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.operation = MOUSE_ACTION;
|
||||
|
||||
/*
|
||||
* Make sure all buttons are released when moused and other
|
||||
* console daemons exit, so that no buttons are left pressed.
|
||||
*/
|
||||
(void) sctty_ioctl(dev->si_drv1, CONS_MOUSECTL, (caddr_t)&info, td);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
sc_cnprobe(struct consdev *cp)
|
||||
{
|
||||
|
@ -214,27 +214,29 @@ usb_detach(device_t dev)
|
||||
USB_BUS_LOCK(bus);
|
||||
|
||||
/* Queue detach job */
|
||||
usb_proc_msignal(&bus->explore_proc,
|
||||
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->detach_msg[0], &bus->detach_msg[1]);
|
||||
|
||||
/* Wait for detach to complete */
|
||||
usb_proc_mwait(&bus->explore_proc,
|
||||
usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->detach_msg[0], &bus->detach_msg[1]);
|
||||
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
#if USB_HAVE_PER_BUS_PROCESS
|
||||
/* Get rid of USB callback processes */
|
||||
|
||||
usb_proc_free(&bus->giant_callback_proc);
|
||||
usb_proc_free(&bus->non_giant_callback_proc);
|
||||
usb_proc_free(USB_BUS_GIANT_PROC(bus));
|
||||
usb_proc_free(USB_BUS_NON_GIANT_PROC(bus));
|
||||
|
||||
/* Get rid of USB explore process */
|
||||
|
||||
usb_proc_free(&bus->explore_proc);
|
||||
usb_proc_free(USB_BUS_EXPLORE_PROC(bus));
|
||||
|
||||
/* Get rid of control transfer process */
|
||||
|
||||
usb_proc_free(&bus->control_xfer_proc);
|
||||
usb_proc_free(USB_BUS_CONTROL_XFER_PROC(bus));
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_PF
|
||||
usbpf_detach(bus);
|
||||
@ -258,11 +260,11 @@ usb_suspend(device_t dev)
|
||||
}
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
usb_proc_msignal(&bus->explore_proc,
|
||||
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->suspend_msg[0], &bus->suspend_msg[1]);
|
||||
if (usb_no_suspend_wait == 0) {
|
||||
/* wait for suspend callback to be executed */
|
||||
usb_proc_mwait(&bus->explore_proc,
|
||||
usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->suspend_msg[0], &bus->suspend_msg[1]);
|
||||
}
|
||||
USB_BUS_UNLOCK(bus);
|
||||
@ -286,7 +288,7 @@ usb_resume(device_t dev)
|
||||
}
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
usb_proc_msignal(&bus->explore_proc,
|
||||
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->resume_msg[0], &bus->resume_msg[1]);
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
@ -311,11 +313,11 @@ usb_shutdown(device_t dev)
|
||||
device_printf(bus->bdev, "Controller shutdown\n");
|
||||
|
||||
USB_BUS_LOCK(bus);
|
||||
usb_proc_msignal(&bus->explore_proc,
|
||||
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->shutdown_msg[0], &bus->shutdown_msg[1]);
|
||||
if (usb_no_shutdown_wait == 0) {
|
||||
/* wait for shutdown callback to be executed */
|
||||
usb_proc_mwait(&bus->explore_proc,
|
||||
usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->shutdown_msg[0], &bus->shutdown_msg[1]);
|
||||
}
|
||||
USB_BUS_UNLOCK(bus);
|
||||
@ -358,9 +360,9 @@ usb_bus_explore(struct usb_proc_msg *pm)
|
||||
* The following three lines of code are only here to
|
||||
* recover from DDB:
|
||||
*/
|
||||
usb_proc_rewakeup(&bus->control_xfer_proc);
|
||||
usb_proc_rewakeup(&bus->giant_callback_proc);
|
||||
usb_proc_rewakeup(&bus->non_giant_callback_proc);
|
||||
usb_proc_rewakeup(USB_BUS_CONTROL_XFER_PROC(bus));
|
||||
usb_proc_rewakeup(USB_BUS_GIANT_PROC(bus));
|
||||
usb_proc_rewakeup(USB_BUS_NON_GIANT_PROC(bus));
|
||||
#endif
|
||||
|
||||
USB_BUS_UNLOCK(bus);
|
||||
@ -585,7 +587,7 @@ usb_power_wdog(void *arg)
|
||||
* The following line of code is only here to recover from
|
||||
* DDB:
|
||||
*/
|
||||
usb_proc_rewakeup(&bus->explore_proc); /* recover from DDB */
|
||||
usb_proc_rewakeup(USB_BUS_EXPLORE_PROC(bus)); /* recover from DDB */
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_POWERD
|
||||
@ -708,8 +710,6 @@ usb_bus_attach(struct usb_proc_msg *pm)
|
||||
static void
|
||||
usb_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
{
|
||||
const char *pname = device_get_nameunit(dev);
|
||||
|
||||
mtx_lock(&Giant);
|
||||
if (usb_devclass_ptr == NULL)
|
||||
usb_devclass_ptr = devclass_find("usbus");
|
||||
@ -749,28 +749,31 @@ usb_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
bus->shutdown_msg[1].hdr.pm_callback = &usb_bus_shutdown;
|
||||
bus->shutdown_msg[1].bus = bus;
|
||||
|
||||
#if USB_HAVE_PER_BUS_PROCESS
|
||||
/* Create USB explore and callback processes */
|
||||
|
||||
if (usb_proc_create(&bus->giant_callback_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
if (usb_proc_create(USB_BUS_GIANT_PROC(bus),
|
||||
&bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
|
||||
device_printf(dev, "WARNING: Creation of USB Giant "
|
||||
"callback process failed.\n");
|
||||
} else if (usb_proc_create(&bus->non_giant_callback_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_HIGH)) {
|
||||
} else if (usb_proc_create(USB_BUS_NON_GIANT_PROC(bus),
|
||||
&bus->bus_mtx, device_get_nameunit(dev), USB_PRI_HIGH)) {
|
||||
device_printf(dev, "WARNING: Creation of USB non-Giant "
|
||||
"callback process failed.\n");
|
||||
} else if (usb_proc_create(&bus->explore_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
} else if (usb_proc_create(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
|
||||
device_printf(dev, "WARNING: Creation of USB explore "
|
||||
"process failed.\n");
|
||||
} else if (usb_proc_create(&bus->control_xfer_proc,
|
||||
&bus->bus_mtx, pname, USB_PRI_MED)) {
|
||||
} else if (usb_proc_create(USB_BUS_CONTROL_XFER_PROC(bus),
|
||||
&bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
|
||||
device_printf(dev, "WARNING: Creation of USB control transfer "
|
||||
"process failed.\n");
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Get final attach going */
|
||||
USB_BUS_LOCK(bus);
|
||||
usb_proc_msignal(&bus->explore_proc,
|
||||
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->attach_msg[0], &bus->attach_msg[1]);
|
||||
USB_BUS_UNLOCK(bus);
|
||||
|
||||
@ -778,7 +781,6 @@ usb_attach_sub(device_t dev, struct usb_bus *bus)
|
||||
usb_needs_explore(bus, 1);
|
||||
}
|
||||
}
|
||||
|
||||
SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -547,19 +547,12 @@ xhci_init(struct xhci_softc *sc, device_t self)
|
||||
sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg;
|
||||
sc->sc_config_msg[1].bus = &sc->sc_bus;
|
||||
|
||||
if (usb_proc_create(&sc->sc_config_proc,
|
||||
&sc->sc_bus.bus_mtx, device_get_nameunit(self), USB_PRI_MED)) {
|
||||
printf("WARNING: Creation of XHCI configure "
|
||||
"callback process failed.\n");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
xhci_uninit(struct xhci_softc *sc)
|
||||
{
|
||||
usb_proc_free(&sc->sc_config_proc);
|
||||
|
||||
usb_bus_mem_free_all(&sc->sc_bus, &xhci_iterate_hw_softc);
|
||||
|
||||
cv_destroy(&sc->sc_cmd_cv);
|
||||
@ -2684,7 +2677,7 @@ xhci_transfer_insert(struct usb_xfer *xfer)
|
||||
DPRINTFN(8, "Not running\n");
|
||||
|
||||
/* start configuration */
|
||||
(void)usb_proc_msignal(&sc->sc_config_proc,
|
||||
(void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus),
|
||||
&sc->sc_config_msg[0], &sc->sc_config_msg[1]);
|
||||
return (0);
|
||||
}
|
||||
@ -3652,7 +3645,7 @@ xhci_start_dma_delay(struct usb_xfer *xfer)
|
||||
/* put transfer on interrupt queue (again) */
|
||||
usbd_transfer_enqueue(&sc->sc_bus.intr_q, xfer);
|
||||
|
||||
(void)usb_proc_msignal(&sc->sc_config_proc,
|
||||
(void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus),
|
||||
&sc->sc_config_msg[0], &sc->sc_config_msg[1]);
|
||||
}
|
||||
|
||||
|
@ -434,8 +434,7 @@ struct xhci_softc {
|
||||
struct xhci_hw_softc sc_hw;
|
||||
/* base device */
|
||||
struct usb_bus sc_bus;
|
||||
/* configure process */
|
||||
struct usb_process sc_config_proc;
|
||||
/* configure message */
|
||||
struct usb_bus_msg sc_config_msg[2];
|
||||
|
||||
union xhci_hub_desc sc_hub_desc;
|
||||
|
@ -51,7 +51,16 @@ struct usb_bus_stat {
|
||||
struct usb_bus {
|
||||
struct usb_bus_stat stats_err;
|
||||
struct usb_bus_stat stats_ok;
|
||||
#if USB_HAVE_ROOT_MOUNT_HOLD
|
||||
struct root_hold_token *bus_roothold;
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_PER_BUS_PROCESS
|
||||
#define USB_BUS_GIANT_PROC(bus) (&(bus)->giant_callback_proc)
|
||||
#define USB_BUS_NON_GIANT_PROC(bus) (&(bus)->non_giant_callback_proc)
|
||||
#define USB_BUS_EXPLORE_PROC(bus) (&(bus)->explore_proc)
|
||||
#define USB_BUS_CONTROL_XFER_PROC(bus) (&(bus)->control_xfer_proc)
|
||||
|
||||
/*
|
||||
* There are two callback processes. One for Giant locked
|
||||
* callbacks. One for non-Giant locked callbacks. This should
|
||||
@ -65,6 +74,7 @@ struct usb_bus {
|
||||
|
||||
/* Control request process */
|
||||
struct usb_process control_xfer_proc;
|
||||
#endif
|
||||
|
||||
struct usb_bus_msg explore_msg[2];
|
||||
struct usb_bus_msg detach_msg[2];
|
||||
|
@ -2128,7 +2128,7 @@ usb_free_device(struct usb_device *udev, uint8_t flag)
|
||||
* anywhere:
|
||||
*/
|
||||
USB_BUS_LOCK(udev->bus);
|
||||
usb_proc_mwait(&udev->bus->non_giant_callback_proc,
|
||||
usb_proc_mwait(USB_BUS_NON_GIANT_PROC(udev->bus),
|
||||
&udev->cs_msg[0], &udev->cs_msg[1]);
|
||||
USB_BUS_UNLOCK(udev->bus);
|
||||
|
||||
|
@ -68,7 +68,7 @@ usb_temp_setup_by_index_t *usb_temp_setup_by_index_p = &usb_temp_setup_by_index_
|
||||
usb_temp_unsetup_t *usb_temp_unsetup_p = &usb_temp_unsetup_w;
|
||||
usb_test_quirk_t *usb_test_quirk_p = &usb_test_quirk_w;
|
||||
usb_quirk_ioctl_t *usb_quirk_ioctl_p = &usb_quirk_ioctl_w;
|
||||
devclass_t usb_devclass_ptr = NULL;
|
||||
devclass_t usb_devclass_ptr;
|
||||
|
||||
static usb_error_t
|
||||
usb_temp_setup_by_index_w(struct usb_device *udev, uint16_t index)
|
||||
|
@ -44,6 +44,7 @@
|
||||
#define USB_HAVE_PF 1
|
||||
#define USB_HAVE_ROOT_MOUNT_HOLD 1
|
||||
#define USB_HAVE_ID_SECTION 1
|
||||
#define USB_HAVE_PER_BUS_PROCESS 1
|
||||
|
||||
#define USB_TD_GET_PROC(td) (td)->td_proc
|
||||
#define USB_PROC_GET_GID(td) (td)->p_pgid
|
||||
|
@ -44,6 +44,7 @@
|
||||
#define USB_HAVE_PF 0
|
||||
#define USB_HAVE_ROOT_MOUNT_HOLD 0
|
||||
#define USB_HAVE_ID_SECTION 0
|
||||
#define USB_HAVE_PER_BUS_PROCESS 0
|
||||
|
||||
#define USB_TD_GET_PROC(td) (td)->td_proc
|
||||
#define USB_PROC_GET_GID(td) (td)->p_pgid
|
||||
|
@ -1917,7 +1917,7 @@ usb_needs_explore(struct usb_bus *bus, uint8_t do_probe)
|
||||
if (do_probe) {
|
||||
bus->do_probe = 1;
|
||||
}
|
||||
if (usb_proc_msignal(&bus->explore_proc,
|
||||
if (usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
|
||||
&bus->explore_msg[0], &bus->explore_msg[1])) {
|
||||
/* ignore */
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method)
|
||||
sizeof(scsi_tct_eject), USB_MS_HZ);
|
||||
break;
|
||||
default:
|
||||
printf("usb_msc_eject: unknown eject method (%d)\n", method);
|
||||
DPRINTF("Unknown eject method (%d)\n", method);
|
||||
break;
|
||||
}
|
||||
DPRINTF("Eject CD command status: %s\n", usbd_errstr(err));
|
||||
|
@ -24,8 +24,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define USB_DEBUG_VAR usb_proc_debug
|
||||
|
||||
#ifdef USB_GLOBAL_INCLUDE_FILE
|
||||
#include USB_GLOBAL_INCLUDE_FILE
|
||||
#else
|
||||
@ -52,6 +50,8 @@
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdi_util.h>
|
||||
#include <dev/usb/usb_process.h>
|
||||
|
||||
#define USB_DEBUG_VAR usb_proc_debug
|
||||
#include <dev/usb/usb_debug.h>
|
||||
#include <dev/usb/usb_util.h>
|
||||
|
||||
|
@ -800,8 +800,6 @@ usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port)
|
||||
/* check for errors */
|
||||
if (err)
|
||||
goto done;
|
||||
#ifdef USB_DEBUG
|
||||
#endif
|
||||
n = 0;
|
||||
while (1) {
|
||||
/* wait for the device to recover from reset */
|
||||
|
@ -965,14 +965,14 @@ usbd_transfer_setup(struct usb_device *udev,
|
||||
* deadlock!
|
||||
*/
|
||||
if (setup_start == usb_control_ep_cfg)
|
||||
info->done_p =
|
||||
&udev->bus->control_xfer_proc;
|
||||
info->done_p =
|
||||
USB_BUS_CONTROL_XFER_PROC(udev->bus);
|
||||
else if (xfer_mtx == &Giant)
|
||||
info->done_p =
|
||||
&udev->bus->giant_callback_proc;
|
||||
info->done_p =
|
||||
USB_BUS_GIANT_PROC(udev->bus);
|
||||
else
|
||||
info->done_p =
|
||||
&udev->bus->non_giant_callback_proc;
|
||||
info->done_p =
|
||||
USB_BUS_NON_GIANT_PROC(udev->bus);
|
||||
}
|
||||
/* reset sizes */
|
||||
|
||||
@ -2614,7 +2614,7 @@ usbd_pipe_start(struct usb_xfer_queue *pq)
|
||||
} else if (udev->ctrl_xfer[1]) {
|
||||
info = udev->ctrl_xfer[1]->xroot;
|
||||
usb_proc_msignal(
|
||||
&info->bus->non_giant_callback_proc,
|
||||
USB_BUS_NON_GIANT_PROC(info->bus),
|
||||
&udev->cs_msg[0], &udev->cs_msg[1]);
|
||||
} else {
|
||||
/* should not happen */
|
||||
@ -3216,10 +3216,10 @@ usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max)
|
||||
}
|
||||
|
||||
/* Make sure cv_signal() and cv_broadcast() is not called */
|
||||
udev->bus->control_xfer_proc.up_msleep = 0;
|
||||
udev->bus->explore_proc.up_msleep = 0;
|
||||
udev->bus->giant_callback_proc.up_msleep = 0;
|
||||
udev->bus->non_giant_callback_proc.up_msleep = 0;
|
||||
USB_BUS_CONTROL_XFER_PROC(udev->bus)->up_msleep = 0;
|
||||
USB_BUS_EXPLORE_PROC(udev->bus)->up_msleep = 0;
|
||||
USB_BUS_GIANT_PROC(udev->bus)->up_msleep = 0;
|
||||
USB_BUS_NON_GIANT_PROC(udev->bus)->up_msleep = 0;
|
||||
|
||||
/* poll USB hardware */
|
||||
(udev->bus->methods->xfer_poll) (udev->bus);
|
||||
|
@ -88,9 +88,8 @@ static u_char ext2_ft_to_dt[] = {
|
||||
DT_SOCK, /* EXT2_FT_SOCK */
|
||||
DT_LNK, /* EXT2_FT_SYMLINK */
|
||||
};
|
||||
#define FTTODT(ft) \
|
||||
((ft) > sizeof(ext2_ft_to_dt) / sizeof(ext2_ft_to_dt[0]) ? \
|
||||
DT_UNKNOWN : ext2_ft_to_dt[(ft)])
|
||||
#define FTTODT(ft) \
|
||||
((ft) < nitems(ext2_ft_to_dt) ? ext2_ft_to_dt[(ft)] : DT_UNKNOWN)
|
||||
|
||||
static u_char dt_to_ext2_ft[] = {
|
||||
EXT2_FT_UNKNOWN, /* DT_UNKNOWN */
|
||||
@ -109,9 +108,8 @@ static u_char dt_to_ext2_ft[] = {
|
||||
EXT2_FT_UNKNOWN, /* unused */
|
||||
EXT2_FT_UNKNOWN, /* DT_WHT */
|
||||
};
|
||||
#define DTTOFT(dt) \
|
||||
((dt) > sizeof(dt_to_ext2_ft) / sizeof(dt_to_ext2_ft[0]) ? \
|
||||
EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
|
||||
#define DTTOFT(dt) \
|
||||
((dt) < nitems(dt_to_ext2_ft) ? dt_to_ext2_ft[(dt)] : EXT2_FT_UNKNOWN)
|
||||
|
||||
static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
|
||||
int entryoffsetinblock);
|
||||
@ -1088,7 +1086,7 @@ ext2_checkpath(source, target, cred)
|
||||
struct ucred *cred;
|
||||
{
|
||||
struct vnode *vp;
|
||||
int error, rootino, namlen;
|
||||
int error, namlen;
|
||||
struct dirtemplate dirbuf;
|
||||
|
||||
vp = ITOV(target);
|
||||
@ -1096,10 +1094,10 @@ ext2_checkpath(source, target, cred)
|
||||
error = EEXIST;
|
||||
goto out;
|
||||
}
|
||||
rootino = EXT2_ROOTINO;
|
||||
error = 0;
|
||||
if (target->i_number == rootino)
|
||||
if (target->i_number == EXT2_ROOTINO) {
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (vp->v_type != VDIR) {
|
||||
@ -1123,7 +1121,7 @@ ext2_checkpath(source, target, cred)
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (dirbuf.dotdot_ino == rootino)
|
||||
if (dirbuf.dotdot_ino == EXT2_ROOTINO)
|
||||
break;
|
||||
vput(vp);
|
||||
if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino,
|
||||
|
@ -48,7 +48,6 @@ struct ext2mount {
|
||||
struct vnode *um_devvp; /* block device mounted vnode */
|
||||
|
||||
struct m_ext2fs *um_e2fs; /* EXT2FS */
|
||||
#define em_e2fsb um_e2fs->e2fs
|
||||
|
||||
u_long um_nindir; /* indirect ptrs per block */
|
||||
u_long um_bptrtodb; /* indir ptr to disk block */
|
||||
|
@ -730,7 +730,7 @@ ext2_link(ap)
|
||||
goto out;
|
||||
}
|
||||
ip = VTOI(vp);
|
||||
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
|
||||
if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) {
|
||||
error = EMLINK;
|
||||
goto out;
|
||||
}
|
||||
@ -841,7 +841,7 @@ abortit:
|
||||
goto abortit;
|
||||
dp = VTOI(fdvp);
|
||||
ip = VTOI(fvp);
|
||||
if (ip->i_nlink >= LINK_MAX) {
|
||||
if (ip->i_nlink >= EXT2_LINK_MAX) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
error = EMLINK;
|
||||
goto abortit;
|
||||
@ -939,7 +939,7 @@ abortit:
|
||||
* parent we don't fool with the link count.
|
||||
*/
|
||||
if (doingdirectory && newparent) {
|
||||
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
|
||||
if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) {
|
||||
error = EMLINK;
|
||||
goto bad;
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ ext2_mkdir(ap)
|
||||
panic("ext2_mkdir: no name");
|
||||
#endif
|
||||
dp = VTOI(dvp);
|
||||
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
|
||||
if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) {
|
||||
error = EMLINK;
|
||||
goto out;
|
||||
}
|
||||
@ -1524,7 +1524,7 @@ ext2_pathconf(ap)
|
||||
|
||||
switch (ap->a_name) {
|
||||
case _PC_LINK_MAX:
|
||||
*ap->a_retval = LINK_MAX;
|
||||
*ap->a_retval = EXT2_LINK_MAX;
|
||||
return (0);
|
||||
case _PC_NAME_MAX:
|
||||
*ap->a_retval = NAME_MAX;
|
||||
|
@ -52,14 +52,10 @@
|
||||
* radix tree should be able to operate well no matter how much
|
||||
* fragmentation there is and no matter how large a bitmap is used.
|
||||
*
|
||||
* Unlike the rlist code, the blist code wires all necessary memory at
|
||||
* creation time. Neither allocations nor frees require interaction with
|
||||
* the memory subsystem. In contrast, the rlist code may allocate memory
|
||||
* on an rlist_free() call. The non-blocking features of the blist code
|
||||
* are used to great advantage in the swap code (vm/nswap_pager.c). The
|
||||
* rlist code uses a little less overall memory than the blist code (but
|
||||
* due to swap interleaving not all that much less), but the blist code
|
||||
* scales much, much better.
|
||||
* The blist code wires all necessary memory at creation time. Neither
|
||||
* allocations nor frees require interaction with the memory subsystem.
|
||||
* The non-blocking features of the blist code are used in the swap code
|
||||
* (vm/swap_pager.c).
|
||||
*
|
||||
* LAYOUT: The radix tree is layed out recursively using a
|
||||
* linear array. Each meta node is immediately followed (layed out
|
||||
|
@ -105,13 +105,14 @@
|
||||
#ifdef QUEUE_MACRO_DEBUG
|
||||
/* Store the last 2 places the queue element or head was altered */
|
||||
struct qm_trace {
|
||||
char * lastfile;
|
||||
int lastline;
|
||||
char * prevfile;
|
||||
int prevline;
|
||||
unsigned long lastline;
|
||||
unsigned long prevline;
|
||||
const char *lastfile;
|
||||
const char *prevfile;
|
||||
};
|
||||
|
||||
#define TRACEBUF struct qm_trace trace;
|
||||
#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } ,
|
||||
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
|
||||
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
|
||||
|
||||
@ -134,6 +135,7 @@ struct qm_trace {
|
||||
#define QMD_TRACE_HEAD(head)
|
||||
#define QMD_SAVELINK(name, link)
|
||||
#define TRACEBUF
|
||||
#define TRACEBUF_INITIALIZER
|
||||
#define TRASHIT(x)
|
||||
#endif /* QUEUE_MACRO_DEBUG */
|
||||
|
||||
@ -461,7 +463,7 @@ struct name { \
|
||||
}
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
|
||||
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
|
@ -22,6 +22,4 @@ LDADD= -lvmmapi -lmd -lpthread
|
||||
|
||||
WARNS?= 2
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../sys
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -979,6 +979,7 @@ top_makefile_rules(FILE *outmk)
|
||||
{
|
||||
prog_t *p;
|
||||
|
||||
fprintf(outmk, "LD?= ld\n");
|
||||
if ( subtract_strlst(&libs, &libs_so) )
|
||||
fprintf(outmk, "# NOTE: Some LIBS declarations below overridden by LIBS_SO\n");
|
||||
|
||||
@ -1108,7 +1109,7 @@ prog_makefile_rules(FILE *outmk, prog_t *p)
|
||||
fprintf(outmk, " $(%s_LIBS)", p->ident);
|
||||
|
||||
fprintf(outmk, "\n");
|
||||
fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)",
|
||||
fprintf(outmk, "\t$(LD) -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)",
|
||||
p->name, p->name, p->ident);
|
||||
if (p->libs)
|
||||
fprintf(outmk, " $(%s_LIBS)", p->ident);
|
||||
|
@ -5,8 +5,6 @@ PROG= pciconf
|
||||
SRCS= pciconf.c cap.c err.c
|
||||
MAN= pciconf.8
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../sys
|
||||
|
||||
WARNS?= 3
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
Loading…
x
Reference in New Issue
Block a user