sync with OpenBSD -current
This commit is contained in:
parent
8801582927
commit
30cf31d90d
55 changed files with 633 additions and 516 deletions
|
@ -201,7 +201,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
|
|||
}
|
||||
|
||||
for (i = 0; i < p->nchunks; i++) {
|
||||
struct drm_amdgpu_cs_chunk __user **chunk_ptr = NULL;
|
||||
struct drm_amdgpu_cs_chunk __user *chunk_ptr = NULL;
|
||||
struct drm_amdgpu_cs_chunk user_chunk;
|
||||
uint32_t __user *cdata;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work)
|
|||
|
||||
struct drm_crtc *crtc = &amdgpu_crtc->base;
|
||||
unsigned long flags;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int vpos, hpos;
|
||||
|
||||
for (i = 0; i < work->shared_count; ++i)
|
||||
|
@ -167,7 +167,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
|
|||
u64 tiling_flags;
|
||||
int i, r;
|
||||
|
||||
work = kzalloc(sizeof *work, GFP_KERNEL);
|
||||
work = kzalloc(sizeof(*work), GFP_KERNEL);
|
||||
if (work == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -298,18 +298,17 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
|
|||
|
||||
adev = drm_to_adev(dev);
|
||||
/* if we have active crtcs and we don't have a power ref,
|
||||
take the current one */
|
||||
* take the current one
|
||||
*/
|
||||
if (active && !adev->have_disp_power_ref) {
|
||||
adev->have_disp_power_ref = true;
|
||||
return ret;
|
||||
}
|
||||
/* if we have no active crtcs, then drop the power ref
|
||||
we got before */
|
||||
if (!active && adev->have_disp_power_ref) {
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
/* if we have no active crtcs, then go to
|
||||
* drop the power ref we got before
|
||||
*/
|
||||
if (!active && adev->have_disp_power_ref)
|
||||
adev->have_disp_power_ref = false;
|
||||
}
|
||||
|
||||
out:
|
||||
/* drop the power reference we got coming in here */
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
@ -473,11 +472,10 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
|
|||
if (amdgpu_connector->router.ddc_valid)
|
||||
amdgpu_i2c_router_select_ddc_port(amdgpu_connector);
|
||||
|
||||
if (use_aux) {
|
||||
if (use_aux)
|
||||
ret = i2c_transfer(&amdgpu_connector->ddc_bus->aux.ddc, msgs, 2);
|
||||
} else {
|
||||
else
|
||||
ret = i2c_transfer(&amdgpu_connector->ddc_bus->adapter, msgs, 2);
|
||||
}
|
||||
|
||||
if (ret != 2)
|
||||
/* Couldn't find an accessible DDC on this connector */
|
||||
|
@ -486,10 +484,12 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
|
|||
* EDID header starts with:
|
||||
* 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00.
|
||||
* Only the first 6 bytes must be valid as
|
||||
* drm_edid_block_valid() can fix the last 2 bytes */
|
||||
* drm_edid_block_valid() can fix the last 2 bytes
|
||||
*/
|
||||
if (drm_edid_header_is_valid(buf) < 6) {
|
||||
/* Couldn't find an accessible EDID on this
|
||||
* connector */
|
||||
* connector
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1204,8 +1204,10 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
|
|||
|
||||
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
|
||||
if (obj == NULL) {
|
||||
drm_dbg_kms(dev, "No GEM object associated to handle 0x%08X, "
|
||||
"can't create framebuffer\n", mode_cmd->handles[0]);
|
||||
drm_dbg_kms(dev,
|
||||
"No GEM object associated to handle 0x%08X, can't create framebuffer\n",
|
||||
mode_cmd->handles[0]);
|
||||
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
|
||||
|
@ -1398,6 +1400,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
|||
}
|
||||
if (amdgpu_crtc->rmx_type != RMX_OFF) {
|
||||
fixed20_12 a, b;
|
||||
|
||||
a.full = dfixed_const(src_v);
|
||||
b.full = dfixed_const(dst_v);
|
||||
amdgpu_crtc->vsc.full = dfixed_div(a, b);
|
||||
|
@ -1417,7 +1420,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
|||
*
|
||||
* \param dev Device to query.
|
||||
* \param pipe Crtc to query.
|
||||
* \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* \param flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* For driver internal use only also supports these flags:
|
||||
*
|
||||
* USE_REAL_VBLANKSTART to use the real start of vblank instead
|
||||
|
@ -1493,8 +1496,8 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
|
|||
|
||||
/* Called from driver internal vblank counter query code? */
|
||||
if (flags & GET_DISTANCE_TO_VBLANKSTART) {
|
||||
/* Caller wants distance from real vbl_start in *hpos */
|
||||
*hpos = *vpos - vbl_start;
|
||||
/* Caller wants distance from real vbl_start in *hpos */
|
||||
*hpos = *vpos - vbl_start;
|
||||
}
|
||||
|
||||
/* Fudge vblank to start a few scanlines earlier to handle the
|
||||
|
@ -1516,7 +1519,7 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
|
|||
|
||||
/* In vblank? */
|
||||
if (in_vbl)
|
||||
ret |= DRM_SCANOUTPOS_IN_VBLANK;
|
||||
ret |= DRM_SCANOUTPOS_IN_VBLANK;
|
||||
|
||||
/* Called from driver internal vblank counter query code? */
|
||||
if (flags & GET_DISTANCE_TO_VBLANKSTART) {
|
||||
|
@ -1622,6 +1625,7 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
|
|||
|
||||
if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) {
|
||||
struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
|
||||
|
||||
r = amdgpu_bo_reserve(aobj, true);
|
||||
if (r == 0) {
|
||||
amdgpu_bo_unpin(aobj);
|
||||
|
@ -1629,9 +1633,9 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
|
|||
}
|
||||
}
|
||||
|
||||
if (fb == NULL || fb->obj[0] == NULL) {
|
||||
if (!fb || !fb->obj[0])
|
||||
continue;
|
||||
}
|
||||
|
||||
robj = gem_to_amdgpu_bo(fb->obj[0]);
|
||||
if (!amdgpu_display_robj_is_fb(adev, robj)) {
|
||||
r = amdgpu_bo_reserve(robj, true);
|
||||
|
@ -1658,6 +1662,7 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev)
|
|||
|
||||
if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) {
|
||||
struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
|
||||
|
||||
r = amdgpu_bo_reserve(aobj, true);
|
||||
if (r == 0) {
|
||||
r = amdgpu_bo_pin(aobj, AMDGPU_GEM_DOMAIN_VRAM);
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
* That is, for an I2C EEPROM driver everything is controlled by
|
||||
* the "eeprom_addr".
|
||||
*
|
||||
* See also top of amdgpu_ras_eeprom.c.
|
||||
*
|
||||
* P.S. If you need to write, lock and read the Identification Page,
|
||||
* (M24M02-DR device only, which we do not use), change the "7" to
|
||||
* "0xF" in the macro below, and let the client set bit 20 to 1 in
|
||||
|
|
|
@ -33,12 +33,29 @@
|
|||
|
||||
#include "amdgpu_reset.h"
|
||||
|
||||
#define EEPROM_I2C_MADDR_VEGA20 0x0
|
||||
#define EEPROM_I2C_MADDR_ARCTURUS 0x40000
|
||||
#define EEPROM_I2C_MADDR_ARCTURUS_D342 0x0
|
||||
#define EEPROM_I2C_MADDR_SIENNA_CICHLID 0x0
|
||||
#define EEPROM_I2C_MADDR_ALDEBARAN 0x0
|
||||
#define EEPROM_I2C_MADDR_SMU_13_0_0 (0x54UL << 16)
|
||||
/* These are memory addresses as would be seen by one or more EEPROM
|
||||
* chips strung on the I2C bus, usually by manipulating pins 1-3 of a
|
||||
* set of EEPROM devices. They form a continuous memory space.
|
||||
*
|
||||
* The I2C device address includes the device type identifier, 1010b,
|
||||
* which is a reserved value and indicates that this is an I2C EEPROM
|
||||
* device. It also includes the top 3 bits of the 19 bit EEPROM memory
|
||||
* address, namely bits 18, 17, and 16. This makes up the 7 bit
|
||||
* address sent on the I2C bus with bit 0 being the direction bit,
|
||||
* which is not represented here, and sent by the hardware directly.
|
||||
*
|
||||
* For instance,
|
||||
* 50h = 1010000b => device type identifier 1010b, bits 18:16 = 000b, address 0.
|
||||
* 54h = 1010100b => --"--, bits 18:16 = 100b, address 40000h.
|
||||
* 56h = 1010110b => --"--, bits 18:16 = 110b, address 60000h.
|
||||
* Depending on the size of the I2C EEPROM device(s), bits 18:16 may
|
||||
* address memory in a device or a device on the I2C bus, depending on
|
||||
* the status of pins 1-3. See top of amdgpu_eeprom.c.
|
||||
*
|
||||
* The RAS table lives either at address 0 or address 40000h of EEPROM.
|
||||
*/
|
||||
#define EEPROM_I2C_MADDR_0 0x0
|
||||
#define EEPROM_I2C_MADDR_4 0x40000
|
||||
|
||||
/*
|
||||
* The 2 macros bellow represent the actual size in bytes that
|
||||
|
@ -90,37 +107,23 @@
|
|||
|
||||
static bool __is_ras_eeprom_supported(struct amdgpu_device *adev)
|
||||
{
|
||||
return adev->asic_type == CHIP_VEGA20 ||
|
||||
adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_SIENNA_CICHLID ||
|
||||
adev->asic_type == CHIP_ALDEBARAN;
|
||||
}
|
||||
|
||||
static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
|
||||
struct amdgpu_ras_eeprom_control *control)
|
||||
{
|
||||
STUB();
|
||||
return false;
|
||||
#ifdef notyet
|
||||
struct atom_context *atom_ctx = adev->mode_info.atom_context;
|
||||
|
||||
if (!control || !atom_ctx)
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 2): /* VEGA20 and ARCTURUS */
|
||||
case IP_VERSION(11, 0, 7): /* Sienna cichlid */
|
||||
case IP_VERSION(13, 0, 0):
|
||||
case IP_VERSION(13, 0, 2): /* Aldebaran */
|
||||
case IP_VERSION(13, 0, 6):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
if (strnstr(atom_ctx->vbios_version,
|
||||
"D342",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS_D342;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_ARCTURUS;
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
||||
struct amdgpu_ras_eeprom_control *control)
|
||||
{
|
||||
struct atom_context *atom_ctx = adev->mode_info.atom_context;
|
||||
u8 i2c_addr;
|
||||
|
||||
if (!control)
|
||||
|
@ -141,36 +144,57 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
|||
return true;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
control->i2c_address = EEPROM_I2C_MADDR_VEGA20;
|
||||
break;
|
||||
|
||||
case CHIP_ARCTURUS:
|
||||
return __get_eeprom_i2c_addr_arct(adev, control);
|
||||
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
control->i2c_address = EEPROM_I2C_MADDR_SIENNA_CICHLID;
|
||||
break;
|
||||
|
||||
case CHIP_ALDEBARAN:
|
||||
control->i2c_address = EEPROM_I2C_MADDR_ALDEBARAN;
|
||||
break;
|
||||
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 2):
|
||||
/* VEGA20 and ARCTURUS */
|
||||
if (adev->asic_type == CHIP_VEGA20)
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
#ifdef notyet
|
||||
else if (strnstr(atom_ctx->vbios_version,
|
||||
"D342",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
#else
|
||||
STUB();
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
#endif
|
||||
return true;
|
||||
case IP_VERSION(11, 0, 7):
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
return true;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
#ifdef notyet
|
||||
if (strnstr(atom_ctx->vbios_version, "D673",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
#else
|
||||
STUB();
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
#endif
|
||||
return true;
|
||||
case IP_VERSION(13, 0, 0):
|
||||
#ifdef notyet
|
||||
if (strnstr(atom_ctx->vbios_pn, "D707",
|
||||
sizeof(atom_ctx->vbios_pn)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
#else
|
||||
STUB();
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
#endif
|
||||
return true;
|
||||
case IP_VERSION(13, 0, 6):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 0):
|
||||
control->i2c_address = EEPROM_I2C_MADDR_SMU_13_0_0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -397,7 +397,7 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
|||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||
cpu_ptr = &adev->wb.wb[index];
|
||||
|
||||
r = amdgpu_ib_get(adev, NULL, 16, AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
if (r) {
|
||||
DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
|
||||
goto err1;
|
||||
|
|
|
@ -883,8 +883,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
|||
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||
memset(&ib, 0, sizeof(ib));
|
||||
r = amdgpu_ib_get(adev, NULL, 16,
|
||||
AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
|
||||
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
if (r)
|
||||
goto err1;
|
||||
|
||||
|
|
|
@ -1034,8 +1034,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
|||
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||
memset(&ib, 0, sizeof(ib));
|
||||
r = amdgpu_ib_get(adev, NULL, 16,
|
||||
AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
|
||||
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
|
||||
if (r)
|
||||
goto err1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue