Home | History | Annotate | Download | only in bktr
History log of /src/sys/dev/pci/bktr/bktr_core.c
RevisionDateAuthorComments
 1.60  27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.59  19-Dec-2021  andvar fix various typos in bktr driver comments.
 1.58  23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.57  23-Feb-2020  skrll typo in comment
 1.56  03-Feb-2019  mrg branches: 1.56.6;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.55  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.54  14-Dec-2012  joerg branches: 1.54.36; 1.54.38;
bt848_format is only defined in a __FreeBSD__ section of bktr_os.c and
overriding the local (static) definition with extern is bogus.
 1.53  27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.52  30-Jun-2011  wiz branches: 1.52.2; 1.52.12;
dependant -> dependent
 1.51  13-Nov-2010  uebayasi Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.50  18-Mar-2009  cegger branches: 1.50.4;
bzero -> memset
 1.49  24-Apr-2008  ad branches: 1.49.2; 1.49.10; 1.49.16;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.48  10-Apr-2008  cegger branches: 1.48.2;
use aprint_*_dev and device_xname
 1.47  01-Mar-2008  rmind Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
 1.46  16-Jan-2008  jmcneill branches: 1.46.2; 1.46.6;
Don't assume that sizeof(long) == sizeof(int); makes bktr work on amd64.
 1.45  04-Jan-2008  ad Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.44  19-Oct-2007  ad branches: 1.44.2; 1.44.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.43  09-Jul-2007  ad branches: 1.43.6; 1.43.8; 1.43.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.42  04-Mar-2007  christos branches: 1.42.2; 1.42.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.41  09-Feb-2007  ad branches: 1.41.2;
Merge newlock2 to head.
 1.40  16-Nov-2006  christos branches: 1.40.2; 1.40.4;
__unused removal on arguments; approved by core.
 1.39  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.38  03-Sep-2006  bouyer branches: 1.38.2; 1.38.4;
stop attaching when a bus_dma operation fails, instead of using bogus
addresses.
Remplace vtophys() with proper bus_dma(9) use.
This driver now works properly on Xen
 1.37  28-Aug-2006  christos remove unreachable code.
 1.36  11-Dec-2005  christos branches: 1.36.4; 1.36.8; 1.36.18;
merge ktrace-lwp.
 1.35  30-May-2005  wiz branches: 1.35.2;
Fix replaco in comment.
 1.34  30-May-2005  christos - avoid variable shadowing
- add const
 1.33  29-Jun-2003  fvdl branches: 1.33.2; 1.33.16;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.32  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.31  03-May-2003  wiz DMA, not dma nor Dma.
 1.30  28-Apr-2003  fvdl Quell a strict-alias warning by applying the same cast to '&target' as
already done in all other cases.
 1.29  12-Mar-2003  wiz Merge some more.
 1.28  12-Mar-2003  wiz Merge first bktr-sf import.
 1.27  10-Jan-2003  mjl Make this work on big endian platforms (mostly from OpenBSD):
Uploaded scripts work better if they are little endian, as the
card's engine expects, so convert to le first.

Also clean up attach routine a bit (use pa_id and PCI_REVISION
instead of fetching it ourselves).

This makes the driver work on my macppc G4, it can decode and
display video and tuner input. Sound does not seem to work, but
this may be my wonky formac bktr-for-macintosh card.
 1.26  25-Dec-2002  toshii Fix broken programming of VSCALE_HI registers in yuv422_prog.
 1.25  25-Dec-2002  toshii Consistently use BKTR_GEN_IRQ and BKTR_RESYNC instead of numbers.
Also, do some whitespace cleanup.
 1.24  25-Dec-2002  toshii Merge FreeBSD rev.1.122:
Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.
 1.23  26-Nov-2002  christos si_ -> sel_
 1.22  28-Aug-2002  toshii Remove a superfluous interrupt request bit in yuvpack_prog,
which confuses the state machine in common_bktr_intr.
This makes "mplayer -tv ..." work (but only with NTSC).
 1.21  22-May-2002  wiz bcmp -> memcmp.
 1.20  13-Nov-2001  lukem branches: 1.20.8;
add RCSIDs
 1.19  28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.18  18-Sep-2001  wiz Give initiali[sz]e all the "i"s it deserves.
 1.17  03-Mar-2001  mjl branches: 1.17.2; 1.17.4; 1.17.6;
Correct wrong error return in mmap fn.
 1.16  01-Mar-2001  mjl Fix typo to make this compile even w/ debug defines.
 1.15  18-Jan-2001  jdolecek constify
 1.14  30-Dec-2000  wiz Merge 2.18 to trunk.
 1.13  28-Oct-2000  wiz branches: 1.13.2;
Replace remaining vm_offset_t's in NetBSD code by vaddr_t; remove now
unnecessary casts added by thorpej in 1.11 of bktr_core.c. Strike one
from the TODO list.
 1.12  28-Oct-2000  wiz Merge 2.17 changes to trunk.
 1.11  06-Sep-2000  thorpej Cast the argument to vtophys() to vaddr_t.
 1.10  03-Sep-2000  wiz Use NetBSD's pcidevs file for vendors/cards as much as possible.
Recognize Pinnacle Studio PCTV Rave as Miro card, tested by rh@netbsd.org.
 1.9  01-Jul-2000  wiz remove unnecessary #ifdef __NetBSD__'s in #ifdef __FreeBSD__;
move one #include <vm/vm.h> into #ifndef __NetBSD__
 1.8  01-Jul-2000  wiz resolve conflicts.
 1.7  30-Jun-2000  veego Move the include of <vm/vm.h> into the ifndef __NetBSD__ part.
 1.6  26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.5  22-May-2000  wiz branches: 1.5.4;
Replaced overlooked BROOKTREE_SYSTEM_DEFAULT with BKTR_SYSTEM_DEFAULT,
as noted by Roger Hardiman.
 1.4  21-May-2000  wiz Use bktr_softc.bktr_dev.dv_xname instead of "bktr0" when printf'ing as
requested by Klaus Klein in kern/10166.
Also add device instance name to all printf's that didn't have it.
 1.3  07-May-2000  veego It is a bad idea to declare a static bootverbose variable here. Remove it.
 1.2  07-May-2000  wiz Some NetBSD specific changes; also TODO, and import script, based
on bind2netbsd by Bernd Ernesti
 1.1  07-May-2000  wiz branches: 1.1.1;
Initial revision
 1.1.1.5  12-Mar-2003  wiz Import of current state of bktr(4) in sourceforge repository.
Changes since last import:
. lots of whitespace cleanups
. typo fixes (e.g. hz, compatibilty)
. fix brightness ioctl return value
. wait for int ready using DELAY() instead of tight loop
 1.1.1.4  30-Dec-2000  wiz Import release 2.18 of the bktr driver. Changes since 2.17:
o Add new ioctls to allow userland programs fuller access to the I2C
bus, BT848_MSP_READ BT848_MSP_WRITE and BT848_MSP_RESET.
o Add tuner type 0x2a. Remove 0x2c which was incorrect.
o Christian Gusenbauer <Christian.Gusenbauer@netway.at> added support
for audio on Hauppauge cards without the audio mux. The MSP is used
for audio selection. (the 44xxx models)
 1.1.1.3  28-Oct-2000  wiz Import release 2.17 of the bktr driver.
Changes: Integration of some NetBSD changes. (FreeBSD version now is also
usable as a KLD (~= LKM).)
 1.1.1.2  01-Jul-2000  wiz Import release 2.14 of the bktr driver. Changes: mostly integration
of NetBSD changes; support for new Hauppauge tuner types.
 1.1.1.1  07-May-2000  wiz Import of (finally busspaced) bktr-driver from FreeBSD (part 1).
This version is from the location specified in the README, modified
by bktr2netbsd, to be committed later.
 1.5.4.1  03-Jul-2000  wiz Pull up revision 1.9 (requested by wiz):
Sync with release 2.14 of the bktr driver. Changes: mostly integration
of NetBSD changes; support for new Hauppauge tuner types.

Approved by thorpej.
 1.13.2.6  12-Mar-2001  bouyer Sync with HEAD.
 1.13.2.5  11-Feb-2001  bouyer Sync with HEAD.
 1.13.2.4  05-Jan-2001  bouyer Sync with HEAD
 1.13.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.13.2.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.2.1  28-Oct-2000  bouyer file bktr_core.c was added on branch thorpej_scsipi on 2000-11-20 22:35:46 +0000
 1.17.6.1  01-Oct-2001  fvdl Catch up with -current.
 1.17.4.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.4.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.8  15-Jan-2003  thorpej Sync with HEAD.
 1.17.2.7  29-Dec-2002  thorpej Sync with HEAD.
 1.17.2.6  11-Dec-2002  thorpej Sync with HEAD.
 1.17.2.5  17-Sep-2002  nathanw Catch up to -current.
 1.17.2.4  20-Jun-2002  nathanw Catch up to -current.
 1.17.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.17.2.2  08-Oct-2001  nathanw Catch up to -current.
 1.17.2.1  21-Sep-2001  nathanw Catch up to -current.
 1.20.8.2  29-Aug-2002  gehenna catch up with -current.
 1.20.8.1  30-May-2002  gehenna Catch up with -current.
 1.33.16.2  18-Nov-2006  bouyer Apply patch (requested by aymeric in ticket #1587)
fix bug introduced by missing braces around a if() block in
ticket #1511
 1.33.16.1  16-Sep-2006  ghen branches: 1.33.16.1.2;
Pull up following revision(s) (requested by bouyer in ticket #1511):
sys/dev/pci/bktr/bktr_core.c: revision 1.38
sys/dev/pci/bktr/bktr_os.c: revision 1.43
sys/dev/pci/bktr/bktr_core.h: revision 1.8
stop attaching when a bus_dma operation fails, instead of using bogus
addresses.
Remplace vtophys() with proper bus_dma(9) use.
This driver now works properly on Xen
 1.33.16.1.2.1  18-Nov-2006  bouyer Apply patch (requested by aymeric in ticket #1587)
fix bug introduced by missing braces around a if() block in
ticket #1511
 1.33.2.4  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.33.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.35.2.7  17-Mar-2008  yamt sync with head.
 1.35.2.6  21-Jan-2008  yamt sync with head
 1.35.2.5  27-Oct-2007  yamt sync with head.
 1.35.2.4  03-Sep-2007  yamt sync with head.
 1.35.2.3  26-Feb-2007  yamt sync with head.
 1.35.2.2  30-Dec-2006  yamt sync with head.
 1.35.2.1  21-Jun-2006  yamt sync with head.
 1.36.18.1  14-Sep-2006  riz Pull up following revision(s) (requested by bouyer in ticket #151):
sys/dev/pci/bktr/bktr_core.c: revision 1.38
sys/dev/pci/bktr/bktr_os.c: revision 1.43
sys/dev/pci/bktr/bktr_core.h: revision 1.8
stop attaching when a bus_dma operation fails, instead of using bogus
addresses.
Remplace vtophys() with proper bus_dma(9) use.
This driver now works properly on Xen
 1.36.8.2  14-Sep-2006  yamt sync with head.
 1.36.8.1  03-Sep-2006  yamt sync with head.
 1.36.4.1  09-Sep-2006  rpaulo sync with head
 1.38.4.2  10-Dec-2006  yamt sync with head.
 1.38.4.1  22-Oct-2006  yamt sync with head
 1.38.2.2  19-Jan-2007  ad Acquire proclist_mutex before sending signals.
 1.38.2.1  18-Nov-2006  ad Sync with head.
 1.40.4.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.40.2.1  21-Jan-2008  bouyer Pull up following revision(s) (requested by jmcneill in ticket #1046):
sys/dev/pci/bktr/bktr_reg.h: revision 1.18
sys/dev/pci/bktr/bktr_audio.c: revision 1.18
sys/dev/pci/bktr/bktr_os.c: revision 1.49
sys/dev/pci/bktr/bktr_core.c: revision 1.46
sys/dev/ic/bt8xx.h: revision 1.9
sys/dev/pci/bktr/bktr_core.h: revision 1.10
Don't assume that sizeof(long) == sizeof(int); makes bktr work on amd64.
 1.41.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.42.4.1  11-Jul-2007  mjf Sync with head.
 1.42.2.2  23-Oct-2007  ad Sync with head.
 1.42.2.1  10-Apr-2007  ad Changes to select/poll:

- Make them MP safe and decouple from the proc locks.
- selwakeup: don't call p_find, or traverse per-proc LWP lists (ouch).
- selwakeup: don't lock the sleep queue unless we need to.
 1.43.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.43.8.3  23-Mar-2008  matt sync with HEAD
 1.43.8.2  09-Jan-2008  matt sync with HEAD
 1.43.8.1  06-Nov-2007  matt sync with HEAD
 1.43.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.44.8.2  19-Jan-2008  bouyer Sync with HEAD
 1.44.8.1  08-Jan-2008  bouyer Sync with HEAD
 1.44.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.46.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.46.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.46.2.1  24-Mar-2008  keiichi sync with head.
 1.48.2.1  18-May-2008  yamt sync with head.
 1.49.16.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.49.10.1  28-Apr-2009  skrll Sync with HEAD.
 1.49.2.1  04-May-2009  yamt sync with head.
 1.50.4.1  05-Mar-2011  rmind sync with head
 1.52.12.2  25-Feb-2013  tls resync with head
 1.52.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.52.2.2  23-Jan-2013  yamt sync with head
 1.52.2.1  30-Oct-2012  yamt sync with head
 1.54.38.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.54.38.1  10-Jun-2019  christos Sync with HEAD
 1.54.36.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.56.6.1  29-Feb-2020  ad Sync with head.

RSS XML Feed