summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--games/fortune/datfiles/fortunes10
-rw-r--r--games/fortune/datfiles/fortunes-o.real4
-rw-r--r--games/fortune/datfiles/fortunes-o.sp.ok2
-rw-r--r--games/fortune/datfiles/fortunes.sp.ok51
-rw-r--r--games/fortune/datfiles/freebsd-tips.sp.ok1
-rw-r--r--games/fortune/datfiles/gerrold.limerick2
-rw-r--r--games/fortune/datfiles/limerick4
-rw-r--r--games/fortune/datfiles/limerick.sp.ok3
-rw-r--r--games/fortune/datfiles/startrek.sp.ok1
-rw-r--r--games/fortune/datfiles/zippy.sp.ok2
-rw-r--r--games/morse/morse.c40
-rw-r--r--lib/libprocstat/Makefile3
-rw-r--r--lib/libprocstat/Symbol.map16
-rw-r--r--lib/libprocstat/Versions.def5
-rw-r--r--lib/libprocstat/libprocstat.c2
-rw-r--r--sbin/geom/class/part/geom_part.c75
-rw-r--r--sbin/ifconfig/ifmedia.c6
-rw-r--r--share/man/man4/hpet.44
-rw-r--r--share/man/man4/man4.i386/Makefile1
-rw-r--r--share/man/man4/man4.i386/glxiic.4106
-rw-r--r--sys/conf/files.i3861
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_cal.c2
-rw-r--r--sys/dev/cxgbe/t4_sge.c13
-rw-r--r--sys/dev/glxiic/glxiic.c1077
-rw-r--r--sys/dev/iwn/if_iwn.c10
-rw-r--r--sys/dev/mii/mii.c6
-rw-r--r--sys/dev/mk48txx/mk48txx.c4
-rw-r--r--sys/dev/mk48txx/mk48txxreg.h3
-rw-r--r--sys/dev/scc/scc_bfe_ebus.c3
-rw-r--r--sys/dev/uart/uart_cpu_sparc64.c3
-rw-r--r--sys/geom/eli/g_eli_key_cache.c1
-rw-r--r--sys/i386/conf/NOTES6
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/glxiic/Makefile10
-rw-r--r--sys/net/if_media.h25
-rw-r--r--sys/sparc64/sparc64/eeprom.c5
36 files changed, 1338 insertions, 171 deletions
diff --git a/games/fortune/datfiles/fortunes b/games/fortune/datfiles/fortunes
index 3f0ef02..7f2a7d4 100644
--- a/games/fortune/datfiles/fortunes
+++ b/games/fortune/datfiles/fortunes
@@ -10494,13 +10494,13 @@ Anti-trust laws should be approached with exactly that attitude.
Antonio Antonio
Was tired of living alonio
He thought he would woo Antonio Antonio
-Miss Lucamy Lu, Rode of on his polo ponio
+Miss Lucamy Lu, Rode off on his polo ponio
Miss Lucamy Lucy Molonio. And found the maid
In a bowery shade,
Sitting and knitting alonio.
Antonio Antonio
Said if you will be my ownio
-I'll love tou true Oh nonio Antonio
+I'll love you true Oh nonio Antonio
And buy for you You're far too bleak and bonio
An icery creamry conio. And all that I wish
You singular fish
@@ -10509,7 +10509,7 @@ Antonio Antonio
Uttered a dismal moanio
And went off and hid
Or I'm told that he did
-In the Antartical Zonio.
+In the Antarctical Zonio.
%
Antonym, n.:
The opposite of the word you're trying to think of.
@@ -20232,7 +20232,7 @@ Good-bye. I am leaving because I am bored.
Goodbye, cool world.
%
Goose pimples rose all over me, my hair stood on end, my eyes filled with
-tears of love and gratitude for this greatest of all conquerers of human
+tears of love and gratitude for this greatest of all conquerors of human
misery and shame, and my breath came in little gasps. If I had not known
that the Leader would have scorned such adulation, I might have fallen to
my knees in unashamed worship, but instead I drew myself to attention, raised
@@ -25099,7 +25099,7 @@ intellectual
enlightenment
%
IBM:
- [Internation Business Machines Corp.] Also known as Itty Bitty
+ [International Business Machines Corp.] Also known as Itty Bitty
Machines or The Lawyer's Friend. The dominant force in computer
marketing, having supplied worldwide some 75% of all known hardware
and 10% of all software. To protect itself from the litigious envy
diff --git a/games/fortune/datfiles/fortunes-o.real b/games/fortune/datfiles/fortunes-o.real
index 3e47792..3733ef9 100644
--- a/games/fortune/datfiles/fortunes-o.real
+++ b/games/fortune/datfiles/fortunes-o.real
@@ -7722,7 +7722,7 @@ I wooed a stewed nude in Bermuda,
I was lewd, but my God! she was lewder.
She said it was crude
To be wooed in the nude--
-I persued her, subdued her, and screwed her!
+I pursued her, subdued her, and screwed her!
%
I would like to say, Mister Bunce,
I'm a great connoisseur of hot cunts.
@@ -9044,7 +9044,7 @@ raped, his house burned, and all his cattle rustled. When he told his
distant neighbors about the tragedy, a few of them reported that the only
stranger they had seen in the area for weeks was a tall desperado wearing a
black hat and a red neckerchief.
- The cowboy saddled his fastest horse and set out to find the villian.
+ The cowboy saddled his fastest horse and set out to find the villain.
He searched for months but couldn't catch up with the culprit; in town after
dusty town he was told that a man fitting the description had been there but
had just departed; usually after some heinous crime.
diff --git a/games/fortune/datfiles/fortunes-o.sp.ok b/games/fortune/datfiles/fortunes-o.sp.ok
index 75cff75..e7734c6 100644
--- a/games/fortune/datfiles/fortunes-o.sp.ok
+++ b/games/fortune/datfiles/fortunes-o.sp.ok
@@ -1121,7 +1121,6 @@ pees
penis
pere
Perelman
-persued
pestes
Peteer
Pettigrew
@@ -1600,7 +1599,6 @@ vibrators
vici
Vida
vidi
-villian
virginem
Visme
viziti
diff --git a/games/fortune/datfiles/fortunes.sp.ok b/games/fortune/datfiles/fortunes.sp.ok
index 2ba73ec..02229cd 100644
--- a/games/fortune/datfiles/fortunes.sp.ok
+++ b/games/fortune/datfiles/fortunes.sp.ok
@@ -139,7 +139,6 @@ Anouilh
ANRS
Ansley
answerback
-Antartic
Anthony's
Antonym
Antrim
@@ -375,7 +374,6 @@ Bertolt
Besicovitch
Beslove
Betazoid
-bethumped
Bette
Bevan
BEW
@@ -468,7 +466,6 @@ booing
bookaholic
Booker's
boola
-Boorchi
Boorstin
bootable
Boothe
@@ -576,7 +573,6 @@ Bulwer
bumperless
Bumstead
Bungei
-BURBULATION
Buren
Burggoven
burgled
@@ -623,7 +619,6 @@ Callahan
Callahan's
Callimachus
Camden
-Camelia
Cameron
Camillo
Campbell
@@ -771,7 +766,6 @@ Churchill's
Churchy
Chuzzlewit
CI
-Cianci
Ciardi
cinched
cinema's
@@ -806,7 +800,6 @@ Cochran
cockamamie
Cocteau
Cody
-Cody's
Coevolution
cogito
Cohen's
@@ -826,7 +819,6 @@ Comebacks
Commedia
Commie
CommUNIXque
-compuberty
computatis
Computerdom
computerites
@@ -1077,8 +1069,6 @@ DJ
DMPK
Dobb's
Dobbs
-doberman
-doberperson
Dobie
Doc
Docquier
@@ -1203,7 +1193,6 @@ EINS
Einstein's
Eisley
Elbert
-ELBONICS
Eldridge
electrocommunications
Electrocution
@@ -1264,7 +1253,6 @@ Eschenbach
Escher
esperantisto
Esplandian
-Esser
est
estas
Estes
@@ -1293,7 +1281,6 @@ exhalation
exhibitionists
EXP
expatriated
-extemporanea
extracurricular
Exupery
Exxon's
@@ -1301,7 +1288,6 @@ eyestalks
Eyquem
Ezrin
FAA
-FACISM
Factorials
Fadiman
Fafhrd
@@ -1340,7 +1326,6 @@ Fellgett's
Felton
feminism's
Femme
-FENDERBERG
Fenelon
Fenster
Ferber
@@ -1369,7 +1354,6 @@ fikcio
fiks
filees
filename
-Filgoer's
filigrees
Filkharmonics
Fillmore
@@ -1398,7 +1382,6 @@ flamewars
Flandry
Flannagan's
Flannery
-FLANNISTER
Flappity
flatfoot
flatteries
@@ -1410,7 +1393,6 @@ Flon's
floppity
Florio
floss
-flouride
Flugg's
Flummery
flutterby
@@ -1557,7 +1539,6 @@ Geminis
Genderplex
Genesereth
Genghis
-genlock
genocide
Genter
Geritol
@@ -1605,7 +1586,6 @@ Giuseppe
Glanvill
Glaser
gleekzorp
-GLEEMITES
Glegg
gleknow
Glib's
@@ -2013,7 +1993,6 @@ if's
ifthen
Igmmlptk
Ignatowski
-ignisecond
ihuxw
IIc
III's
@@ -2498,7 +2477,6 @@ Lovin
Lowells
Lowery's
Lowes
-Lownes
LP
LPA
LSD
@@ -2534,7 +2512,6 @@ Ma's
Mabbitt
Mabley
Macaroons
-MacBeth
Maccius
MacDowell
MacDuff
@@ -2621,7 +2598,6 @@ Matz's
Maud
Maud'Dib
Maugham
-Maughm
Maupin
Maureens
Maurois
@@ -2630,7 +2606,6 @@ Maxey
Maxson
May's
Mayorga
-Mårten
MBAs
MBH
MC
@@ -2687,7 +2662,6 @@ Mendelson
mendicants
Mengot
Menninger
-Mensa
Menschen
Meow
meowing
@@ -2715,7 +2689,6 @@ Mickos
microchips
Microcomputing
micrometric
-Microsystem's
Microsystems
MicroVAXes
midgets
@@ -2730,7 +2703,6 @@ milk's
Milkbone
Millay
Milligan
-millihelen
Millikan
Millikan's
millions
@@ -2763,7 +2735,6 @@ Mitford
Mitgong
mittengrabben
mitts
-mittsquinter
MITZIE
Mix's
Miyamoto
@@ -2779,7 +2750,6 @@ modifaiing
Modula
Moebius
Mohandas
-Mohandis
mohmen
Moishe
Molander
@@ -2803,7 +2773,6 @@ Moolah
moonshiner's
Moore's
mopeds
-mophobia
Moping
moralists
Mordecai
@@ -2832,7 +2801,6 @@ Mt
MTA
Muad'dib
muckest
-mucklucks
Mudgeeraba
Mudhead
mudslide
@@ -2888,7 +2856,6 @@ nanohenry
nanometers
Nansen
Napoleon's
-narcolepulacyi
Narnia
Nasium's
Naso
@@ -2909,7 +2876,6 @@ Neantical
Nebuchadnezzar
Nebuchadnezzar's
necesas
-necessitious
NecroSoft
Nehru
Neil's
@@ -2940,7 +2906,6 @@ NF
NFL
Ngdanga
Niagra
-Niccoli
Nicklaus
Nicol
Nicolaides
@@ -3165,7 +3130,6 @@ Pearsall
PECCATOPHOBIA
Pecor's
Pedaeration
-pediddel
Peers's
Pegler
pelted
@@ -3192,7 +3156,6 @@ Personifiers
Petaluma
Petersons
Petr
-petribar
Petronius
Pfeiffer
Pfffttt
@@ -3204,7 +3167,6 @@ Philips
philogyny
phoney
Phooey
-phosflink
Picadilly
Pickard
Pickle's
@@ -3246,7 +3208,6 @@ Pocataligo
Pocatello
Podunk
Pohl's
-Poincair
Poincare's
pointy
Polanski
@@ -3347,7 +3308,6 @@ Pumpernickel
punchline
punning
PUPs
-PURPITATION
Purshottam
PUSHes
pushy
@@ -3551,7 +3511,6 @@ Saberhagen
Sacher's
Sadat
Saddam
-sadoequinecrophilia
Saens
Safford
Safire's
@@ -3605,7 +3564,6 @@ Schickele
Schieffer
schisms
schizophrenics
-schlattwhapper
schlichte
schluerfen
Schmendrick
@@ -3631,7 +3589,6 @@ Scintillae
Scott's
Scoville
SCRBL
-SCRIBLINE
Scrubb
scullery
scurries
@@ -3784,7 +3741,6 @@ somebody'd
something's
Sondheim
Sooooo
-Soren
Sorhed
sort've
sorta
@@ -3799,7 +3755,6 @@ SP
Spacemen
Spaceport
spacewar
-SPAGMUMPS
spake
Spam
spank
@@ -3824,7 +3779,6 @@ springenwerk
Springsteen
sprites
SPSW
-SQUATCHO
squaws
squealers
squrooneg
@@ -3980,7 +3934,6 @@ teepers
telematic
telepath
teleportation
-TELEPRESSION
telepsychology
tempfile
tendrils
@@ -4028,7 +3981,6 @@ tinpot
Tirith
tis
Tiselius
-Titas
tites
TLC
TM
@@ -4060,7 +4012,6 @@ toun
Tourbillon
Toven
trans
-transcendant
transmogrifiers
trapezes
Traub
@@ -4121,7 +4072,6 @@ TYDFS
tyg
typefaces
Tyroon
-tzu
Ubi
UDA
Udall's
@@ -4152,7 +4102,6 @@ Unseld
untechnician
unvoist
Updike
-upharsen
uponst
Urey
Urho
diff --git a/games/fortune/datfiles/freebsd-tips.sp.ok b/games/fortune/datfiles/freebsd-tips.sp.ok
index b543ea0..968f318 100644
--- a/games/fortune/datfiles/freebsd-tips.sp.ok
+++ b/games/fortune/datfiles/freebsd-tips.sp.ok
@@ -45,7 +45,6 @@ misc
natserv
ncal
netcat
-netscape
netstat
newfile
NICs
diff --git a/games/fortune/datfiles/gerrold.limerick b/games/fortune/datfiles/gerrold.limerick
index 8c6d054..f0bbce6 100644
--- a/games/fortune/datfiles/gerrold.limerick
+++ b/games/fortune/datfiles/gerrold.limerick
@@ -3,7 +3,7 @@
%% Copyright David Gerrold, 1984-2000, all rights reserved,
%% used with permission of the author.
%%
-%%© This is the copyright line.
+%%© This is the copyright line.
%%Eighty-nine is the year we assign.
%% These verses are caroled
%% by one David Gerrold.
diff --git a/games/fortune/datfiles/limerick b/games/fortune/datfiles/limerick
index a0344a8..5a92c78 100644
--- a/games/fortune/datfiles/limerick
+++ b/games/fortune/datfiles/limerick
@@ -260,7 +260,7 @@ And white footgear intended for tennis.
%
A dulcet-voiced callgirl named Shedd,
Who's cultured, well-spoken, well-bred,
- Had achieved some reknown
+ Had achieved some renown
For her tone going down--
There's a nice civil tongue in her head.
%
@@ -307,7 +307,7 @@ Had sex with a virgin named Grace.
By bleeding all over his face.
%
A gay young prince from Morocco
-Made love in a manner rococco.
+Made love in a manner rococo.
He painted his penis
To resemble a Venus
And flavored his semen with cocoa.
diff --git a/games/fortune/datfiles/limerick.sp.ok b/games/fortune/datfiles/limerick.sp.ok
index 00f1b42..be7135d 100644
--- a/games/fortune/datfiles/limerick.sp.ok
+++ b/games/fortune/datfiles/limerick.sp.ok
@@ -283,6 +283,7 @@ McTavish
meanie
meanies
meany
+Mensa
mentis
midgets
minimis
@@ -353,11 +354,9 @@ quimmy
quints
ravished
Reims
-reknown
Resounded
retriebrve
Rhyll
-rococco
rogered
Salinas
Sandem
diff --git a/games/fortune/datfiles/startrek.sp.ok b/games/fortune/datfiles/startrek.sp.ok
index 5d1180e..ccca709 100644
--- a/games/fortune/datfiles/startrek.sp.ok
+++ b/games/fortune/datfiles/startrek.sp.ok
@@ -14,7 +14,6 @@ Corbomite
Corby
Daystrom
Deela
-Dehaver
Elaan
Eleen
Eneg
diff --git a/games/fortune/datfiles/zippy.sp.ok b/games/fortune/datfiles/zippy.sp.ok
index 4214fca..b2f3fff 100644
--- a/games/fortune/datfiles/zippy.sp.ok
+++ b/games/fortune/datfiles/zippy.sp.ok
@@ -180,7 +180,7 @@ manicurist
matic
meatball
meltdown
-naugahide
+naugahyde
obstetrician
poindexter
pre
diff --git a/games/morse/morse.c b/games/morse/morse.c
index 6c8ff5f..f0abae39 100644
--- a/games/morse/morse.c
+++ b/games/morse/morse.c
@@ -161,20 +161,20 @@ static const struct morsetab iso8859_1tab[] = {
static const struct morsetab iso8859_7tab[] = {
/*
- * The greek alphabet; you'll need an 8859-7 font in order
+ * The Greek alphabet; you'll need an ISO8859-7 font in order
* to see the actual characters.
* This table does not implement:
* - the special sequences for the seven diphthongs,
* - the punctuation differences.
* Implementing these features would introduce too many
* special-cases in the program's main loop.
- * The diphtong sequences are:
+ * The diphthong sequences are:
* alpha iota .-.-
* alpha upsilon ..--
* epsilon upsilon ---.
* eta upsilon ...-
- * omikron iota ---..
- * omikron upsilon ..-
+ * omicron iota ---..
+ * omicron upsilon ..-
* upsilon iota .---
* The different punctuation symbols are:
* ; ..-.-
@@ -193,10 +193,10 @@ static const struct morsetab iso8859_7tab[] = {
{'è', "-.-."}, /* theta */
{'é', ".."}, /* iota */
{'ß', ".."}, /* iota with acute */
- {'ú', ".."}, /* iota with diairesis */
- {'À', ".."}, /* iota with acute and diairesis */
+ {'ú', ".."}, /* iota with diaeresis */
+ {'À', ".."}, /* iota with acute and diaeresis */
{'ê', "-.-"}, /* kappa */
- {'ë', ".-.."}, /* lamda */
+ {'ë', ".-.."}, /* lambda */
{'ì', "--"}, /* mu */
{'í', "-."}, /* nu */
{'î', "-..-"}, /* xi */
@@ -209,8 +209,8 @@ static const struct morsetab iso8859_7tab[] = {
{'ô', "-"}, /* tau */
{'õ', "-.--"}, /* upsilon */
{'ý', "-.--"}, /* upsilon with acute */
- {'û', "-.--"}, /* upsilon and diairesis */
- {'à', "-.--"}, /* upsilon with acute and diairesis */
+ {'û', "-.--"}, /* upsilon and diaeresis */
+ {'à', "-.--"}, /* upsilon with acute and diaeresis */
{'ö', "..-."}, /* phi */
{'÷', "----"}, /* chi */
{'ø', "--.-"}, /* psi */
@@ -222,29 +222,29 @@ static const struct morsetab iso8859_7tab[] = {
static const struct morsetab koi8rtab[] = {
/*
- * the cyrillic alphabet; you'll need a KOI8R font in order
+ * The Cyrillic alphabet; you'll need a KOI8-R font in order
* to see the actual characters
*/
- {'Á', ".-"}, /* a */
+ {'Á', ".-"}, /* a */
{'Â', "-..."}, /* be */
{'×', ".--"}, /* ve */
{'Ç', "--."}, /* ge */
{'Ä', "-.."}, /* de */
- {'Å', "."}, /* ye */
- {'£', "."}, /* yo, the same as ye */
+ {'Å', "."}, /* ye */
+ {'£', "."}, /* yo, the same as ye */
{'Ö', "...-"}, /* she */
{'Ú', "--.."}, /* ze */
- {'É', ".."}, /* i */
+ {'É', ".."}, /* i */
{'Ê', ".---"}, /* i kratkoye */
{'Ë', "-.-"}, /* ka */
{'Ì', ".-.."}, /* el */
- {'Í', "--"}, /* em */
- {'Î', "-."}, /* en */
+ {'Í', "--"}, /* em */
+ {'Î', "-."}, /* en */
{'Ï', "---"}, /* o */
{'Ð', ".--."}, /* pe */
{'Ò', ".-."}, /* er */
{'Ó', "..."}, /* es */
- {'Ô', "-"}, /* te */
+ {'Ô', "-"}, /* te */
{'Õ', "..-"}, /* u */
{'Æ', "..-."}, /* ef */
{'È', "...."}, /* kha */
@@ -305,9 +305,9 @@ main(int argc, char **argv)
while ((ch = getopt(argc, argv, GETOPTOPTS)) != -1)
switch ((char) ch) {
- case 'c':
- cpm = atoi(optarg);
- break;
+ case 'c':
+ cpm = atoi(optarg);
+ break;
case 'd':
device = optarg;
break;
diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
index e289ef5..e509169 100644
--- a/lib/libprocstat/Makefile
+++ b/lib/libprocstat/Makefile
@@ -12,6 +12,9 @@ SRCS= cd9660.c \
smbfs.c \
udf.c
+VERSION_DEF= ${.CURDIR}/Versions.def
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+
INCS= libprocstat.h
CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
SHLIB_MAJOR= 1
diff --git a/lib/libprocstat/Symbol.map b/lib/libprocstat/Symbol.map
new file mode 100644
index 0000000..b5d64d0
--- /dev/null
+++ b/lib/libprocstat/Symbol.map
@@ -0,0 +1,16 @@
+/*
+ * $FreeBSD$
+ */
+FBSD_1.2 {
+ procstat_close;
+ procstat_freefiles;
+ procstat_freeprocs;
+ procstat_get_pipe_info;
+ procstat_get_pts_info;
+ procstat_get_socket_info;
+ procstat_get_vnode_info;
+ procstat_getfiles;
+ procstat_getprocs;
+ procstat_open_kvm;
+ procstat_open_sysctl;
+};
diff --git a/lib/libprocstat/Versions.def b/lib/libprocstat/Versions.def
new file mode 100644
index 0000000..d69f5c9
--- /dev/null
+++ b/lib/libprocstat/Versions.def
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+# This version was first added to 9.0-current.
+FBSD_1.2 {
+};
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 95b00d3..8440bec 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -253,7 +253,7 @@ procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped)
if (procstat->type == PROCSTAT_SYSCTL)
return (procstat_getfiles_sysctl(procstat, kp, mmapped));
else if (procstat->type == PROCSTAT_KVM)
- return (procstat_getfiles_kvm(procstat, kp, mmapped));
+ return (procstat_getfiles_kvm(procstat, kp, mmapped));
else
return (NULL);
}
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index ed7b8f8..81d0291 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -253,13 +253,7 @@ find_provider(struct ggeom *gp, off_t minsector)
bestsector = 0;
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector =
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
-
+ sector = (off_t)strtoimax(s, NULL, 0);
if (sector < minsector)
continue;
if (bestpp != NULL && sector >= bestsector)
@@ -379,18 +373,9 @@ gpart_autofill_resize(struct gctl_req *req)
errx(EXIT_FAILURE, "invalid partition index");
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- start = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- start = (off_t)strtoimax(s, NULL, 0);
+ start = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- lba = start +
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- lba = (off_t)strtoimax(s, NULL, 0) + 1;
+ lba = (off_t)strtoimax(s, NULL, 0) + 1;
if (lba > last) {
geom_deletetree(&mesh);
@@ -402,12 +387,7 @@ gpart_autofill_resize(struct gctl_req *req)
new_size = ALIGNDOWN(last - start + 1, alignment);
else {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- new_lba =
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- new_lba = (off_t)strtoimax(s, NULL, 0);
+ new_lba = (off_t)strtoimax(s, NULL, 0);
/*
* Is there any free space between current and
* next providers?
@@ -512,12 +492,7 @@ gpart_autofill(struct gctl_req *req)
last = ALIGNDOWN(last, alignment);
while ((pp = find_provider(gp, first)) != NULL) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- lba = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- lba = (off_t)strtoimax(s, NULL, 0);
-
+ lba = (off_t)strtoimax(s, NULL, 0);
a_lba = ALIGNDOWN(lba, alignment);
if (first < a_lba && a_first < a_lba) {
/* Free space [first, lba> */
@@ -543,12 +518,7 @@ gpart_autofill(struct gctl_req *req)
}
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- first = lba +
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- first = (off_t)strtoimax(s, NULL, 0) + 1;
+ first = (off_t)strtoimax(s, NULL, 0) + 1;
a_first = ALIGNUP(first, alignment);
}
if (a_first <= last) {
@@ -625,21 +595,12 @@ gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
while ((pp = find_provider(gp, first)) != NULL) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
+ sector = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- length = (off_t)strtoimax(s, NULL, 0) / secsz;
- end = sector + length - 1;
- } else {
- end = (off_t)strtoimax(s, NULL, 0);
- length = end - sector + 1;
- }
+ end = (off_t)strtoimax(s, NULL, 0);
+ length = end - sector + 1;
+
s = find_provcfg(pp, "index");
idx = atoi(s);
if (first < sector) {
@@ -782,20 +743,12 @@ gpart_backup(struct gctl_req *req, unsigned int fl __unused)
printf("%s %s\n", scheme, s);
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
+ sector = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- length = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else {
- end = (off_t)strtoimax(s, NULL, 0);
- length = end - sector + 1;
- }
+ end = (off_t)strtoimax(s, NULL, 0);
+ length = end - sector + 1;
+
s = find_provcfg(pp, "label");
printf("%-*s %*s %*jd %*jd %s %s\n",
windex, find_provcfg(pp, "index"),
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 0fd2f2b..0b0daa3 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -268,13 +268,9 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp)
subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) |
+ ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
- if ((ifr.ifr_media & IFM_TMASK) == 0) {
- ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK);
- }
-
ifmr->ifm_current = ifr.ifr_media;
callback_register(setifmediacallback, (void *)ifmr);
}
diff --git a/share/man/man4/hpet.4 b/share/man/man4/hpet.4
index f787895..f501e0b 100644
--- a/share/man/man4/hpet.4
+++ b/share/man/man4/hpet.4
@@ -69,14 +69,14 @@ This driver uses High Precision Event Timer hardware (part of the chipset,
usually enumerated via ACPI) to supply kernel with one time counter and
several (usually from 3 to 8) event timers.
This hardware includes single main counter with known increment frequency
-(10MHz or more), and several programable comparators (optionally with
+(10MHz or more), and several programmable comparators (optionally with
automatic reload feature).
When value of the main counter matches current value of any comparator,
interrupt can be generated.
Depending on hardware capabilities and configuration, interrupt can be
delivered as regular I/O APIC interrupt (ISA or PCI) in range from 0 to 31,
or as Front Side Bus interrupt, alike to PCI MSI interrupts, or in so called
-"LegacyReplacement Route" HPET can speal IRQ0 of i8254 and IRQ8 of the RTC.
+"LegacyReplacement Route" HPET can steal IRQ0 of i8254 and IRQ8 of the RTC.
Interrupt can be either edge- or level-triggered. In last case they could be
safely shared with PCI IRQs.
Driver prefers to use FSB interrupts, if supported, to avoid sharing.
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
index 0134d57..974eec0 100644
--- a/share/man/man4/man4.i386/Makefile
+++ b/share/man/man4/man4.i386/Makefile
@@ -12,6 +12,7 @@ MAN= aic.4 \
ep.4 \
ex.4 \
fe.4 \
+ glxiic.4 \
glxsb.4 \
ie.4 \
longrun.4 \
diff --git a/share/man/man4/man4.i386/glxiic.4 b/share/man/man4/man4.i386/glxiic.4
new file mode 100644
index 0000000..30d3ffe
--- /dev/null
+++ b/share/man/man4/man4.i386/glxiic.4
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2011 Henrik Brix Andersen <brix@FreeBSD.org>
+.\" 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 ``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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2011
+.Dt GLXIIC 4 i386
+.Os
+.Sh NAME
+.Nm glxiic
+.Nd Geode LX CS5536 I2C controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device isa"
+.Cd "device glxiic"
+.Cd "device iicbus"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+glxiic_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the System Management Bus controller of the Geode LX
+series CS5536 Companion Device. The Geode LX is a member of the AMD
+Geode family of integrated x86 system chips.
+.Pp
+Although AMD refers to this device as a System Management Bus (SMBus)
+controller, it is really an I2C controller (it lacks SMBus ALERT# and
+Alert Response support).
+.Pp
+The
+.Nm
+driver supports both I2C master and slave mode.
+.Sh SYSCTL VARIABLE
+The
+.Nm
+driver supports the following variable as both
+.Xr sysctl 8
+and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.glxiic.0.timeout
+This variable controls the I2C bus timeout in milliseconds. The
+default timeout is 35 milliseconds. A value of zero disables the
+timeout.
+.El
+.Sh CAVEAT
+The
+.Nm
+driver uses the interrupt line number configured by the board firmware
+by default. If no interrupt line number has been configured by the
+board firmware (or to override the interrupt line number configured by
+board firmware), place the following line in
+.Xr device.hints 5 :
+.Bd -ragged -offset indent
+hint.glxiic.0.irq="10"
+.Ed
+.Pp
+The interrupt line number must be between 1 and 15.
+.Sh SEE ALSO
+.Xr iicbus 4 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr loader 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver and manual page first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver and manual page were written by
+.An Henrik Brix Andersen Aq brix@FreeBSD.org .
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index f518bc9..4f0d0d0 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -171,6 +171,7 @@ dev/fdc/fdc_acpi.c optional fdc
dev/fdc/fdc_isa.c optional fdc isa
dev/fdc/fdc_pccard.c optional fdc pccard
dev/fe/if_fe_isa.c optional fe isa
+dev/glxiic/glxiic.c optional glxiic
dev/glxsb/glxsb.c optional glxsb
dev/glxsb/glxsb_hash.c optional glxsb
dev/hptmv/entry.c optional hptmv
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
index d8609bb..ee61c30 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
@@ -501,7 +501,7 @@ ar5416PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan,
* and update the history buffer.
*/
r = ar5416GetNf(ah, chan);
- if (r <= 0) {
+ if (r == 0 || r == -1) {
/* NF calibration result isn't valid */
HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, "%s: NF calibration"
" didn't finish; delaying CCA\n", __func__);
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 5440528..5f59db6 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -141,6 +141,7 @@ static int handle_sge_egr_update(struct adapter *,
const struct cpl_sge_egr_update *);
static int ctrl_tx(struct adapter *, struct sge_ctrlq *, struct mbuf *);
+static int sysctl_abs_id(SYSCTL_HANDLER_ARGS);
extern void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *);
@@ -1363,6 +1364,9 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx)
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
+ SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "abs_id",
+ CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_abs_id, "I",
+ "absolute id of the queue");
#ifdef INET
SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD,
&rxq->lro.lro_queued, 0, NULL);
@@ -2733,3 +2737,12 @@ failed:
return (rc);
}
+
+static int
+sysctl_abs_id(SYSCTL_HANDLER_ARGS)
+{
+ uint16_t *id = arg1;
+ int i = *id;
+
+ return sysctl_handle_int(oidp, &i, 0, req);
+}
diff --git a/sys/dev/glxiic/glxiic.c b/sys/dev/glxiic/glxiic.c
new file mode 100644
index 0000000..2040951
--- /dev/null
+++ b/sys/dev/glxiic/glxiic.c
@@ -0,0 +1,1077 @@
+/*-
+ * Copyright (c) 2011 Henrik Brix Andersen <brix@FreeBSD.org>
+ * 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 ``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>
+__FBSDID("$FreeBSD$");
+/*
+ * AMD Geode LX CS5536 System Management Bus controller.
+ *
+ * Although AMD refers to this device as an SMBus controller, it
+ * really is an I2C controller (It lacks SMBus ALERT# and Alert
+ * Response support).
+ *
+ * The driver is implemented as an interrupt-driven state machine,
+ * supporting both master and slave mode.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sysctl.h>
+#ifdef GLXIIC_DEBUG
+#include <sys/syslog.h>
+#endif
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.h>
+
+#include <dev/iicbus/iiconf.h>
+#include <dev/iicbus/iicbus.h>
+
+#include "iicbus_if.h"
+
+/* CS5536 PCI-ISA ID. */
+#define GLXIIC_CS5536_DEV_ID 0x20901022
+
+/* MSRs. */
+#define GLXIIC_MSR_PIC_YSEL_HIGH 0x51400021
+
+/* Bus speeds. */
+#define GLXIIC_SLOW 0x0258 /* 10 kHz. */
+#define GLXIIC_FAST 0x0078 /* 50 kHz. */
+#define GLXIIC_FASTEST 0x003c /* 100 kHz. */
+
+/* Default bus activity timeout in milliseconds. */
+#define GLXIIC_DEFAULT_TIMEOUT 35
+
+/* GPIO register offsets. */
+#define GLXIIC_GPIOL_OUT_AUX1_SEL 0x10
+#define GLXIIC_GPIOL_IN_AUX1_SEL 0x34
+
+/* GPIO 14 (SMB_CLK) and 15 (SMB_DATA) bitmasks. */
+#define GLXIIC_GPIO_14_15_ENABLE 0x0000c000
+#define GLXIIC_GPIO_14_15_DISABLE 0xc0000000
+
+/* SMB register offsets. */
+#define GLXIIC_SMB_SDA 0x00
+#define GLXIIC_SMB_STS 0x01
+#define GLXIIC_SMB_STS_SLVSTP_BIT (1 << 7)
+#define GLXIIC_SMB_STS_SDAST_BIT (1 << 6)
+#define GLXIIC_SMB_STS_BER_BIT (1 << 5)
+#define GLXIIC_SMB_STS_NEGACK_BIT (1 << 4)
+#define GLXIIC_SMB_STS_STASTR_BIT (1 << 3)
+#define GLXIIC_SMB_STS_NMATCH_BIT (1 << 2)
+#define GLXIIC_SMB_STS_MASTER_BIT (1 << 1)
+#define GLXIIC_SMB_STS_XMIT_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL_STS 0x02
+#define GLXIIC_SMB_CTRL_STS_TGSCL_BIT (1 << 5)
+#define GLXIIC_SMB_CTRL_STS_TSDA_BIT (1 << 4)
+#define GLXIIC_SMB_CTRL_STS_GCMTCH_BIT (1 << 3)
+#define GLXIIC_SMB_CTRL_STS_MATCH_BIT (1 << 2)
+#define GLXIIC_SMB_CTRL_STS_BB_BIT (1 << 1)
+#define GLXIIC_SMB_CTRL_STS_BUSY_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL1 0x03
+#define GLXIIC_SMB_CTRL1_STASTRE_BIT (1 << 7)
+#define GLXIIC_SMB_CTRL1_NMINTE_BIT (1 << 6)
+#define GLXIIC_SMB_CTRL1_GCMEN_BIT (1 << 5)
+#define GLXIIC_SMB_CTRL1_ACK_BIT (1 << 4)
+#define GLXIIC_SMB_CTRL1_INTEN_BIT (1 << 2)
+#define GLXIIC_SMB_CTRL1_STOP_BIT (1 << 1)
+#define GLXIIC_SMB_CTRL1_START_BIT (1 << 0)
+#define GLXIIC_SMB_ADDR 0x04
+#define GLXIIC_SMB_ADDR_SAEN_BIT (1 << 7)
+#define GLXIIC_SMB_CTRL2 0x05
+#define GLXIIC_SMB_CTRL2_EN_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL3 0x06
+
+typedef enum {
+ GLXIIC_STATE_IDLE,
+ GLXIIC_STATE_SLAVE_TX,
+ GLXIIC_STATE_SLAVE_RX,
+ GLXIIC_STATE_MASTER_ADDR,
+ GLXIIC_STATE_MASTER_TX,
+ GLXIIC_STATE_MASTER_RX,
+ GLXIIC_STATE_MASTER_STOP,
+ GLXIIC_STATE_MAX,
+} glxiic_state_t;
+
+struct glxiic_softc {
+ device_t dev; /* Myself. */
+ device_t iicbus; /* IIC bus. */
+ struct mtx mtx; /* Lock. */
+ glxiic_state_t state; /* Driver state. */
+ struct callout callout; /* Driver state timeout callout. */
+ int timeout; /* Driver state timeout (ms). */
+
+ int smb_rid; /* SMB controller resource ID. */
+ struct resource *smb_res; /* SMB controller resource. */
+ int gpio_rid; /* GPIO resource ID. */
+ struct resource *gpio_res; /* GPIO resource. */
+
+ int irq_rid; /* IRQ resource ID. */
+ struct resource *irq_res; /* IRQ resource. */
+ void *irq_handler; /* IRQ handler cookie. */
+ int old_irq; /* IRQ mapped by board firmware. */
+
+ struct iic_msg *msg; /* Current master mode message. */
+ uint32_t nmsgs; /* Number of messages remaining. */
+ uint8_t *data; /* Current master mode data byte. */
+ uint16_t ndata; /* Number of data bytes remaining. */
+ int error; /* Last master mode error. */
+
+ uint8_t addr; /* Own address. */
+ uint16_t sclfrq; /* Bus frequency. */
+};
+
+#ifdef GLXIIC_DEBUG
+#define DEBUG(fmt, args...) log(LOG_DEBUG, "%s: " fmt "\n" , __func__ , ## args)
+#else
+#define DEBUG(fmt, args...)
+#endif
+
+#define GLXIIC_SCLFRQ(n) ((n << 1))
+#define GLXIIC_SMBADDR(n) ((n >> 1))
+#define GLXIIC_SMB_IRQ_TO_MAP(n) ((n << 16))
+#define GLXIIC_MAP_TO_SMB_IRQ(n) ((n >> 16) & 0xf)
+
+#define GLXIIC_LOCK(_sc) mtx_lock(&_sc->mtx)
+#define GLXIIC_UNLOCK(_sc) mtx_unlock(&_sc->mtx)
+#define GLXIIC_LOCK_INIT(_sc) \
+ mtx_init(&_sc->mtx, device_get_nameunit(_sc->dev), "glxiic", MTX_DEF)
+#define GLXIIC_SLEEP(_sc) \
+ mtx_sleep(_sc, &_sc->mtx, IICPRI, "glxiic", 0)
+#define GLXIIC_WAKEUP(_sc) wakeup(_sc);
+#define GLXIIC_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx);
+#define GLXIIC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED);
+
+typedef int (glxiic_state_callback_t)(struct glxiic_softc *sc,
+ uint8_t status);
+
+static glxiic_state_callback_t glxiic_state_idle_callback;
+static glxiic_state_callback_t glxiic_state_slave_tx_callback;
+static glxiic_state_callback_t glxiic_state_slave_rx_callback;
+static glxiic_state_callback_t glxiic_state_master_addr_callback;
+static glxiic_state_callback_t glxiic_state_master_tx_callback;
+static glxiic_state_callback_t glxiic_state_master_rx_callback;
+static glxiic_state_callback_t glxiic_state_master_stop_callback;
+
+struct glxiic_state_table_entry {
+ glxiic_state_callback_t *callback;
+ boolean_t master;
+};
+typedef struct glxiic_state_table_entry glxiic_state_table_entry_t;
+
+static glxiic_state_table_entry_t glxiic_state_table[GLXIIC_STATE_MAX] = {
+ [GLXIIC_STATE_IDLE] = {
+ .callback = &glxiic_state_idle_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_SLAVE_TX] = {
+ .callback = &glxiic_state_slave_tx_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_SLAVE_RX] = {
+ .callback = &glxiic_state_slave_rx_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_MASTER_ADDR] = {
+ .callback = &glxiic_state_master_addr_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_TX] = {
+ .callback = &glxiic_state_master_tx_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_RX] = {
+ .callback = &glxiic_state_master_rx_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_STOP] = {
+ .callback = &glxiic_state_master_stop_callback,
+ .master = TRUE,
+ },
+};
+
+static void glxiic_identify(driver_t *driver, device_t parent);
+static int glxiic_probe(device_t dev);
+static int glxiic_attach(device_t dev);
+static int glxiic_detach(device_t dev);
+
+static uint8_t glxiic_read_status_locked(struct glxiic_softc *sc);
+static void glxiic_stop_locked(struct glxiic_softc *sc);
+static void glxiic_timeout(void *arg);
+static void glxiic_start_timeout_locked(struct glxiic_softc *sc);
+static void glxiic_set_state_locked(struct glxiic_softc *sc,
+ glxiic_state_t state);
+static int glxiic_handle_slave_match_locked(struct glxiic_softc *sc,
+ uint8_t status);
+static void glxiic_intr(void *arg);
+
+static int glxiic_reset(device_t dev, u_char speed, u_char addr,
+ u_char *oldaddr);
+static int glxiic_transfer(device_t dev, struct iic_msg *msgs,
+ uint32_t nmsgs);
+
+static void glxiic_smb_map_interrupt(int irq);
+static void glxiic_gpio_enable(struct glxiic_softc *sc);
+static void glxiic_gpio_disable(struct glxiic_softc *sc);
+static void glxiic_smb_enable(struct glxiic_softc *sc, uint8_t speed,
+ uint8_t addr);
+static void glxiic_smb_disable(struct glxiic_softc *sc);
+
+static device_method_t glxiic_methods[] = {
+ DEVMETHOD(device_identify, glxiic_identify),
+ DEVMETHOD(device_probe, glxiic_probe),
+ DEVMETHOD(device_attach, glxiic_attach),
+ DEVMETHOD(device_detach, glxiic_detach),
+
+ DEVMETHOD(iicbus_reset, glxiic_reset),
+ DEVMETHOD(iicbus_transfer, glxiic_transfer),
+ DEVMETHOD(iicbus_callback, iicbus_null_callback),
+
+ { 0, 0 }
+};
+
+static driver_t glxiic_driver = {
+ "glxiic",
+ glxiic_methods,
+ sizeof(struct glxiic_softc),
+};
+
+static devclass_t glxiic_devclass;
+
+DRIVER_MODULE(glxiic, isab, glxiic_driver, glxiic_devclass, 0, 0);
+DRIVER_MODULE(iicbus, glxiic, iicbus_driver, iicbus_devclass, 0, 0);
+MODULE_DEPEND(glxiic, iicbus, 1, 1, 1);
+
+static void
+glxiic_identify(driver_t *driver, device_t parent)
+{
+
+ /* Prevent child from being added more than once. */
+ if (device_find_child(parent, driver->name, -1) != NULL)
+ return;
+
+ if (pci_get_devid(parent) == GLXIIC_CS5536_DEV_ID) {
+ if (device_add_child(parent, driver->name, -1) == NULL)
+ device_printf(parent, "Could not add glxiic child\n");
+ }
+}
+
+static int
+glxiic_probe(device_t dev)
+{
+
+ if (resource_disabled("glxiic", device_get_unit(dev)))
+ return (ENXIO);
+
+ device_set_desc(dev, "AMD Geode CS5536 SMBus controller");
+
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+glxiic_attach(device_t dev)
+{
+ struct glxiic_softc *sc;
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *tree;
+ int error, irq, unit;
+ uint32_t irq_map;
+ char tn[32];
+
+ sc = device_get_softc(dev);
+ sc->dev = dev;
+ sc->state = GLXIIC_STATE_IDLE;
+ error = 0;
+
+ GLXIIC_LOCK_INIT(sc);
+ callout_init_mtx(&sc->callout, &sc->mtx, 0);
+
+ sc->smb_rid = PCIR_BAR(0);
+ sc->smb_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->smb_rid,
+ RF_ACTIVE);
+ if (sc->smb_res == NULL) {
+ device_printf(dev, "Could not allocate SMBus I/O port\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ sc->gpio_rid = PCIR_BAR(1);
+ sc->gpio_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
+ &sc->gpio_rid, RF_SHAREABLE | RF_ACTIVE);
+ if (sc->gpio_res == NULL) {
+ device_printf(dev, "Could not allocate GPIO I/O port\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ /* Ensure the controller is not enabled by firmware. */
+ glxiic_smb_disable(sc);
+
+ /* Read the existing IRQ map. */
+ irq_map = rdmsr(GLXIIC_MSR_PIC_YSEL_HIGH);
+ sc->old_irq = GLXIIC_MAP_TO_SMB_IRQ(irq_map);
+
+ unit = device_get_unit(dev);
+ if (resource_int_value("glxiic", unit, "irq", &irq) == 0) {
+ if (irq < 1 || irq > 15) {
+ device_printf(dev, "Bad value %d for glxiic.%d.irq\n",
+ irq, unit);
+ error = ENXIO;
+ goto out;
+ }
+
+ if (bootverbose)
+ device_printf(dev, "Using irq %d set by hint\n", irq);
+ } else if (sc->old_irq != 0) {
+ if (bootverbose)
+ device_printf(dev, "Using irq %d set by firmware\n",
+ irq);
+ irq = sc->old_irq;
+ } else {
+ device_printf(dev, "No irq mapped by firmware");
+ printf(" and no glxiic.%d.irq hint provided\n", unit);
+ error = ENXIO;
+ goto out;
+ }
+
+ /* Map the SMBus interrupt to the requested legacy IRQ. */
+ glxiic_smb_map_interrupt(irq);
+
+ sc->irq_rid = 0;
+ sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid,
+ irq, irq, 1, RF_SHAREABLE | RF_ACTIVE);
+ if (sc->irq_res == NULL) {
+ device_printf(dev, "Could not allocate IRQ %d\n", irq);
+ error = ENXIO;
+ goto out;
+ }
+
+ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
+ NULL, glxiic_intr, sc, &(sc->irq_handler));
+ if (error != 0) {
+ device_printf(dev, "Could not setup IRQ handler\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) {
+ device_printf(dev, "Could not allocate iicbus instance\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ ctx = device_get_sysctl_ctx(dev);
+ tree = device_get_sysctl_tree(dev);
+
+ sc->timeout = GLXIIC_DEFAULT_TIMEOUT;
+ snprintf(tn, sizeof(tn), "dev.glxiic.%d.timeout", unit);
+ TUNABLE_INT_FETCH(tn, &sc->timeout);
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "timeout", CTLFLAG_RW | CTLFLAG_TUN, &sc->timeout, 0,
+ "activity timeout in ms");
+
+ glxiic_gpio_enable(sc);
+ glxiic_smb_enable(sc, IIC_FASTEST, 0);
+
+ error = bus_generic_attach(dev);
+ if (error != 0) {
+ device_printf(dev, "Could not probe and attach children\n");
+ error = ENXIO;
+ }
+out:
+ if (error != 0) {
+ callout_drain(&sc->callout);
+
+ if (sc->iicbus != NULL)
+ device_delete_child(dev, sc->iicbus);
+ if (sc->smb_res != NULL) {
+ glxiic_smb_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->smb_rid,
+ sc->smb_res);
+ }
+ if (sc->gpio_res != NULL) {
+ glxiic_gpio_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->gpio_rid,
+ sc->gpio_res);
+ }
+ if (sc->irq_handler != NULL)
+ bus_teardown_intr(dev, sc->irq_res, sc->irq_handler);
+ if (sc->irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid,
+ sc->irq_res);
+
+ /* Restore the old SMBus interrupt mapping. */
+ glxiic_smb_map_interrupt(sc->old_irq);
+
+ GLXIIC_LOCK_DESTROY(sc);
+ }
+
+ return (error);
+}
+
+static int
+glxiic_detach(device_t dev)
+{
+ struct glxiic_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ goto out;
+ if (sc->iicbus != NULL)
+ error = device_delete_child(dev, sc->iicbus);
+
+out:
+ callout_drain(&sc->callout);
+
+ if (sc->smb_res != NULL) {
+ glxiic_smb_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->smb_rid,
+ sc->smb_res);
+ }
+ if (sc->gpio_res != NULL) {
+ glxiic_gpio_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->gpio_rid,
+ sc->gpio_res);
+ }
+ if (sc->irq_handler != NULL)
+ bus_teardown_intr(dev, sc->irq_res, sc->irq_handler);
+ if (sc->irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid,
+ sc->irq_res);
+
+ /* Restore the old SMBus interrupt mapping. */
+ glxiic_smb_map_interrupt(sc->old_irq);
+
+ GLXIIC_LOCK_DESTROY(sc);
+
+ return (error);
+}
+
+static uint8_t
+glxiic_read_status_locked(struct glxiic_softc *sc)
+{
+ uint8_t status;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ status = bus_read_1(sc->smb_res, GLXIIC_SMB_STS);
+
+ /* Clear all status flags except SDAST and STASTR after reading. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS, (GLXIIC_SMB_STS_SLVSTP_BIT |
+ GLXIIC_SMB_STS_BER_BIT | GLXIIC_SMB_STS_NEGACK_BIT |
+ GLXIIC_SMB_STS_NMATCH_BIT));
+
+ return (status);
+}
+
+static void
+glxiic_stop_locked(struct glxiic_softc *sc)
+{
+ uint8_t status, ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ status = glxiic_read_status_locked(sc);
+
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_STOP_BIT);
+
+ /*
+ * Perform a dummy read of SDA in master receive mode to clear
+ * SDAST if set.
+ */
+ if ((status & GLXIIC_SMB_STS_XMIT_BIT) == 0 &&
+ (status & GLXIIC_SMB_STS_SDAST_BIT) != 0)
+ bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+
+ /* Check stall after start bit and clear if needed */
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ }
+}
+
+static void
+glxiic_timeout(void *arg)
+{
+ struct glxiic_softc *sc;
+ uint8_t error;
+
+ sc = (struct glxiic_softc *)arg;
+
+ DEBUG("timeout in state %d", sc->state);
+
+ if (glxiic_state_table[sc->state].master) {
+ sc->error = IIC_ETIMEOUT;
+ GLXIIC_WAKEUP(sc);
+ } else {
+ error = IIC_ETIMEOUT;
+ iicbus_intr(sc->iicbus, INTR_ERROR, &error);
+ }
+
+ glxiic_smb_disable(sc);
+ glxiic_smb_enable(sc, IIC_UNKNOWN, sc->addr);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+}
+
+static void
+glxiic_start_timeout_locked(struct glxiic_softc *sc)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ callout_reset(&sc->callout, sc->timeout * 1000 / hz, glxiic_timeout,
+ sc);
+}
+
+static void
+glxiic_set_state_locked(struct glxiic_softc *sc, glxiic_state_t state)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if (state == GLXIIC_STATE_IDLE)
+ callout_stop(&sc->callout);
+ else if (sc->timeout > 0)
+ glxiic_start_timeout_locked(sc);
+
+ sc->state = state;
+}
+
+static int
+glxiic_handle_slave_match_locked(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl_sts, addr;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ ctrl_sts = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL_STS);
+
+ if ((ctrl_sts & GLXIIC_SMB_CTRL_STS_MATCH_BIT) != 0) {
+ if ((status & GLXIIC_SMB_STS_XMIT_BIT) != 0) {
+ addr = sc->addr | LSB;
+ glxiic_set_state_locked(sc,
+ GLXIIC_STATE_SLAVE_TX);
+ } else {
+ addr = sc->addr & ~LSB;
+ glxiic_set_state_locked(sc,
+ GLXIIC_STATE_SLAVE_RX);
+ }
+ iicbus_intr(sc->iicbus, INTR_START, &addr);
+ } else if ((ctrl_sts & GLXIIC_SMB_CTRL_STS_GCMTCH_BIT) != 0) {
+ addr = 0;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_SLAVE_RX);
+ iicbus_intr(sc->iicbus, INTR_GENERAL, &addr);
+ } else {
+ DEBUG("unknown slave match");
+ return (IIC_ESTATUS);
+ }
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_idle_callback(struct glxiic_softc *sc, uint8_t status)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in idle");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_slave_tx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t data;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in slave tx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SLVSTP_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_STOP, NULL);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_NOACK, NULL);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ /* Handle repeated start in slave mode. */
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ DEBUG("not awaiting data in slave tx");
+ return (IIC_ESTATUS);
+ }
+
+ iicbus_intr(sc->iicbus, INTR_TRANSMIT, &data);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, data);
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_slave_rx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t data;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in slave rx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SLVSTP_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_STOP, NULL);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ /* Handle repeated start in slave mode. */
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ DEBUG("no pending data in slave rx");
+ return (IIC_ESTATUS);
+ }
+
+ data = bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+ iicbus_intr(sc->iicbus, INTR_RECEIVE, &data);
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_addr_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t slave;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error after master start");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ DEBUG("not bus master after master start");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ DEBUG("not awaiting address in master addr");
+ return (IIC_ESTATUS);
+ }
+
+ if ((sc->msg->flags & IIC_M_RD) != 0) {
+ slave = sc->msg->slave | LSB;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_RX);
+ } else {
+ slave = sc->msg->slave & ~LSB;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_TX);
+ }
+
+ sc->data = sc->msg->buf;
+ sc->ndata = sc->msg->len;
+
+ /* Handle address-only transfer. */
+ if (sc->ndata == 0)
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, slave);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_tx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in master tx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ DEBUG("not bus master in master tx");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ DEBUG("slave nack in master tx");
+ return (IIC_ENOACK);
+ }
+
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ DEBUG("not awaiting data in master tx");
+ return (IIC_ESTATUS);
+ }
+
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, *sc->data++);
+ if (--sc->ndata == 0)
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+ else
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_rx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in master rx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ DEBUG("not bus master in master rx");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ DEBUG("slave nack in rx");
+ return (IIC_ENOACK);
+ }
+
+ if (sc->ndata == 1) {
+ /* Last byte from slave, set NACK. */
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_ACK_BIT);
+ }
+
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ /* Bus is stalled, clear and wait for data. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ DEBUG("no pending data in master rx");
+ return (IIC_ESTATUS);
+ }
+
+ *sc->data++ = bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+ if (--sc->ndata == 0) {
+ /* Proceed with stop on reading last byte. */
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+ return (glxiic_state_table[sc->state].callback(sc, status));
+ }
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_stop_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ DEBUG("bus error in master stop");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ DEBUG("not bus master in master stop");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ DEBUG("slave nack in master stop");
+ return (IIC_ENOACK);
+ }
+
+ if (--sc->nmsgs > 0) {
+ /* Start transfer of next message. */
+ if ((sc->msg->flags & IIC_M_NOSTOP) == 0) {
+ glxiic_stop_locked(sc);
+ }
+
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_START_BIT);
+
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_ADDR);
+ sc->msg++;
+ } else {
+ /* Last message. */
+ glxiic_stop_locked(sc);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ sc->error = IIC_NOERR;
+ GLXIIC_WAKEUP(sc);
+ }
+
+ return (IIC_NOERR);
+}
+
+static void
+glxiic_intr(void *arg)
+{
+ struct glxiic_softc *sc;
+ int error;
+ uint8_t status, data;
+
+ sc = (struct glxiic_softc *)arg;
+
+ GLXIIC_LOCK(sc);
+
+ status = glxiic_read_status_locked(sc);
+
+ /* Check if this interrupt originated from the SMBus. */
+ if ((status &
+ ~(GLXIIC_SMB_STS_MASTER_BIT | GLXIIC_SMB_STS_XMIT_BIT)) != 0) {
+
+ error = glxiic_state_table[sc->state].callback(sc, status);
+
+ if (error != IIC_NOERR) {
+ if (glxiic_state_table[sc->state].master) {
+ glxiic_stop_locked(sc);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ sc->error = error;
+ GLXIIC_WAKEUP(sc);
+ } else {
+ data = error & 0xff;
+ iicbus_intr(sc->iicbus, INTR_ERROR, &data);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ }
+ }
+ }
+
+ GLXIIC_UNLOCK(sc);
+}
+
+static int
+glxiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
+{
+ struct glxiic_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ GLXIIC_LOCK(sc);
+
+ if (oldaddr != NULL)
+ *oldaddr = sc->addr;
+ sc->addr = addr;
+
+ /* A disable/enable cycle resets the controller. */
+ glxiic_smb_disable(sc);
+ glxiic_smb_enable(sc, speed, addr);
+
+ if (glxiic_state_table[sc->state].master) {
+ sc->error = IIC_ESTATUS;
+ GLXIIC_WAKEUP(sc);
+ }
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+
+ GLXIIC_UNLOCK(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
+{
+ struct glxiic_softc *sc;
+ int error;
+ uint8_t ctrl1;
+
+ sc = device_get_softc(dev);
+
+ GLXIIC_LOCK(sc);
+
+ if (sc->state != GLXIIC_STATE_IDLE) {
+ error = IIC_EBUSBSY;
+ goto out;
+ }
+
+ sc->msg = msgs;
+ sc->nmsgs = nmsgs;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_ADDR);
+
+ /* Set start bit and let glxiic_intr() handle the transfer. */
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_START_BIT);
+
+ GLXIIC_SLEEP(sc);
+ error = sc->error;
+out:
+ GLXIIC_UNLOCK(sc);
+
+ return (error);
+}
+
+static void
+glxiic_smb_map_interrupt(int irq)
+{
+ uint32_t irq_map;
+ int old_irq;
+
+ /* Protect the read-modify-write operation. */
+ critical_enter();
+
+ irq_map = rdmsr(GLXIIC_MSR_PIC_YSEL_HIGH);
+ old_irq = GLXIIC_MAP_TO_SMB_IRQ(irq_map);
+
+ if (irq != old_irq) {
+ irq_map &= ~GLXIIC_SMB_IRQ_TO_MAP(old_irq);
+ irq_map |= GLXIIC_SMB_IRQ_TO_MAP(irq);
+ wrmsr(GLXIIC_MSR_PIC_YSEL_HIGH, irq_map);
+ }
+
+ critical_exit();
+}
+
+static void
+glxiic_gpio_enable(struct glxiic_softc *sc)
+{
+
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_IN_AUX1_SEL,
+ GLXIIC_GPIO_14_15_ENABLE);
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_OUT_AUX1_SEL,
+ GLXIIC_GPIO_14_15_ENABLE);
+}
+
+static void
+glxiic_gpio_disable(struct glxiic_softc *sc)
+{
+
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_OUT_AUX1_SEL,
+ GLXIIC_GPIO_14_15_DISABLE);
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_IN_AUX1_SEL,
+ GLXIIC_GPIO_14_15_DISABLE);
+}
+
+static void
+glxiic_smb_enable(struct glxiic_softc *sc, uint8_t speed, uint8_t addr)
+{
+ uint8_t ctrl1;
+
+ ctrl1 = 0;
+
+ switch (speed) {
+ case IIC_SLOW:
+ sc->sclfrq = GLXIIC_SLOW;
+ break;
+ case IIC_FAST:
+ sc->sclfrq = GLXIIC_FAST;
+ break;
+ case IIC_FASTEST:
+ sc->sclfrq = GLXIIC_FASTEST;
+ break;
+ case IIC_UNKNOWN:
+ default:
+ /* Reuse last frequency. */
+ break;
+ }
+
+ /* Set bus speed and enable controller. */
+ bus_write_2(sc->smb_res, GLXIIC_SMB_CTRL2,
+ GLXIIC_SCLFRQ(sc->sclfrq) | GLXIIC_SMB_CTRL2_EN_BIT);
+
+ if (addr != 0) {
+ /* Enable new match and global call match interrupts. */
+ ctrl1 |= GLXIIC_SMB_CTRL1_NMINTE_BIT |
+ GLXIIC_SMB_CTRL1_GCMEN_BIT;
+ bus_write_1(sc->smb_res, GLXIIC_SMB_ADDR,
+ GLXIIC_SMB_ADDR_SAEN_BIT | GLXIIC_SMBADDR(addr));
+ } else {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_ADDR, 0);
+ }
+
+ /* Enable stall after start and interrupt. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_STASTRE_BIT | GLXIIC_SMB_CTRL1_INTEN_BIT);
+}
+
+static void
+glxiic_smb_disable(struct glxiic_softc *sc)
+{
+ uint16_t sclfrq;
+
+ sclfrq = bus_read_2(sc->smb_res, GLXIIC_SMB_CTRL2);
+ bus_write_2(sc->smb_res, GLXIIC_SMB_CTRL2,
+ sclfrq & ~GLXIIC_SMB_CTRL2_EN_BIT);
+}
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 11c5238..29e391f 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -3527,7 +3527,8 @@ iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
BUS_DMASYNC_PREWRITE);
/* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
+ if (ring->qid >= sc->firstaggqueue)
+ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
/* Kick TX ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
@@ -3730,7 +3731,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, struct mbuf *m,
BUS_DMASYNC_PREWRITE);
/* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
+ if (ring->qid >= sc->firstaggqueue)
+ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
/* Kick TX ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
@@ -3894,7 +3896,6 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
static int
iwn_cmd(struct iwn_softc *sc, int code, const void *buf, int size, int async)
{
- struct iwn_ops *ops = &sc->ops;
struct iwn_tx_ring *ring = &sc->txq[4];
struct iwn_tx_desc *desc;
struct iwn_tx_data *data;
@@ -3954,9 +3955,6 @@ iwn_cmd(struct iwn_softc *sc, int code, const void *buf, int size, int async)
bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map,
BUS_DMASYNC_PREWRITE);
- /* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, 0, 0);
-
/* Kick command ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, ring->qid << 8 | ring->cur);
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index fbdd0ea..224f85d 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -552,7 +552,7 @@ mii_down(struct mii_data *mii)
static unsigned char
mii_bitreverse(unsigned char x)
{
- static unsigned char nibbletab[16] = {
+ unsigned const char const nibbletab[16] = {
0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
};
@@ -567,6 +567,6 @@ mii_oui(u_int id1, u_int id2)
h = (id1 << 6) | (id2 >> 10);
return ((mii_bitreverse(h >> 16) << 16) |
- (mii_bitreverse((h >> 8) & 0xff) << 8) |
- mii_bitreverse(h & 0xff));
+ (mii_bitreverse((h >> 8) & 0xff) << 8) |
+ mii_bitreverse(h & 0xff));
}
diff --git a/sys/dev/mk48txx/mk48txx.c b/sys/dev/mk48txx/mk48txx.c
index 9742e82..de116d0 100644
--- a/sys/dev/mk48txx/mk48txx.c
+++ b/sys/dev/mk48txx/mk48txx.c
@@ -33,7 +33,8 @@
__FBSDID("$FreeBSD$");
/*
- * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines
+ * Mostek MK48T02, MK48T08, MK48T18, MK48T37 and MK48T59 time-of-day chip
+ * subroutines
*/
#include <sys/param.h>
@@ -67,6 +68,7 @@ static const struct {
{ "mk48t02", MK48T02_CLKSZ, MK48T02_CLKOFF, 0 },
{ "mk48t08", MK48T08_CLKSZ, MK48T08_CLKOFF, 0 },
{ "mk48t18", MK48T18_CLKSZ, MK48T18_CLKOFF, 0 },
+ { "mk48t37", MK48T37_CLKSZ, MK48T37_CLKOFF, MK48TXX_EXT_REGISTERS },
{ "mk48t59", MK48T59_CLKSZ, MK48T59_CLKOFF, MK48TXX_EXT_REGISTERS },
};
diff --git a/sys/dev/mk48txx/mk48txxreg.h b/sys/dev/mk48txx/mk48txxreg.h
index bae6ae5..ef55b87 100644
--- a/sys/dev/mk48txx/mk48txxreg.h
+++ b/sys/dev/mk48txx/mk48txxreg.h
@@ -152,5 +152,8 @@
#define MK48T18_CLKSZ 8192
#define MK48T18_CLKOFF 0x1ff0
+#define MK48T37_CLKSZ 32768
+#define MK48T37_CLKOFF 0x1ff0
+
#define MK48T59_CLKSZ 8192
#define MK48T59_CLKOFF 0x1ff0
diff --git a/sys/dev/scc/scc_bfe_ebus.c b/sys/dev/scc/scc_bfe_ebus.c
index 17386db..6c944f7 100644
--- a/sys/dev/scc/scc_bfe_ebus.c
+++ b/sys/dev/scc/scc_bfe_ebus.c
@@ -56,7 +56,8 @@ scc_ebus_probe(device_t dev)
cmpt = ofw_bus_get_compat(dev);
if (cmpt == NULL)
cmpt = "";
- if (!strcmp(nm, "se") || !strcmp(cmpt, "sab82532")) {
+ if (!strcmp(nm, "se") || !strcmp(nm, "FJSV,se") ||
+ !strcmp(cmpt, "sab82532")) {
device_set_desc(dev, "Siemens SAB 82532 dual channel SCC");
sc->sc_class = &scc_sab82532_class;
return (scc_bfe_probe(dev, EBUS_REGSHFT, EBUS_RCLK, 0));
diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c
index c89b39f..582e919 100644
--- a/sys/dev/uart/uart_cpu_sparc64.c
+++ b/sys/dev/uart/uart_cpu_sparc64.c
@@ -238,7 +238,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->bas.regshft = 0;
di->bas.rclk = 0;
class = NULL;
- if (!strcmp(buf, "se") || !strcmp(compat, "sab82532")) {
+ if (!strcmp(buf, "se") || !strcmp(buf, "FJSV,se") ||
+ !strcmp(compat, "sab82532")) {
class = &uart_sab82532_class;
/* SAB82532 are only known to be used for TTYs. */
if ((di->bas.chan = uart_cpu_channel(dev)) == 0)
diff --git a/sys/geom/eli/g_eli_key_cache.c b/sys/geom/eli/g_eli_key_cache.c
index 0a5a9ca..de4989b 100644
--- a/sys/geom/eli/g_eli_key_cache.c
+++ b/sys/geom/eli/g_eli_key_cache.c
@@ -124,6 +124,7 @@ g_eli_key_allocate(struct g_eli_softc *sc, uint64_t keyno)
ekey = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch);
if (ekey != NULL) {
bzero(key, sizeof(*key));
+ free(key, M_ELI);
key = ekey;
TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next);
} else {
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index a68037b..866e641 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -731,6 +731,12 @@ options SAFE_DEBUG # enable debugging support: hw.safe.debug
options SAFE_RNDTEST # enable rndtest support
#
+# glxiic is an I2C driver for the AMD Geode LX CS5536 System Management Bus
+# controller. Requires 'device iicbus'.
+#
+device glxiic # AMD Geode LX CS5536 System Management Bus
+
+#
# glxsb is a driver for the Security Block in AMD Geode LX processors.
# Requires 'device crypto'.
#
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index f3e67c9..a83d56f 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -102,6 +102,7 @@ SUBDIR= ${_3dfx} \
fxp \
gem \
geom \
+ ${_glxiic} \
${_glxsb} \
hatm \
hifn \
@@ -419,6 +420,7 @@ _et= et
_exca= exca
_ext2fs= ext2fs
_fe= fe
+_glxiic= glxiic
_glxsb= glxsb
_i2c= i2c
_ibcs2= ibcs2
diff --git a/sys/modules/glxiic/Makefile b/sys/modules/glxiic/Makefile
new file mode 100644
index 0000000..46b0c07
--- /dev/null
+++ b/sys/modules/glxiic/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+#CFLAGS+= -DGLXIIC_DEBUG
+
+.PATH: ${.CURDIR}/../../dev/glxiic
+KMOD= glxiic
+SRCS= glxiic.c
+SRCS+= device_if.h bus_if.h pci_if.h iicbus_if.h
+
+.include <bsd.kmod.mk>
diff --git a/sys/net/if_media.h b/sys/net/if_media.h
index 1eb26ea..b6fd316 100644
--- a/sys/net/if_media.h
+++ b/sys/net/if_media.h
@@ -370,6 +370,7 @@ struct ifmedia_description {
}
#define IFM_SUBTYPE_ETHERNET_ALIASES { \
+ { IFM_10_T, "10baseT" }, \
{ IFM_10_T, "UTP" }, \
{ IFM_10_T, "10UTP" }, \
{ IFM_10_2, "BNC" }, \
@@ -389,6 +390,23 @@ struct ifmedia_description {
{ IFM_1000_T, "1000TX" }, \
{ IFM_1000_T, "1000T" }, \
{ IFM_2500_SX, "2500SX" }, \
+ \
+ /* \
+ * Shorthands for common media+option combinations as announced \
+ * by miibus(4) \
+ */ \
+ { IFM_10_T | IFM_FDX, "10baseT-FDX" }, \
+ { IFM_10_T | IFM_FDX | IFM_FLOW, "10baseT-FDX-flow" }, \
+ { IFM_100_TX | IFM_FDX, "100baseTX-FDX" }, \
+ { IFM_100_TX | IFM_FDX | IFM_FLOW, "100baseTX-FDX-flow" }, \
+ { IFM_1000_T | IFM_FDX, "1000baseT-FDX" }, \
+ { IFM_1000_T | IFM_FDX | IFM_FLOW, "1000baseT-FDX-flow" }, \
+ { IFM_1000_T | IFM_FDX | IFM_FLOW | IFM_ETH_MASTER, \
+ "1000baseT-FDX-flow-master" }, \
+ { IFM_1000_T | IFM_FDX | IFM_ETH_MASTER, \
+ "1000baseT-FDX-master" }, \
+ { IFM_1000_T | IFM_ETH_MASTER, "1000baseT-master" }, \
+ \
{ 0, NULL }, \
}
@@ -584,6 +602,13 @@ struct ifmedia_description {
#define IFM_SUBTYPE_SHARED_ALIASES { \
{ IFM_AUTO, "auto" }, \
+ \
+ /* \
+ * Shorthands for common media+option combinations as announced \
+ * by miibus(4) \
+ */ \
+ { IFM_AUTO | IFM_FLOW, "auto-flow" }, \
+ \
{ 0, NULL }, \
}
diff --git a/sys/sparc64/sparc64/eeprom.c b/sys/sparc64/sparc64/eeprom.c
index da9909a..e90aecb 100644
--- a/sys/sparc64/sparc64/eeprom.c
+++ b/sys/sparc64/sparc64/eeprom.c
@@ -107,8 +107,11 @@ DRIVER_MODULE(eeprom, sbus, eeprom_driver, eeprom_devclass, 0, 0);
static int
eeprom_probe(device_t dev)
{
+ const char *name;
- if (strcmp("eeprom", ofw_bus_get_name(dev)) == 0) {
+ name = ofw_bus_get_name(dev);
+ if (strcmp(name, "eeprom") == 0 ||
+ strcmp(name, "FJSV,eeprom") == 0) {
device_set_desc(dev, "EEPROM/clock");
return (0);
}
OpenPOWER on IntegriCloud