Commit Graph

122 Commits

Author SHA1 Message Date
nonaka
14e727d75d kern/50453: Separate Pineview chipset from i915-family chipset support.
Should use AGP_I965_IFPADDR instead AGP_I915_IFPADDR in Pineview, becuase
AGP_I915_IFPADDR is used as PCIEXBAR.
2016-05-01 04:22:50 +00:00
christos
9c2534e992 Fix typo 2015-10-21 15:37:35 +00:00
christos
f3d98d7df9 CID 1328433: Anding with 0 and comparing != 0 will not work very will. 2015-10-21 14:11:07 +00:00
riastradh
8ea291252e Fix mapping Intel graphics device registers.
- Accept either 32-bit or 64-bit mappings for all devices.
- Let the device always dictate size of the mapping.
- Explain why we don't have a statically fixed mapping size.

Fixes the main part of PR kern/50060.  Still a display mode issue
from one submitter, but it is almost certainly an unrelated issue.
2015-10-13 12:17:04 +00:00
riastradh
244fab16c6 Don't use the video BIOS memory as an i915 flush page! 2015-04-05 12:55:20 +00:00
riastradh
1a0c0250a7 Pass cache-related flags through to the GTT on pre-SNB devices.
I had assumed for ages this would increase the amount of caching and
thereby increase the chance of stale caches leading to rendering
glitches.  But apparently I was wrong, and failing to pass these
through was causing all sorts of problems!
2015-03-06 22:03:06 +00:00
riastradh
01ea4fedd8 Include <sys/atomic.h> for membar_producer.
(Why didn't this fail in my build?)
2015-02-26 00:58:17 +00:00
riastradh
086551a26b Issue a write barrier after updating the GTT.
Linux never used to do this...until a month:

https://bugs.freedesktop.org/show_bug.cgi?id=88191

   commit 983d308cb8f602d1920a8c40196eb2ab6cc07bd2
   Author: Chris Wilson <chris@chris-wilson.co.uk>
   Date:   Mon Jan 26 10:47:10 2015 +0000

       agp/intel: Serialise after GTT updates
2015-02-26 00:42:10 +00:00
riastradh
39705e3af5 Use the right BAR for MMIO register sizing on i810. 2014-08-24 22:56:18 +00:00
riastradh
46b6cca670 Revert to mapping the whole GTTMMADR region all at once for now.
This was split up so we could map the GTT prefetchable without
interfering with the MMIO registers, but it interferes with old drm
which tries to map the whole region and which is still hooked up for
the moment.

Once we unhook old drm for good we can put this back.
2014-08-22 15:26:28 +00:00
riastradh
2f2d56347b Mark isc __diagused in agp_i810_unbind_memory. 2014-07-25 23:05:54 +00:00
riastradh
f37f6781cc Tweak style, make it compile...oops. 2014-07-23 14:50:23 +00:00
riastradh
e02e972eca For the unbind code to work the bind code must set the offset. 2014-07-23 14:48:06 +00:00
riastradh
476debb2a9 Also unbind the right offset. 2014-07-23 14:38:08 +00:00
riastradh
01ff6234c3 Bind i810 dcache pages at the requested offset, not at VA start.
From John D Baker in PR xsrc/48344.

XXX pullup to 6 (by patch)
2014-07-23 14:23:09 +00:00
riastradh
1f41368568 Tweak debug printf directives. 2014-07-01 16:27:25 +00:00
riastradh
eb10c7f5cb Collect `#ifdef AGP_DEBUG printf(...)' into local DPRINTF macro. 2014-06-27 22:27:16 +00:00
riastradh
ba2bea2344 No, that should be unsigned. 2014-06-25 15:04:53 +00:00
riastradh
3b3e9badb3 Fix integer type mismatch in debug printf. 2014-06-25 13:10:27 +00:00
riastradh
c6caa5cec4 Get GTT size from PGTBL_CTL on G4X chipsets. 2014-06-12 18:46:32 +00:00
riastradh
4a00503bb8 Fix MMIO registers sizes for pre-Ironlake chipsets. 2014-06-12 18:41:46 +00:00
riastradh
7607f34b0c Extend agp_generic_bind_memory with bounds to check.
New routine agp_generic_bind_memory_bounded.

Use it in agp_i810 to replace the pile of code I wrote as a
replacement which is apparently broken.
2014-06-12 18:33:42 +00:00
riastradh
86971187ea Fix type in cast too, after changing type of gtt_off. 2014-06-12 17:04:58 +00:00
riastradh
7df9e83c86 Check bounds in agp_i810_borrow.
Out of paranoia, do a bus_space_subregion in case the old drm code
tries sizes that the agp_i810 code doesn't agree with.
2014-06-12 15:05:29 +00:00
riastradh
aa774f923d Use correct type for gtt_off, an offset relative to a bus address. 2014-06-12 14:49:02 +00:00
riastradh
83838c6f3a Ensure we map all the MMIO registers.
For i8xx chipsets, the GTT is in the middle of the MMIO space, so we
can't map it separately.  Use a subregion instead.
2014-06-12 14:48:17 +00:00
christos
5ebbe378a4 Giving a 0 gtt_size for G4X causes a panic when you try to bus map 0 size.
Give it 256, like the default aperture size for it. Now it works again.
2014-06-12 03:23:58 +00:00
riastradh
6d57a82821 Fix fencepost. 2014-06-11 19:35:46 +00:00
riastradh
f4b89c3d32 Fix various mistakes in yesterday's commit.
- Set mem->am_nseg, particularly before trying to use it.
- Avoid error-prone local copies in agp_i810_bind_memory_main.
- Omit missing DMA unload/free in agp_i810_unbind_memory.
2014-06-11 17:15:18 +00:00
riastradh
dc8077bc78 Ignore result of agp_i810_unbind_page in agp_i810_unbind_memory. 2014-06-11 17:02:09 +00:00
riastradh
a7475de57c Back out previous mistake.
If you mixed `cvs diff' and `cvs commit' in your shell history,
remember to hit C-p the right number of times before RET.  Oops.
2014-06-11 17:01:31 +00:00
riastradh
4dc18807c4 Add missing bus_dmamap_destroy. 2014-06-11 16:58:29 +00:00
riastradh
95aecd5c8b Add missing bus_dmamap_destroy. 2014-06-11 16:48:15 +00:00
riastradh
aa4d50801e Check bounds more carefully to avoid integer overflow. 2014-06-11 16:45:06 +00:00
riastradh
0141ebf2d3 Don't trust the MSAC register after all; use the GMADR BAR size.
Previously this read the MSAC register from the wrong PCI device.
Experiments reveal that even on the right PCI device, per the
datasheet, the GMADR BAR size is correct.

Not clear that the driver has any business reading any of these GMCH
registers to discern the aperture size -- seems to me they are meant
to be written by the BIOS to determine the GMADR BAR size.  Lacking a
variety of hardware to test, though, I'll leave this as is for now...
2014-06-11 14:04:48 +00:00
riastradh
f394f86ba3 Fix sense of conditional for GTTMMADR size. 2014-06-11 13:15:44 +00:00
riastradh
0b80476a5b Rework agp_i810 memory binding.
Principal reason is that the GTT size is not necessarily the same as
the aperture size: the GPU may have a bigger virtual address space
than the CPU can see through the aperture.

While here, factor the code a little more legibly and name some magic
constants.
2014-06-10 22:02:58 +00:00
riastradh
daa87cdc9f Another round of weed-whacking for agp_i810.
- Make struct agp_i810_softc::gatt specific to i810 chipsets; use other
members of struct agp_i810_softc for non-i810 chipsets.

- agp_i810_init detects and sets isc->gtt_size.

- Map GTT based on the GTT size detected by agp_i810_init.

- Sprinkle some comments particularly about questionable calculations.
2014-06-10 14:00:56 +00:00
riastradh
ce73ba5c6f Cosmetic changes require testing too...oops. 2014-05-28 16:07:58 +00:00
riastradh
863cbb4650 Cosmetics: long lines, needless variables, PCI parameter verbiage. 2014-05-28 15:34:32 +00:00
riastradh
e8d144dc21 Rationalize agp_i810 aprint output. Fix agp_i810_init error branches. 2014-05-28 03:17:42 +00:00
riastradh
971e4caa35 Oops -- gtt_off is relative to mmadr, not absolute. 2014-05-28 02:08:52 +00:00
riastradh
a09bccc2cc Suppress uninitialized variable warnings in older and dumber GCC. 2014-05-27 12:51:04 +00:00
riastradh
7d41993c06 Rework agp_i810 attachment code a little.
- Fix up error branches in agp_i810_attach.

- Use a separate bus space handle for the GTT, whether it is in a
separate BAR or a subregion of the MMIO device registers, so that

(a) agp_i810_write_gtt_entry and agp_i810_post_gtt_entry are easier to
follow, and

(b) we can map the GTT prefetchable eventually.
2014-05-27 03:17:33 +00:00
riastradh
8a9811c58d Use correct address for 64-bit flush page config register. 2014-05-26 19:15:39 +00:00
riastradh
3f262dd548 Avoid xcall(9) while cold. 2014-05-26 19:13:20 +00:00
riastradh
ca2a6957fa Handle 64-bit paddr registers delicately for non-PAE i386. 2014-05-24 14:17:29 +00:00
riastradh
824cf4b929 Implement Intel AGP chipset flush.
While here, fix the use of the I915 PCI MSAC register: it lies on the
bridge device (bus 0 dev 0 func 0), not the graphics device (bus 0
dev 2 func 0).  I'm not sure we ever need to consult this register,
really -- the PCI BARs should be sized.  But I'll leave a rototill of
this mess for another day.
2014-05-23 22:58:56 +00:00
riastradh
6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
dyoung
d3e53912d2 Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args.  Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
    pci_intr_map() was a leftover from Xen 2.  Probably a bug.  I
    stopped writing it.  I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
    Probably a bug.  I use a temporary variable.  I have not tested this
    change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
    Probably a bug.  Use a local pci_attach_args.  I have not tested
    this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
    caller's pci_attach_args.  Probably a bug.  Make a local copy of the
    caller's pci_attach_args and modify the copy.  I have not tested
    this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
	HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
	KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
	TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
	OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
2011-04-04 20:37:49 +00:00