Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/vga_pci.c
RevisionDateAuthorComments
 1.59  25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.58  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.57  24-Apr-2021  thorpej branches: 1.57.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.56  17-Jun-2020  jdolecek branches: 1.56.4;
explicitly disable INTx interrupts to avoid interrupt storm triggered by
unhandled adapter interrupts

fixes PR kern/46596 by Andreas Gustafsson, fix adopted from FreeBSD
 1.55  07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.54  30-Jan-2012  drochner branches: 1.54.6; 1.54.24;
Use pci_aprint_devinfo(9) instead of pci_devinfo+aprint_{normal,naive}
where it looks straightforward, and pci_aprint_devinfo_fancy in a few
others where drivers want to supply their own device names instead
of the pcidevs generated one. More complicated cases, where names
are composed at runtime, are left alone for now. It certainly makes
sense to simplify the drivers here rather than inventing a catch-all API.
This should serve as as example for new drivers, and also ensure
consistent output in the AB_QUIET ("boot -q") case. Also, it avoids
excessive stack usage where drivers attach child devices because the
buffer for the device name is not kept on the local stack anymore.
 1.53  22-Jan-2011  cegger branches: 1.53.4; 1.53.8;
Implement new WSDISPLAYIO_GET_BUSID ioctl.
It returns the bus id and allows userland (like Xorg) to create mapping
of ttyE? and bus id. For now only PCI is implemented.

First discussed with macallan@ then public on tech-kern@ and tech-x11@
 1.52  16-Dec-2010  cegger branches: 1.52.2; 1.52.4;
ioctl: KNF switch-case, remove useless brackets
 1.51  19-Nov-2010  macallan add PCI_MAGIC_IO_RANGE so non-x86 machines can map the IO range belonging to
the console vga
thanks to nick for reminding me to commit this and for confirming that it works as intended
 1.50  09-Nov-2010  shattered PR/10000: disable fast scrolling on Cyrix GXLV (CS5530 chipset)

OK by wiz@
 1.49  24-Feb-2010  dyoung branches: 1.49.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.48  08-Jan-2010  dyoung branches: 1.48.2;
Expand PMF_FN_* macros.
 1.47  18-Aug-2009  jmcneill Adapt for NACPI -> NACPICA change.
 1.46  06-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.45  06-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.44  03-Aug-2008  joerg branches: 1.44.8;
Allow using VGA_POST without ACPI again.
 1.43  31-Jul-2008  joerg machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.
 1.42  18-May-2008  jmcneill branches: 1.42.4;
Add 'rescan' function for vga.
 1.41  05-May-2008  jmcneill branches: 1.41.2;
Change autoconf message 'direct rendering on dev unsupported' to
the more accurate 'drm at dev not configured'.
 1.40  14-Mar-2008  cube branches: 1.40.2; 1.40.4;
Split device_t and softc for all attachments of vga(4).
 1.39  29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.38  25-Dec-2007  joerg branches: 1.38.2; 1.38.6;
Add initial version of calling VGA POST from vga_resume. This is the
equivalent to "vbetool post" using x86emu in the kernel.
 1.37  09-Dec-2007  jmcneill branches: 1.37.2;
Merge jmcneill-pm branch.
 1.36  01-Dec-2007  ad branches: 1.36.2; 1.36.4;
Back out previous.
 1.35  01-Dec-2007  ad Noisy printfs.
 1.34  01-Dec-2007  jmcneill aprintify
 1.33  26-Aug-2007  martin branches: 1.33.2; 1.33.8;
Allow 64bit memory BARs if we are compiling on 64bit archs.
 1.32  20-Mar-2007  drochner branches: 1.32.4; 1.32.8;
Import DRM drivers, brought into shape by Yorick Hardy, posted to tech-x11.
Minor modifications by me:
-use an mi device major number
-(coarsly) divided into pci card specific and less specific parts, moved
the latter to dev/drm
-renamed autoconf attributes to reflect this
Todo:
-adapt all card frontends but i915 to drm include file location
-review the mtrr change
-make the change to agp_i810.c coexist with the fix for buggy VESA
BIOSes which is commented out temporarily
-RCS IDs etc style stuff
-LKM support (rescan support for vga)
-test
 1.31  04-Mar-2007  christos branches: 1.31.2; 1.31.4; 1.31.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30  16-Nov-2006  christos branches: 1.30.2; 1.30.4; 1.30.8;
__unused removal on arguments; approved by core.
 1.29  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.28  11-Dec-2005  christos branches: 1.28.20; 1.28.22;
merge ktrace-lwp.
 1.27  28-Jun-2005  thorpej branches: 1.27.2;
Use ANSI function decls and static.
 1.26  27-Feb-2005  perry nuke trailing whitespace
 1.25  11-May-2004  wiz branches: 1.25.4; 1.25.6;
Fix typo in comment; from Sergey Svishchev.
 1.24  23-Apr-2004  itojun pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region
 1.23  29-Jun-2003  fvdl branches: 1.23.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.22  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.21  26-Feb-2003  salo Regen.
 1.20  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.19  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.18  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17  08-Jul-2002  drochner there is at least one VGA chip (Silicon Motion Lynx EM+) where fast scrolling
by moving the display offset pointer doesn't work
 1.16  02-Jul-2002  drochner consider all ATI cards broken wrt font handling, as suggested by
Bang Jun-Young <junyoung@mogua.com>, but do it in way which allows
single cards to be declared O.K. in case we find one
 1.15  28-Jun-2002  drochner clean up font handling:
-treat the builtin font like any other font at runtime
-for that, copy it to malloc()'d memory during attach()
-in early console initialization, if we have to consider a broken card
(VGA_CONSOLE_ATI_BROKEN_FONTSEL), copy the builtin font to another
location in font ram; the attach() code will do the rest
put the "quirk" code into effect again
 1.14  27-Jun-2002  junyoung Whitespace KNF.
 1.13  27-Jun-2002  junyoung - Work around a hardware bug that loaded fonts don't work, which is
found on many (all?) of PCI-based ATI graphics cards. It is fully optional
and can be enabled by adding `options VGA_CONSOLE_ATI_BROKEN_FONTSEL'
to config file.
- Temporarily remove `quirk' mechanism. Similar code already exists
in pci_quirks.c.
 1.12  25-Jun-2002  drochner allow to overwrite the builtin VGA font if necessary,
make the number of available font slots variable,
set up a "quirk" mechanism to tell the generic vga code about crippled
VGA adapters which ignore the "fontsel" TS register,
initiate the quirk table with an ATI chip which happened to be on a board
I tested with.
Afaik quite a number of ATI chips suffers from the "loaded fonts don't
work" problem - these should be added.
Bad side effect of my change: The builtin font will be kicked out
always if a VGA_CONSOLE_SCREENTYPE is specified which needs a loaded
font. In early console initialization, we don't know much about the
graphics card, so we have to assume the worst (ie ATI:-).
 1.11  30-May-2002  drochner implement a check whether a BAR is present at all at a given configuration
space address and use it where the mappings of the VGA card are registered
before descenting too deep into "memory" type specific code
(pci_mem_find() gets noisy if it doesn't like the register)
 1.10  17-Mar-2002  atatat branches: 1.10.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.9  13-Dec-2001  junyoung ANSIfication & KNF fixes.
 1.8  13-Nov-2001  lukem add RCSID
 1.7  14-Sep-2001  thorpej Gather information about the mappable regions of the card at
attach time. Allow access to these regions in vga_pci_mmap().

Note: we also have to allow access to the legacy ISA "hole" in
vga_pci_mmap(), since the X server needs to be able to read
the legacy BIOS on many cards.

XXX Need to address the PCI Expansion ROM.

Based on changes from Simon Burge <simonb@wasabisystems.com>.
 1.6  14-Sep-2001  thorpej Add ioctl and mmap entry points for PCI VGA. ioctl provides
passthrough for PCI config space read/write. mmap currently
returns error (to be addressed in a future revision).
 1.5  14-Sep-2001  thorpej Allow bus front-end to provide both ioctl and mmap entry points,
and also the wsdisplay type.

Based on changes from Simon Burge <simonb@wasabisystems.com>.
 1.4  14-Aug-2000  thorpej branches: 1.4.2; 1.4.4; 1.4.6;
Just add the mmap argument to vga_common_attach(), don't bother
with vga_extended_attach().
 1.3  08-Jun-1998  thorpej branches: 1.3.14;
Nuke __BROKEN_INDIRECT_CONFIG.
 1.2  28-May-1998  drochner Put definitions and subroutines needed for all PC display adapters
(MGA/GCA and compatibles) into global headers / source files.
Let the VGA driver use them.
 1.1  22-Mar-1998  drochner PCI frontend for sys/dev/ic/vga.c
 1.3.14.1  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.4.6.1  01-Oct-2001  fvdl Catch up with -current.
 1.4.4.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.4.2.6  01-Aug-2002  nathanw Catch up to -current.
 1.4.2.5  20-Jun-2002  nathanw Catch up to -current.
 1.4.2.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.4.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.4.2.1  21-Sep-2001  nathanw Catch up to -current.
 1.10.4.2  15-Jul-2002  gehenna catch up with -current.
 1.10.4.1  20-Jun-2002  gehenna catch up with -current.
 1.23.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.23.2.2  03-Aug-2004  skrll Sync with HEAD
 1.23.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.25.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.25.4.1  29-Apr-2005  kent sync with -current
 1.27.2.6  17-Mar-2008  yamt sync with head.
 1.27.2.5  21-Jan-2008  yamt sync with head
 1.27.2.4  07-Dec-2007  yamt sync with head
 1.27.2.3  03-Sep-2007  yamt sync with head.
 1.27.2.2  30-Dec-2006  yamt sync with head.
 1.27.2.1  21-Jun-2006  yamt sync with head.
 1.28.22.2  10-Dec-2006  yamt sync with head.
 1.28.22.1  22-Oct-2006  yamt sync with head
 1.28.20.1  18-Nov-2006  ad Sync with head.
 1.30.8.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.30.4.2  24-Mar-2007  yamt sync with head.
 1.30.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.30.2.1  28-Aug-2007  liamjfoy Pull up following revision(s) (requested by martin in ticket #848):
sys/dev/pci/vga_pci.c: revision 1.33
Allow 64bit memory BARs if we are compiling on 64bit archs.
 1.31.6.1  29-Mar-2007  reinoud Pullup to -current
 1.31.4.1  11-Jul-2007  mjf Sync with head.
 1.31.2.2  09-Oct-2007  ad Sync with head.
 1.31.2.1  10-Apr-2007  ad Sync with head.
 1.32.8.6  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.32.8.5  01-Dec-2007  jmcneill Sync with HEAD.
 1.32.8.4  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.32.8.3  01-Oct-2007  joerg Extend device API by device_power_private and device_power_set_private.
The latter is a temporary mean until the pnp_register API itself is
overhault. This functions allow a generic power handler to store its
state independent of the driver.

Use this and revamp the PCI power handling. Pretty much all PCI devices
had power handlers that did the same thing, generalize this in
pci_generic_power_register/deregister and the handler. This interface
offers callbacks for the drivers to save and restore state on
transistions. After a long discussion with jmcneill@ it was considered
to be powerful enough until evidence is shown that devices can handle
D1/D2 with less code and higher speed than without the full
save/restore. The generic code is carefully written to handle device
without PCI-PM support and ensure that the correct registers are written
to when D3 loses all state.

Reimplement the generic PCI network device handling on
top of PCI generic power handling.

Introduce pci_disable_retry as used and implemented locally at least by
ath(4) and iwi(4). Use it in this drivers to restore behaviour from
before the introduction of generic PCI network handling.

Convert all PCI drivers that were using pnp_register to the new
framework. The only exception is vga(4) as it is commonly used as
console device. Add a note therein that this should be fixed later.
 1.32.8.2  03-Sep-2007  jmcneill Sync with HEAD.
 1.32.8.1  03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.32.4.1  03-Sep-2007  skrll Sync with HEAD.
 1.33.8.3  18-Feb-2008  mjf Sync with HEAD.
 1.33.8.2  27-Dec-2007  mjf Sync with HEAD.
 1.33.8.1  08-Dec-2007  mjf Sync with HEAD.
 1.33.2.2  23-Mar-2008  matt sync with HEAD
 1.33.2.1  09-Jan-2008  matt sync with HEAD
 1.36.4.1  11-Dec-2007  yamt sync with head.
 1.36.2.1  26-Dec-2007  ad Sync with head.
 1.37.2.1  02-Jan-2008  bouyer Sync with HEAD
 1.38.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.38.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.38.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.38.2.1  24-Mar-2008  keiichi sync with head.
 1.40.4.5  11-Mar-2010  yamt sync with head
 1.40.4.4  19-Aug-2009  yamt sync with head.
 1.40.4.3  16-May-2009  yamt sync with head
 1.40.4.2  04-May-2009  yamt sync with head.
 1.40.4.1  16-May-2008  yamt sync with head.
 1.40.2.2  04-Jun-2008  yamt sync with head
 1.40.2.1  18-May-2008  yamt sync with head.
 1.41.2.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.41.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.42.4.1  19-Oct-2008  haad Sync with HEAD.
 1.44.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.49.2.1  05-Mar-2011  rmind sync with head
 1.52.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.52.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.53.8.1  18-Feb-2012  mrg merge to -current.
 1.53.4.1  17-Apr-2012  yamt sync with head
 1.54.24.1  09-Jul-2016  skrll Sync with HEAD
 1.54.6.1  03-Dec-2017  jdolecek update from HEAD
 1.56.4.1  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.57.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed