diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 13 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 11 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/intel_display.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/atombios_encoders.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/evergreen.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/ni.c | 63 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/r100.c | 26 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/r300.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/r420.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon.h | 23 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_agp.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_atombios.c | 86 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_combios.c | 84 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_device.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_irq_kms.c | 26 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_kms.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_legacy_encoders.c | 8 |
17 files changed, 205 insertions, 196 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 80d977fd205..0a03cdba0bd 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.175 2014/04/01 20:16:50 kettenis Exp $ */ +/* $OpenBSD: drmP.h,v 1.176 2014/04/07 06:43:11 jsg Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -760,6 +760,13 @@ struct drm_cmdline_mode { enum drm_connector_force force; }; +struct pci_dev { + uint16_t vendor; + uint16_t device; + uint16_t subsystem_vendor; + uint16_t subsystem_device; +}; + /** * DRM device functions structure */ @@ -768,10 +775,10 @@ struct drm_device { struct drm_driver_info *driver; + struct pci_dev drm_pci; + struct pci_dev *pdev; u_int16_t pci_device; u_int16_t pci_vendor; - u_int16_t pci_subdevice; - u_int16_t pci_subvendor; pci_chipset_tag_t pc; pcitag_t *bridgetag; diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index ed8ffb0ee40..b6fa7932d1c 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.126 2014/03/25 17:44:39 mpi Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.127 2014/04/07 06:43:11 jsg Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org> * Copyright © 2008 Intel Corporation @@ -210,10 +210,11 @@ drm_attach(struct device *parent, struct device *self, void *aux) dev->irq = da->irq; dev->unique = da->busid; dev->unique_len = da->busid_len; - dev->pci_vendor = da->pci_vendor; - dev->pci_device = da->pci_device; - dev->pci_subvendor = da->pci_subvendor; - dev->pci_subdevice = da->pci_subdevice; + dev->pdev = &dev->drm_pci; + dev->pci_vendor = dev->pdev->vendor = da->pci_vendor; + dev->pci_device = dev->pdev->device = da->pci_device; + dev->pdev->subsystem_vendor = da->pci_subvendor; + dev->pdev->subsystem_device = da->pci_subdevice; dev->pc = da->pc; dev->bridgetag = da->bridgetag; diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c index bc528bd3abc..2bc4c21f86c 100644 --- a/sys/dev/pci/drm/i915/intel_display.c +++ b/sys/dev/pci/drm/i915/intel_display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_display.c,v 1.33 2014/03/30 01:03:05 jsg Exp $ */ +/* $OpenBSD: intel_display.c,v 1.34 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * @@ -9052,15 +9052,16 @@ static struct intel_quirk intel_quirks[] = { static void intel_init_quirks(struct drm_device *dev) { + struct pci_dev *d = dev->pdev; int i; for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) { struct intel_quirk *q = &intel_quirks[i]; - if (dev->pci_device == q->device && - (dev->pci_subvendor == q->subsystem_vendor || + if (d->device == q->device && + (d->subsystem_vendor == q->subsystem_vendor || q->subsystem_vendor == PCI_ANY_ID) && - (dev->pci_subdevice == q->subsystem_device || + (d->subsystem_device == q->subsystem_device || q->subsystem_device == PCI_ANY_ID)) q->hook(dev); } diff --git a/sys/dev/pci/drm/radeon/atombios_encoders.c b/sys/dev/pci/drm/radeon/atombios_encoders.c index 8012bc59e26..7cbea35ff24 100644 --- a/sys/dev/pci/drm/radeon/atombios_encoders.c +++ b/sys/dev/pci/drm/radeon/atombios_encoders.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atombios_encoders.c,v 1.5 2014/02/09 13:01:09 jsg Exp $ */ +/* $OpenBSD: atombios_encoders.c,v 1.6 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2007-11 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1949,9 +1949,9 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder, struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); /* Funky macbooks */ - if ((dev->pci_device == 0x71C5) && - (dev->pci_subvendor == 0x106b) && - (dev->pci_subdevice == 0x0080)) { + if ((dev->pdev->device == 0x71C5) && + (dev->pdev->subsystem_vendor == 0x106b) && + (dev->pdev->subsystem_device == 0x0080)) { if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) { uint32_t lvtma_bit_depth_control = RREG32(AVIVO_LVTMA_BIT_DEPTH_CONTROL); diff --git a/sys/dev/pci/drm/radeon/evergreen.c b/sys/dev/pci/drm/radeon/evergreen.c index 4142dd09342..e4dedc6bc4c 100644 --- a/sys/dev/pci/drm/radeon/evergreen.c +++ b/sys/dev/pci/drm/radeon/evergreen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evergreen.c,v 1.11 2014/02/09 12:33:44 jsg Exp $ */ +/* $OpenBSD: evergreen.c,v 1.12 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * @@ -1822,7 +1822,6 @@ static int evergreen_cp_resume(struct radeon_device *rdev) */ static void evergreen_gpu_init(struct radeon_device *rdev) { - struct drm_device *ddev = rdev->ddev; u32 gb_addr_config; u32 mc_shared_chmap, mc_arb_ramcfg; u32 sx_debug_1; @@ -1959,10 +1958,10 @@ static void evergreen_gpu_init(struct radeon_device *rdev) rdev->config.evergreen.num_ses = 1; rdev->config.evergreen.max_pipes = 4; rdev->config.evergreen.max_tile_pipes = 4; - if (ddev->pci_device == 0x9648) + if (rdev->pdev->device == 0x9648) rdev->config.evergreen.max_simds = 3; - else if ((ddev->pci_device == 0x9647) || - (ddev->pci_device == 0x964a)) + else if ((rdev->pdev->device == 0x9647) || + (rdev->pdev->device == 0x964a)) rdev->config.evergreen.max_simds = 4; else rdev->config.evergreen.max_simds = 5; diff --git a/sys/dev/pci/drm/radeon/ni.c b/sys/dev/pci/drm/radeon/ni.c index 335ccc05910..b07bd1ac8da 100644 --- a/sys/dev/pci/drm/radeon/ni.c +++ b/sys/dev/pci/drm/radeon/ni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ni.c,v 1.6 2014/02/15 14:28:13 jsg Exp $ */ +/* $OpenBSD: ni.c,v 1.7 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * @@ -417,7 +417,6 @@ out: */ static void cayman_gpu_init(struct radeon_device *rdev) { - struct drm_device *ddev = rdev->ddev; u32 gb_addr_config = 0; u32 mc_shared_chmap, mc_arb_ramcfg; u32 cgts_tcc_disable; @@ -458,48 +457,48 @@ static void cayman_gpu_init(struct radeon_device *rdev) rdev->config.cayman.max_shader_engines = 1; rdev->config.cayman.max_pipes_per_simd = 4; rdev->config.cayman.max_tile_pipes = 2; - if ((ddev->pci_device == 0x9900) || - (ddev->pci_device == 0x9901) || - (ddev->pci_device == 0x9905) || - (ddev->pci_device == 0x9906) || - (ddev->pci_device == 0x9907) || - (ddev->pci_device == 0x9908) || - (ddev->pci_device == 0x9909) || - (ddev->pci_device == 0x990B) || - (ddev->pci_device == 0x990C) || - (ddev->pci_device == 0x990F) || - (ddev->pci_device == 0x9910) || - (ddev->pci_device == 0x9917) || - (ddev->pci_device == 0x9999) || - (ddev->pci_device == 0x999C)) { + if ((rdev->pdev->device == 0x9900) || + (rdev->pdev->device == 0x9901) || + (rdev->pdev->device == 0x9905) || + (rdev->pdev->device == 0x9906) || + (rdev->pdev->device == 0x9907) || + (rdev->pdev->device == 0x9908) || + (rdev->pdev->device == 0x9909) || + (rdev->pdev->device == 0x990B) || + (rdev->pdev->device == 0x990C) || + (rdev->pdev->device == 0x990F) || + (rdev->pdev->device == 0x9910) || + (rdev->pdev->device == 0x9917) || + (rdev->pdev->device == 0x9999) || + (rdev->pdev->device == 0x999C)) { rdev->config.cayman.max_simds_per_se = 6; rdev->config.cayman.max_backends_per_se = 2; rdev->config.cayman.max_hw_contexts = 8; rdev->config.cayman.sx_max_export_size = 256; rdev->config.cayman.sx_max_export_pos_size = 64; rdev->config.cayman.sx_max_export_smx_size = 192; - } else if ((ddev->pci_device == 0x9903) || - (ddev->pci_device == 0x9904) || - (ddev->pci_device == 0x990A) || - (ddev->pci_device == 0x990D) || - (ddev->pci_device == 0x990E) || - (ddev->pci_device == 0x9913) || - (ddev->pci_device == 0x9918) || - (ddev->pci_device == 0x999D)) { + } else if ((rdev->pdev->device == 0x9903) || + (rdev->pdev->device == 0x9904) || + (rdev->pdev->device == 0x990A) || + (rdev->pdev->device == 0x990D) || + (rdev->pdev->device == 0x990E) || + (rdev->pdev->device == 0x9913) || + (rdev->pdev->device == 0x9918) || + (rdev->pdev->device == 0x999D)) { rdev->config.cayman.max_simds_per_se = 4; rdev->config.cayman.max_backends_per_se = 2; rdev->config.cayman.max_hw_contexts = 8; rdev->config.cayman.sx_max_export_size = 256; rdev->config.cayman.sx_max_export_pos_size = 64; rdev->config.cayman.sx_max_export_smx_size = 192; - } else if ((ddev->pci_device == 0x9919) || - (ddev->pci_device == 0x9990) || - (ddev->pci_device == 0x9991) || - (ddev->pci_device == 0x9994) || - (ddev->pci_device == 0x9995) || - (ddev->pci_device == 0x9996) || - (ddev->pci_device == 0x999A) || - (ddev->pci_device == 0x99A0)) { + } else if ((rdev->pdev->device == 0x9919) || + (rdev->pdev->device == 0x9990) || + (rdev->pdev->device == 0x9991) || + (rdev->pdev->device == 0x9994) || + (rdev->pdev->device == 0x9995) || + (rdev->pdev->device == 0x9996) || + (rdev->pdev->device == 0x999A) || + (rdev->pdev->device == 0x99A0)) { rdev->config.cayman.max_simds_per_se = 3; rdev->config.cayman.max_backends_per_se = 1; rdev->config.cayman.max_hw_contexts = 4; diff --git a/sys/dev/pci/drm/radeon/r100.c b/sys/dev/pci/drm/radeon/r100.c index 2ba10dcea03..f4eb52968f6 100644 --- a/sys/dev/pci/drm/radeon/r100.c +++ b/sys/dev/pci/drm/radeon/r100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r100.c,v 1.6 2014/02/10 01:01:23 jsg Exp $ */ +/* $OpenBSD: r100.c,v 1.7 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -2738,7 +2738,7 @@ void r100_set_common_regs(struct radeon_device *rdev) * don't report it in the bios connector * table. */ - switch (dev->pci_device) { + switch (dev->pdev->device) { /* RN50 */ case 0x515e: case 0x5969: @@ -2748,17 +2748,17 @@ void r100_set_common_regs(struct radeon_device *rdev) case 0x5159: case 0x515a: /* DELL triple head servers */ - if ((dev->pci_subvendor == 0x1028 /* DELL */) && - ((dev->pci_subdevice == 0x016c) || - (dev->pci_subdevice == 0x016d) || - (dev->pci_subdevice == 0x016e) || - (dev->pci_subdevice == 0x016f) || - (dev->pci_subdevice == 0x0170) || - (dev->pci_subdevice == 0x017d) || - (dev->pci_subdevice == 0x017e) || - (dev->pci_subdevice == 0x0183) || - (dev->pci_subdevice == 0x018a) || - (dev->pci_subdevice == 0x019a))) + if ((dev->pdev->subsystem_vendor == 0x1028 /* DELL */) && + ((dev->pdev->subsystem_device == 0x016c) || + (dev->pdev->subsystem_device == 0x016d) || + (dev->pdev->subsystem_device == 0x016e) || + (dev->pdev->subsystem_device == 0x016f) || + (dev->pdev->subsystem_device == 0x0170) || + (dev->pdev->subsystem_device == 0x017d) || + (dev->pdev->subsystem_device == 0x017e) || + (dev->pdev->subsystem_device == 0x0183) || + (dev->pdev->subsystem_device == 0x018a) || + (dev->pdev->subsystem_device == 0x019a))) force_dac2 = true; break; } diff --git a/sys/dev/pci/drm/radeon/r300.c b/sys/dev/pci/drm/radeon/r300.c index 2d11f48c104..2a65e95ec0c 100644 --- a/sys/dev/pci/drm/radeon/r300.c +++ b/sys/dev/pci/drm/radeon/r300.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r300.c,v 1.3 2014/02/09 12:33:44 jsg Exp $ */ +/* $OpenBSD: r300.c,v 1.4 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -324,11 +324,10 @@ int r300_mc_wait_for_idle(struct radeon_device *rdev) static void r300_gpu_init(struct radeon_device *rdev) { - struct drm_device *ddev = rdev->ddev; uint32_t gb_tile_config, tmp; - if ((rdev->family == CHIP_R300 && ddev->pci_device != 0x4144) || - (rdev->family == CHIP_R350 && ddev->pci_device != 0x4148)) { + if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) || + (rdev->family == CHIP_R350 && rdev->pdev->device != 0x4148)) { /* r300,r350 */ rdev->num_gb_pipes = 2; } else { diff --git a/sys/dev/pci/drm/radeon/r420.c b/sys/dev/pci/drm/radeon/r420.c index ddcdd9d49e3..766cc7a6b95 100644 --- a/sys/dev/pci/drm/radeon/r420.c +++ b/sys/dev/pci/drm/radeon/r420.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r420.c,v 1.3 2014/02/09 12:33:44 jsg Exp $ */ +/* $OpenBSD: r420.c,v 1.4 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -99,8 +99,8 @@ void r420_pipes_init(struct radeon_device *rdev) num_pipes = ((gb_pipe_select >> 12) & 3) + 1; /* SE chips have 1 pipe */ - if ((rdev->ddev->pci_device == 0x5e4c) || - (rdev->ddev->pci_device == 0x5e4f)) + if ((rdev->pdev->device == 0x5e4c) || + (rdev->pdev->device == 0x5e4f)) num_pipes = 1; rdev->num_gb_pipes = num_pipes; diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h index b6debf92995..34d834476d4 100644 --- a/sys/dev/pci/drm/radeon/radeon.h +++ b/sys/dev/pci/drm/radeon/radeon.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon.h,v 1.7 2014/02/10 01:59:48 jsg Exp $ */ +/* $OpenBSD: radeon.h,v 1.8 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1555,6 +1555,7 @@ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t); struct radeon_device { struct device dev; struct drm_device *ddev; + struct pci_dev *pdev; pci_chipset_tag_t pc; pcitag_t pa_tag; @@ -1764,8 +1765,8 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); /* * ASICs helpers. */ -#define ASIC_IS_RN50(rdev) ((rdev->ddev->pci_device == 0x515e) || \ - (rdev->ddev->pci_device == 0x5969)) +#define ASIC_IS_RN50(rdev) ((rdev->pdev->device == 0x515e) || \ + (rdev->pdev->device == 0x5969)) #define ASIC_IS_RV100(rdev) ((rdev->family == CHIP_RV100) || \ (rdev->family == CHIP_RV200) || \ (rdev->family == CHIP_RS100) || \ @@ -1782,14 +1783,14 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); (rdev->family == CHIP_RV410) || \ (rdev->family == CHIP_RS400) || \ (rdev->family == CHIP_RS480)) -#define ASIC_IS_X2(rdev) ((rdev->ddev->pci_device == 0x9441) || \ - (rdev->ddev->pci_device == 0x9443) || \ - (rdev->ddev->pci_device == 0x944B) || \ - (rdev->ddev->pci_device == 0x9506) || \ - (rdev->ddev->pci_device == 0x9509) || \ - (rdev->ddev->pci_device == 0x950F) || \ - (rdev->ddev->pci_device == 0x689C) || \ - (rdev->ddev->pci_device == 0x689D)) +#define ASIC_IS_X2(rdev) ((rdev->ddev->pdev->device == 0x9441) || \ + (rdev->ddev->pdev->device == 0x9443) || \ + (rdev->ddev->pdev->device == 0x944B) || \ + (rdev->ddev->pdev->device == 0x9506) || \ + (rdev->ddev->pdev->device == 0x9509) || \ + (rdev->ddev->pdev->device == 0x950F) || \ + (rdev->ddev->pdev->device == 0x689C) || \ + (rdev->ddev->pdev->device == 0x689D)) #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) #define ASIC_IS_DCE2(rdev) ((rdev->family == CHIP_RS600) || \ (rdev->family == CHIP_RS690) || \ diff --git a/sys/dev/pci/drm/radeon/radeon_agp.c b/sys/dev/pci/drm/radeon/radeon_agp.c index e554110749a..b265440b4c0 100644 --- a/sys/dev/pci/drm/radeon/radeon_agp.c +++ b/sys/dev/pci/drm/radeon/radeon_agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_agp.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */ +/* $OpenBSD: radeon_agp.c,v 1.2 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Red Hat Inc. * Copyright 2009 Jerome Glisse. @@ -186,10 +186,10 @@ int radeon_agp_init(struct radeon_device *rdev) while (p && p->chip_device != 0) { if (info.id_vendor == p->hostbridge_vendor && info.id_device == p->hostbridge_device && - ddev->pci_vendor == p->chip_vendor && - ddev->pci_device == p->chip_device && - ddev->pci_subvendor == p->subsys_vendor && - ddev->pci_subdevice == p->subsys_device) { + rdev->pdev->vendor == p->chip_vendor && + rdev->pdev->device == p->chip_device && + rdev->pdev->subsystem_vendor == p->subsys_vendor && + rdev->pdev->subsystem_device == p->subsys_device) { default_mode = p->default_mode; } ++p; diff --git a/sys/dev/pci/drm/radeon/radeon_atombios.c b/sys/dev/pci/drm/radeon/radeon_atombios.c index 98c47d3971b..613c307abbf 100644 --- a/sys/dev/pci/drm/radeon/radeon_atombios.c +++ b/sys/dev/pci/drm/radeon/radeon_atombios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_atombios.c,v 1.5 2014/02/15 15:38:46 jsg Exp $ */ +/* $OpenBSD: radeon_atombios.c,v 1.6 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -312,44 +312,44 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, { /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ - if ((dev->pci_device == 0x791e) && - (dev->pci_subvendor == 0x1043) && - (dev->pci_subdevice == 0x826d)) { + if ((dev->pdev->device == 0x791e) && + (dev->pdev->subsystem_vendor == 0x1043) && + (dev->pdev->subsystem_device == 0x826d)) { if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && (supported_device == ATOM_DEVICE_DFP3_SUPPORT)) *connector_type = DRM_MODE_CONNECTOR_DVID; } /* Asrock RS600 board lists the DVI port as HDMI */ - if ((dev->pci_device == 0x7941) && - (dev->pci_subvendor == 0x1849) && - (dev->pci_subdevice == 0x7941)) { + if ((dev->pdev->device == 0x7941) && + (dev->pdev->subsystem_vendor == 0x1849) && + (dev->pdev->subsystem_device == 0x7941)) { if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && (supported_device == ATOM_DEVICE_DFP3_SUPPORT)) *connector_type = DRM_MODE_CONNECTOR_DVID; } /* MSI K9A2GM V2/V3 board has no HDMI or DVI */ - if ((dev->pci_device == 0x796e) && - (dev->pci_subvendor == 0x1462) && - (dev->pci_subdevice == 0x7302)) { + if ((dev->pdev->device == 0x796e) && + (dev->pdev->subsystem_vendor == 0x1462) && + (dev->pdev->subsystem_device == 0x7302)) { if ((supported_device == ATOM_DEVICE_DFP2_SUPPORT) || (supported_device == ATOM_DEVICE_DFP3_SUPPORT)) return false; } /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ - if ((dev->pci_device == 0x7941) && - (dev->pci_subvendor == 0x147b) && - (dev->pci_subdevice == 0x2412)) { + if ((dev->pdev->device == 0x7941) && + (dev->pdev->subsystem_vendor == 0x147b) && + (dev->pdev->subsystem_device == 0x2412)) { if (*connector_type == DRM_MODE_CONNECTOR_DVII) return false; } /* Falcon NW laptop lists vga ddc line for LVDS */ - if ((dev->pci_device == 0x5653) && - (dev->pci_subvendor == 0x1462) && - (dev->pci_subdevice == 0x0291)) { + if ((dev->pdev->device == 0x5653) && + (dev->pdev->subsystem_vendor == 0x1462) && + (dev->pdev->subsystem_device == 0x0291)) { if (*connector_type == DRM_MODE_CONNECTOR_LVDS) { i2c_bus->valid = false; *line_mux = 53; @@ -357,26 +357,26 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, } /* HIS X1300 is DVI+VGA, not DVI+DVI */ - if ((dev->pci_device == 0x7146) && - (dev->pci_subvendor == 0x17af) && - (dev->pci_subdevice == 0x2058)) { + if ((dev->pdev->device == 0x7146) && + (dev->pdev->subsystem_vendor == 0x17af) && + (dev->pdev->subsystem_device == 0x2058)) { if (supported_device == ATOM_DEVICE_DFP1_SUPPORT) return false; } /* Gigabyte X1300 is DVI+VGA, not DVI+DVI */ - if ((dev->pci_device == 0x7142) && - (dev->pci_subvendor == 0x1458) && - (dev->pci_subdevice == 0x2134)) { + if ((dev->pdev->device == 0x7142) && + (dev->pdev->subsystem_vendor == 0x1458) && + (dev->pdev->subsystem_device == 0x2134)) { if (supported_device == ATOM_DEVICE_DFP1_SUPPORT) return false; } /* Funky macbooks */ - if ((dev->pci_device == 0x71C5) && - (dev->pci_subvendor == 0x106b) && - (dev->pci_subdevice == 0x0080)) { + if ((dev->pdev->device == 0x71C5) && + (dev->pdev->subsystem_vendor == 0x106b) && + (dev->pdev->subsystem_device == 0x0080)) { if ((supported_device == ATOM_DEVICE_CRT1_SUPPORT) || (supported_device == ATOM_DEVICE_DFP2_SUPPORT)) return false; @@ -392,27 +392,27 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, } /* ASUS HD 3600 XT board lists the DVI port as HDMI */ - if ((dev->pci_device == 0x9598) && - (dev->pci_subvendor == 0x1043) && - (dev->pci_subdevice == 0x01da)) { + if ((dev->pdev->device == 0x9598) && + (dev->pdev->subsystem_vendor == 0x1043) && + (dev->pdev->subsystem_device == 0x01da)) { if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) { *connector_type = DRM_MODE_CONNECTOR_DVII; } } /* ASUS HD 3600 board lists the DVI port as HDMI */ - if ((dev->pci_device == 0x9598) && - (dev->pci_subvendor == 0x1043) && - (dev->pci_subdevice == 0x01e4)) { + if ((dev->pdev->device == 0x9598) && + (dev->pdev->subsystem_vendor == 0x1043) && + (dev->pdev->subsystem_device == 0x01e4)) { if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) { *connector_type = DRM_MODE_CONNECTOR_DVII; } } /* ASUS HD 3450 board lists the DVI port as HDMI */ - if ((dev->pci_device == 0x95C5) && - (dev->pci_subvendor == 0x1043) && - (dev->pci_subdevice == 0x01e2)) { + if ((dev->pdev->device == 0x95C5) && + (dev->pdev->subsystem_vendor == 0x1043) && + (dev->pdev->subsystem_device == 0x01e2)) { if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) { *connector_type = DRM_MODE_CONNECTOR_DVII; } @@ -437,9 +437,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, * with different crtcs which isn't possible on the hardware * side and leaves no crtcs for LVDS or VGA. */ - if (((dev->pci_device == 0x95c4) || (dev->pci_device == 0x9591)) && - (dev->pci_subvendor == 0x1025) && - (dev->pci_subdevice == 0x013c)) { + if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) && + (dev->pdev->subsystem_vendor == 0x1025) && + (dev->pdev->subsystem_device == 0x013c)) { if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { /* actually it's a DVI-D port not DVI-I */ @@ -451,9 +451,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, /* XFX Pine Group device rv730 reports no VGA DDC lines * even though they are wired up to record 0x93 */ - if ((dev->pci_device == 0x9498) && - (dev->pci_subvendor == 0x1682) && - (dev->pci_subdevice == 0x2452) && + if ((dev->pdev->device == 0x9498) && + (dev->pdev->subsystem_vendor == 0x1682) && + (dev->pdev->subsystem_device == 0x2452) && (i2c_bus->valid == false) && !(supported_device & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))) { struct radeon_device *rdev = dev->dev_private; @@ -461,9 +461,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, } /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ - if (((dev->pci_device == 0x9802) || (dev->pci_device == 0x9806)) && - (dev->pci_subvendor == 0x1734) && - (dev->pci_subdevice == 0x11bd)) { + if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) && + (dev->pdev->subsystem_vendor == 0x1734) && + (dev->pdev->subsystem_device == 0x11bd)) { if (*connector_type == DRM_MODE_CONNECTOR_VGA) { *connector_type = DRM_MODE_CONNECTOR_DVII; *line_mux = 0x3103; diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c index ab30e0732f6..049100e24ca 100644 --- a/sys/dev/pci/drm/radeon/radeon_combios.c +++ b/sys/dev/pci/drm/radeon/radeon_combios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_combios.c,v 1.4 2014/02/10 00:17:30 jsg Exp $ */ +/* $OpenBSD: radeon_combios.c,v 1.5 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2004 ATI Technologies Inc., Markham, Ontario * Copyright 2007-8 Advanced Micro Devices, Inc. @@ -907,13 +907,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct /* quirks */ /* Radeon 7000 (RV100) */ - if (((dev->pci_device == 0x5159) && - (dev->pci_subvendor == 0x174B) && - (dev->pci_subdevice == 0x7c28)) || + if (((dev->pdev->device == 0x5159) && + (dev->pdev->subsystem_vendor == 0x174B) && + (dev->pdev->subsystem_device == 0x7c28)) || /* Radeon 9100 (R200) */ - ((dev->pci_device == 0x514D) && - (dev->pci_subvendor == 0x174B) && - (dev->pci_subdevice == 0x7149))) { + ((dev->pdev->device == 0x514D) && + (dev->pdev->subsystem_vendor == 0x174B) && + (dev->pdev->subsystem_device == 0x7149))) { /* vbios value is bad, use the default */ found = 0; } @@ -1513,21 +1513,21 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) /* PowerMac8,1 ? */ /* imac g5 isight */ rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT; - } else if ((rdev->ddev->pci_device == 0x4a48) && - (rdev->ddev->pci_subvendor == 0x1002) && - (rdev->ddev->pci_subdevice == 0x4a48)) { + } else if ((rdev->pdev->device == 0x4a48) && + (rdev->pdev->subsystem_vendor == 0x1002) && + (rdev->pdev->subsystem_device == 0x4a48)) { /* Mac X800 */ rdev->mode_info.connector_table = CT_MAC_X800; } else if ((of_machine_is_compatible("PowerMac7,2") || of_machine_is_compatible("PowerMac7,3")) && - (rdev->ddev->pci_device == 0x4150) && - (rdev->ddev->pci_subvendor == 0x1002) && - (rdev->ddev->pci_subdevice == 0x4150)) { + (rdev->pdev->device == 0x4150) && + (rdev->pdev->subsystem_vendor == 0x1002) && + (rdev->pdev->subsystem_device == 0x4150)) { /* Mac G5 tower 9600 */ rdev->mode_info.connector_table = CT_MAC_G5_9600; - } else if ((rdev->ddev->pci_device == 0x4c66) && - (rdev->ddev->pci_subvendor == 0x1002) && - (rdev->ddev->pci_subdevice == 0x4c66)) { + } else if ((rdev->pdev->device == 0x4c66) && + (rdev->pdev->subsystem_vendor == 0x1002) && + (rdev->pdev->subsystem_device == 0x4c66)) { /* SAM440ep RV250 embedded board */ rdev->mode_info.connector_table = CT_SAM440EP; } else @@ -2233,17 +2233,17 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, /* Certain IBM chipset RN50s have a BIOS reporting two VGAs, one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */ - if (dev->pci_device == 0x515e && - dev->pci_subvendor == 0x1014) { + if (dev->pdev->device == 0x515e && + dev->pdev->subsystem_vendor == 0x1014) { if (*legacy_connector == CONNECTOR_CRT_LEGACY && ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) return false; } /* X300 card with extra non-existent DVI port */ - if (dev->pci_device == 0x5B60 && - dev->pci_subvendor == 0x17af && - dev->pci_subdevice == 0x201e && bios_index == 2) { + if (dev->pdev->device == 0x5B60 && + dev->pdev->subsystem_vendor == 0x17af && + dev->pdev->subsystem_device == 0x201e && bios_index == 2) { if (*legacy_connector == CONNECTOR_DVI_I_LEGACY) return false; } @@ -2254,21 +2254,21 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, static bool radeon_apply_legacy_tv_quirks(struct drm_device *dev) { /* Acer 5102 has non-existent TV port */ - if (dev->pci_device == 0x5975 && - dev->pci_subvendor == 0x1025 && - dev->pci_subdevice == 0x009f) + if (dev->pdev->device == 0x5975 && + dev->pdev->subsystem_vendor == 0x1025 && + dev->pdev->subsystem_device == 0x009f) return false; /* HP dc5750 has non-existent TV port */ - if (dev->pci_device == 0x5974 && - dev->pci_subvendor == 0x103c && - dev->pci_subdevice == 0x280a) + if (dev->pdev->device == 0x5974 && + dev->pdev->subsystem_vendor == 0x103c && + dev->pdev->subsystem_device == 0x280a) return false; /* MSI S270 has non-existent TV port */ - if (dev->pci_device == 0x5955 && - dev->pci_subvendor == 0x1462 && - dev->pci_subdevice == 0x0131) + if (dev->pdev->device == 0x5955 && + dev->pdev->subsystem_vendor == 0x1462 && + dev->pdev->subsystem_device == 0x0131) return false; return true; @@ -2422,9 +2422,9 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) /* RV100 board with external TDMS bit mis-set. * Actually uses internal TMDS, clear the bit. */ - if (dev->pci_device == 0x5159 && - dev->pci_subvendor == 0x1014 && - dev->pci_subdevice == 0x029A) { + if (dev->pdev->device == 0x5159 && + dev->pdev->subsystem_vendor == 0x1014 && + dev->pdev->subsystem_device == 0x029A) { tmp &= ~(1 << 4); } if ((tmp >> 4) & 0x1) { @@ -2715,9 +2715,9 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) /* boards with a thermal chip, but no overdrive table */ /* Asus 9600xt has an f75375 on the monid bus */ - if ((dev->pci_device == 0x4152) && - (dev->pci_subvendor == 0x1043) && - (dev->pci_subdevice == 0xc002)) { + if ((dev->pdev->device == 0x4152) && + (dev->pdev->subsystem_vendor == 0x1043) && + (dev->pdev->subsystem_device == 0xc002)) { i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); #ifdef notyet @@ -3379,24 +3379,24 @@ void radeon_combios_asic_init(struct drm_device *dev) * - it hangs on resume inside the dynclk 1 table. */ if (rdev->family == CHIP_RS480 && - dev->pci_subvendor == 0x103c && - dev->pci_subdevice == 0x308b) + rdev->pdev->subsystem_vendor == 0x103c && + rdev->pdev->subsystem_device == 0x308b) return; /* quirk for rs4xx HP dv5000 laptop to make it resume * - it hangs on resume inside the dynclk 1 table. */ if (rdev->family == CHIP_RS480 && - dev->pci_subvendor == 0x103c && - dev->pci_subdevice == 0x30a4) + rdev->pdev->subsystem_vendor == 0x103c && + rdev->pdev->subsystem_device == 0x30a4) return; /* quirk for rs4xx Compaq Presario V5245EU laptop to make it resume * - it hangs on resume inside the dynclk 1 table. */ if (rdev->family == CHIP_RS480 && - dev->pci_subvendor == 0x103c && - dev->pci_subdevice == 0x30ae) + rdev->pdev->subsystem_vendor == 0x103c && + rdev->pdev->subsystem_device == 0x30ae) return; /* DYN CLK 1 */ diff --git a/sys/dev/pci/drm/radeon/radeon_device.c b/sys/dev/pci/drm/radeon/radeon_device.c index c2bc3c2f5c8..31bdc158821 100644 --- a/sys/dev/pci/drm/radeon/radeon_device.c +++ b/sys/dev/pci/drm/radeon/radeon_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_device.c,v 1.5 2014/02/09 12:50:09 jsg Exp $ */ +/* $OpenBSD: radeon_device.c,v 1.6 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -441,7 +441,7 @@ bool radeon_card_posted(struct radeon_device *rdev) #ifdef notyet if (efi_enabled(EFI_BOOT) && - ddev->pci_subvendor == PCI_VENDOR_ID_APPLE) + rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) return false; #endif @@ -1014,6 +1014,7 @@ static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = { int radeon_device_init(struct radeon_device *rdev, struct drm_device *ddev) { + struct pci_dev *pdev = ddev->pdev; int r, i; int dma_bits; @@ -1029,8 +1030,8 @@ int radeon_device_init(struct radeon_device *rdev, } DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X).\n", - radeon_family_name[rdev->family], ddev->pci_vendor, ddev->pci_device, - ddev->pci_subvendor, ddev->pci_subdevice); + radeon_family_name[rdev->family], pdev->vendor, pdev->device, + pdev->subsystem_vendor, pdev->subsystem_device); /* rwlock initialization are all done here so we * can recall function without having locking issues */ diff --git a/sys/dev/pci/drm/radeon/radeon_irq_kms.c b/sys/dev/pci/drm/radeon/radeon_irq_kms.c index ddb01be33a5..6f805e10ece 100644 --- a/sys/dev/pci/drm/radeon/radeon_irq_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_irq_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_irq_kms.c,v 1.3 2014/01/23 03:15:09 kettenis Exp $ */ +/* $OpenBSD: radeon_irq_kms.c,v 1.4 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -194,27 +194,27 @@ radeon_msi_ok(struct radeon_device *rdev) /* Quirks */ /* HP RS690 only seems to work with MSIs. */ - if ((rdev->ddev->pci_device == 0x791f) && - (rdev->ddev->pci_subvendor == 0x103c) && - (rdev->ddev->pci_subdevice == 0x30c2)) + if ((rdev->pdev->device == 0x791f) && + (rdev->pdev->subsystem_vendor == 0x103c) && + (rdev->pdev->subsystem_device == 0x30c2)) return true; /* Dell RS690 only seems to work with MSIs. */ - if ((rdev->ddev->pci_device == 0x791f) && - (rdev->ddev->pci_subvendor == 0x1028) && - (rdev->ddev->pci_subdevice == 0x01fc)) + if ((rdev->pdev->device == 0x791f) && + (rdev->pdev->subsystem_vendor == 0x1028) && + (rdev->pdev->subsystem_device == 0x01fc)) return true; /* Dell RS690 only seems to work with MSIs. */ - if ((rdev->ddev->pci_device == 0x791f) && - (rdev->ddev->pci_subvendor == 0x1028) && - (rdev->ddev->pci_subdevice == 0x01fd)) + if ((rdev->pdev->device == 0x791f) && + (rdev->pdev->subsystem_vendor == 0x1028) && + (rdev->pdev->subsystem_device == 0x01fd)) return true; /* Gateway RS690 only seems to work with MSIs. */ - if ((rdev->ddev->pci_device == 0x791f) && - (rdev->ddev->pci_subvendor == 0x107b) && - (rdev->ddev->pci_subdevice == 0x0185)) + if ((rdev->pdev->device == 0x791f) && + (rdev->pdev->subsystem_vendor == 0x107b) && + (rdev->pdev->subsystem_device == 0x0185)) return true; /* try and enable MSIs by default on all RS690s */ diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index b9dd7855b0c..d3ef5880775 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_kms.c,v 1.26 2014/03/30 02:12:23 jsg Exp $ */ +/* $OpenBSD: radeon_kms.c,v 1.27 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -578,6 +578,7 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux) dev = (struct drm_device *)drm_attach_pci(&kms_driver, pa, is_agp, rdev->console, self); rdev->ddev = dev; + rdev->pdev = dev->pdev; rdev->family = rdev->flags & RADEON_FAMILY_MASK; if (!radeon_msi_ok(rdev)) diff --git a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c index 5f2b694f673..b677e53f041 100644 --- a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c +++ b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_legacy_encoders.c,v 1.2 2014/02/09 11:03:31 jsg Exp $ */ +/* $OpenBSD: radeon_legacy_encoders.c,v 1.3 2014/04/07 06:43:11 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -967,9 +967,9 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, /* XXX: these are oem specific */ if (ASIC_IS_R300(rdev)) { - if ((dev->pci_device == 0x4850) && - (dev->pci_subvendor == 0x1028) && - (dev->pci_subdevice == 0x2001)) /* Dell Inspiron 8600 */ + if ((dev->pdev->device == 0x4850) && + (dev->pdev->subsystem_vendor == 0x1028) && + (dev->pdev->subsystem_device == 0x2001)) /* Dell Inspiron 8600 */ fp2_gen_cntl |= R300_FP2_DVO_CLOCK_MODE_SINGLE; else fp2_gen_cntl |= RADEON_FP2_PAD_FLOP_EN | R300_FP2_DVO_CLOCK_MODE_SINGLE; |