Skip to contentSkip to conversation

drm/amdgpu: Remove checking for atombios

PATCH Applied Nils Wallménius 3 participants 3 messages Dec 14, 2016 – Dec 15, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Remove checking for atombios

This is a left over from radeon, amdgpu doesn't support any non-atombios parts and amdgpu_device_init would bail if the check for atombios failed anyway.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c       | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c       | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  8 +-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c    | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c        |  3 +--
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |  6 ------
 7 files changed, 16 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 29d3a91..11de710 100644
@@ -1330,7 +1330,6 @@ struct amdgpu_device {
 
 	/* BIOS */
 	uint8_t				*bios;
-	bool				is_atom_bios;
 	struct amdgpu_bo		*stollen_vga_memory;
 	uint32_t			bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
 
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -6
index 5796539..ef79551 100644
@@ -672,12 +672,10 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 
 			if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
 			    enc->enc_priv) {
-				if (adev->is_atom_bios) {
-					struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
-					if (dig->bl_dev) {
-						atif->encoder_for_bl = enc;
-						break;
-					}
+				struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
+				if (dig->bl_dev) {
+					atif->encoder_for_bl = enc;
+					break;
 				}
 			}
 		}
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +6 -6
index b7e2762..1103259 100644
@@ -387,15 +387,15 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 	if (!bios_header_start) {
 		goto free_bios;
 	}
+
+	/* Must be an ATOMBIOS */
 	tmp = bios_header_start + 4;
-	if (!memcmp(adev->bios + tmp, "ATOM", 4) ||
-	    !memcmp(adev->bios + tmp, "MOTA", 4)) {
-		adev->is_atom_bios = true;
-	} else {
-		adev->is_atom_bios = false;
+	if (memcmp(adev->bios + tmp, "ATOM", 4) &&
+	    memcmp(adev->bios + tmp, "MOTA", 4)) {
+		goto free_bios;
 	}
 
-	DRM_DEBUG("%sBIOS detected\n", adev->is_atom_bios ? "ATOM" : "COM");
+	DRM_DEBUG("ATOMBIOS detected\n");
 	return true;
 free_bios:
 	kfree(adev->bios);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -7
index d907411..dc017d1 100644
@@ -1603,7 +1603,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	adev->pdev = pdev;
 	adev->flags = flags;
 	adev->asic_type = flags & AMD_ASIC_MASK;
-	adev->is_atom_bios = false;
 	adev->usec_timeout = AMDGPU_MAX_USEC_TIMEOUT;
 	adev->mc.gtt_size = 512 * 1024 * 1024;
 	adev->accel_working = false;
@@ -1718,12 +1717,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		r = -EINVAL;
 		goto failed;
 	}
-	/* Must be an ATOMBIOS */
-	if (!adev->is_atom_bios) {
-		dev_err(adev->dev, "Expecting atombios for GPU\n");
-		r = -EINVAL;
-		goto failed;
-	}
+
 	r = amdgpu_atombios_init(adev);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_atombios_init failed\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +4 -6
index 741144f..d235125 100644
@@ -582,12 +582,10 @@ int amdgpu_modeset_create_props(struct amdgpu_device *adev)
 {
 	int sz;
 
-	if (adev->is_atom_bios) {
-		adev->mode_info.coherent_mode_property =
-			drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
-		if (!adev->mode_info.coherent_mode_property)
-			return -ENOMEM;
-	}
+	adev->mode_info.coherent_mode_property =
+		drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
+	if (!adev->mode_info.coherent_mode_property)
+		return -ENOMEM;
 
 	adev->mode_info.load_detect_property =
 		drm_property_create_range(adev->ddev, 0, "load detection", 0, 1);
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +1 -2
index 91d3673..f273999 100644
@@ -231,8 +231,7 @@ void amdgpu_i2c_init(struct amdgpu_device *adev)
 	if (amdgpu_hw_i2c)
 		DRM_INFO("hw_i2c forced on, you may experience display detection problems!\n");
 
-	if (adev->is_atom_bios)
-		amdgpu_atombios_i2c_init(adev);
+	amdgpu_atombios_i2c_init(adev);
 }
 
 /* remove all the buses */
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -6
index c32eca2..2af26d2 100644
@@ -181,9 +181,6 @@ void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encode
 	if (!amdgpu_encoder->enc_priv)
 		return;
 
-	if (!adev->is_atom_bios)
-		return;
-
 	if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
 		return;
 
@@ -236,9 +233,6 @@ amdgpu_atombios_encoder_fini_backlight(struct amdgpu_encoder *amdgpu_encoder)
 	if (!amdgpu_encoder->enc_priv)
 		return;
 
-	if (!adev->is_atom_bios)
-		return;
-
 	if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
 		return;
 
Signature · 6 lines
2.10.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 151 lines · Nils Wallménius

This is a left over from radeon, amdgpu doesn't support any non-atombios parts and amdgpu_device_init would bail if the check for atombios failed anyway.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c       | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c       | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  8 +-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c    | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c        |  3 +--
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |  6 ------
 7 files changed, 16 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 29d3a91..11de710 100644
@@ -1330,7 +1330,6 @@ struct amdgpu_device {
 
 	/* BIOS */
 	uint8_t				*bios;
-	bool				is_atom_bios;
 	struct amdgpu_bo		*stollen_vga_memory;
 	uint32_t			bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
 
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -6
index 5796539..ef79551 100644
@@ -672,12 +672,10 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 
 			if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
 			    enc->enc_priv) {
-				if (adev->is_atom_bios) {
-					struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
-					if (dig->bl_dev) {
-						atif->encoder_for_bl = enc;
-						break;
-					}
+				struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
+				if (dig->bl_dev) {
+					atif->encoder_for_bl = enc;
+					break;
 				}
 			}
 		}
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +6 -6
index b7e2762..1103259 100644
@@ -387,15 +387,15 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 	if (!bios_header_start) {
 		goto free_bios;
 	}
+
+	/* Must be an ATOMBIOS */
 	tmp = bios_header_start + 4;
-	if (!memcmp(adev->bios + tmp, "ATOM", 4) ||
-	    !memcmp(adev->bios + tmp, "MOTA", 4)) {
-		adev->is_atom_bios = true;
-	} else {
-		adev->is_atom_bios = false;
+	if (memcmp(adev->bios + tmp, "ATOM", 4) &&
+	    memcmp(adev->bios + tmp, "MOTA", 4)) {
+		goto free_bios;
 	}
 
-	DRM_DEBUG("%sBIOS detected\n", adev->is_atom_bios ? "ATOM" : "COM");
+	DRM_DEBUG("ATOMBIOS detected\n");
 	return true;
 free_bios:
 	kfree(adev->bios);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -7
index d907411..dc017d1 100644
@@ -1603,7 +1603,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	adev->pdev = pdev;
 	adev->flags = flags;
 	adev->asic_type = flags & AMD_ASIC_MASK;
-	adev->is_atom_bios = false;
 	adev->usec_timeout = AMDGPU_MAX_USEC_TIMEOUT;
 	adev->mc.gtt_size = 512 * 1024 * 1024;
 	adev->accel_working = false;
@@ -1718,12 +1717,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		r = -EINVAL;
 		goto failed;
 	}
-	/* Must be an ATOMBIOS */
-	if (!adev->is_atom_bios) {
-		dev_err(adev->dev, "Expecting atombios for GPU\n");
-		r = -EINVAL;
-		goto failed;
-	}
+
 	r = amdgpu_atombios_init(adev);
 	if (r) {
 		dev_err(adev->dev, "amdgpu_atombios_init failed\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +4 -6
index 741144f..d235125 100644
@@ -582,12 +582,10 @@ int amdgpu_modeset_create_props(struct amdgpu_device *adev)
 {
 	int sz;
 
-	if (adev->is_atom_bios) {
-		adev->mode_info.coherent_mode_property =
-			drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
-		if (!adev->mode_info.coherent_mode_property)
-			return -ENOMEM;
-	}
+	adev->mode_info.coherent_mode_property =
+		drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
+	if (!adev->mode_info.coherent_mode_property)
+		return -ENOMEM;
 
 	adev->mode_info.load_detect_property =
 		drm_property_create_range(adev->ddev, 0, "load detection", 0, 1);
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +1 -2
index 91d3673..f273999 100644
@@ -231,8 +231,7 @@ void amdgpu_i2c_init(struct amdgpu_device *adev)
 	if (amdgpu_hw_i2c)
 		DRM_INFO("hw_i2c forced on, you may experience display detection problems!\n");
 
-	if (adev->is_atom_bios)
-		amdgpu_atombios_i2c_init(adev);
+	amdgpu_atombios_i2c_init(adev);
 }
 
 /* remove all the buses */
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -3
index c32eca2..2af26d2 100644
@@ -181,9 +181,6 @@ void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encode
 	if (!amdgpu_encoder->enc_priv)
 		return;
 
-	if (!adev->is_atom_bios)
-		return;
-
 	if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
 		return;
 

drivers/gpu/drm/amd/amdgpu/atombios_encoders.c amdgpu_atombios_encoder_fini_backlight(struct amdgpu_encoder *amdgpu_encoder) · line 238

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -3
@@ -236,9 +233,6 @@ amdgpu_atombios_encoder_fini_backlight(struct amdgpu_encoder *amdgpu_encoder)
 	if (!amdgpu_encoder->enc_priv)
 		return;
 
-	if (!adev->is_atom_bios)
-		return;
-
 	if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
 		return;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Applied
#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Nils Wallménius

This is a left over from radeon, amdgpu doesn't support any non-atombios parts and amdgpu_device_init would bail if the check for atombios failed anyway.

Applied. thanks!

Alex

Quoted 157 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c       | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c       | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c     |  8 +-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c    | 10 ++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c        |  3 +--
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |  6 ------
 7 files changed, 16 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 29d3a91..11de710 100644
@@ -1330,7 +1330,6 @@ struct amdgpu_device {
 
        /* BIOS */
        uint8_t                         *bios;
-       bool                            is_atom_bios;
        struct amdgpu_bo                *stollen_vga_memory;
        uint32_t                        bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
 
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +4 -6
index 5796539..ef79551 100644
@@ -672,12 +672,10 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 
                        if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
                            enc->enc_priv) {
-                               if (adev->is_atom_bios) {
-                                       struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
-                                       if (dig->bl_dev) {
-                                               atif->encoder_for_bl = enc;
-                                               break;
-                                       }
+                               struct amdgpu_encoder_atom_dig *dig = enc->enc_priv;
+                               if (dig->bl_dev) {
+                                       atif->encoder_for_bl = enc;
+                                       break;
                                }
                        }
                }
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +6 -6
index b7e2762..1103259 100644
@@ -387,15 +387,15 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
        if (!bios_header_start) {
                goto free_bios;
        }
+
+       /* Must be an ATOMBIOS */
        tmp = bios_header_start + 4;
-       if (!memcmp(adev->bios + tmp, "ATOM", 4) ||
-           !memcmp(adev->bios + tmp, "MOTA", 4)) {
-               adev->is_atom_bios = true;
-       } else {
-               adev->is_atom_bios = false;
+       if (memcmp(adev->bios + tmp, "ATOM", 4) &&
+           memcmp(adev->bios + tmp, "MOTA", 4)) {
+               goto free_bios;
        }
 
-       DRM_DEBUG("%sBIOS detected\n", adev->is_atom_bios ? "ATOM" : "COM");
+       DRM_DEBUG("ATOMBIOS detected\n");
        return true;
 free_bios:
        kfree(adev->bios);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -7
index d907411..dc017d1 100644
@@ -1603,7 +1603,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        adev->pdev = pdev;
        adev->flags = flags;
        adev->asic_type = flags & AMD_ASIC_MASK;
-       adev->is_atom_bios = false;
        adev->usec_timeout = AMDGPU_MAX_USEC_TIMEOUT;
        adev->mc.gtt_size = 512 * 1024 * 1024;
        adev->accel_working = false;
@@ -1718,12 +1717,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                r = -EINVAL;
                goto failed;
        }
-       /* Must be an ATOMBIOS */
-       if (!adev->is_atom_bios) {
-               dev_err(adev->dev, "Expecting atombios for GPU\n");
-               r = -EINVAL;
-               goto failed;
-       }
+
        r = amdgpu_atombios_init(adev);
        if (r) {
                dev_err(adev->dev, "amdgpu_atombios_init failed\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +4 -6
index 741144f..d235125 100644
@@ -582,12 +582,10 @@ int amdgpu_modeset_create_props(struct amdgpu_device *adev)
 {
        int sz;
 
-       if (adev->is_atom_bios) {
-               adev->mode_info.coherent_mode_property =
-                       drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
-               if (!adev->mode_info.coherent_mode_property)
-                       return -ENOMEM;
-       }
+       adev->mode_info.coherent_mode_property =
+               drm_property_create_range(adev->ddev, 0 , "coherent", 0, 1);
+       if (!adev->mode_info.coherent_mode_property)
+               return -ENOMEM;
 
        adev->mode_info.load_detect_property =
                drm_property_create_range(adev->ddev, 0, "load detection", 0, 1);
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c +1 -2
index 91d3673..f273999 100644
@@ -231,8 +231,7 @@ void amdgpu_i2c_init(struct amdgpu_device *adev)
        if (amdgpu_hw_i2c)
                DRM_INFO("hw_i2c forced on, you may experience display detection problems!\n");
 
-       if (adev->is_atom_bios)
-               amdgpu_atombios_i2c_init(adev);
+       amdgpu_atombios_i2c_init(adev);
 }
 
 /* remove all the buses */
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +0 -7
index c32eca2..2af26d2 100644
@@ -181,9 +181,6 @@ void amdgpu_atombios_encoder_init_backlight(struct amdgpu_encoder *amdgpu_encode
        if (!amdgpu_encoder->enc_priv)
                return;
 
-       if (!adev->is_atom_bios)
-               return;
-
        if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
                return;
 
@@ -236,9 +233,6 @@ amdgpu_atombios_encoder_fini_backlight(struct amdgpu_encoder *amdgpu_encoder)
        if (!amdgpu_encoder->enc_priv)
                return;
 
-       if (!adev->is_atom_bios)
-               return;
-
        if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU))
                return;
 
--

2.10.2

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx