Commit 5bc4418b authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: [sparse] __iomem fixes for opregion

Almost all of the errors related __iomem problems.

Most of the changes here are trivial, however there is plenty of chance
for yank/paste errors.
Signed-off-by: default avatarBen Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 92d68ed7
...@@ -122,11 +122,11 @@ struct opregion_asle; ...@@ -122,11 +122,11 @@ struct opregion_asle;
struct drm_i915_private; struct drm_i915_private;
struct intel_opregion { struct intel_opregion {
struct opregion_header *header; struct opregion_header __iomem *header;
struct opregion_acpi *acpi; struct opregion_acpi __iomem *acpi;
struct opregion_swsci *swsci; struct opregion_swsci __iomem *swsci;
struct opregion_asle *asle; struct opregion_asle __iomem *asle;
void *vbt; void __iomem *vbt;
u32 __iomem *lid_state; u32 __iomem *lid_state;
}; };
#define OPREGION_SIZE (8*1024) #define OPREGION_SIZE (8*1024)
......
...@@ -151,7 +151,7 @@ struct opregion_asle { ...@@ -151,7 +151,7 @@ struct opregion_asle {
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
u32 max; u32 max;
if (!(bclp & ASLE_BCLP_VALID)) if (!(bclp & ASLE_BCLP_VALID))
...@@ -163,7 +163,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) ...@@ -163,7 +163,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
max = intel_panel_get_max_backlight(dev); max = intel_panel_get_max_backlight(dev);
intel_panel_set_backlight(dev, bclp * max / 255); intel_panel_set_backlight(dev, bclp * max / 255);
asle->cblv = (bclp*0x64)/0xff | ASLE_CBLV_VALID; iowrite32((bclp*0x64)/0xff | ASLE_CBLV_VALID, &asle->cblv);
return 0; return 0;
} }
...@@ -200,14 +200,14 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit) ...@@ -200,14 +200,14 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit)
void intel_opregion_asle_intr(struct drm_device *dev) void intel_opregion_asle_intr(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
u32 asle_stat = 0; u32 asle_stat = 0;
u32 asle_req; u32 asle_req;
if (!asle) if (!asle)
return; return;
asle_req = asle->aslc & ASLE_REQ_MSK; asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
if (!asle_req) { if (!asle_req) {
DRM_DEBUG_DRIVER("non asle set request??\n"); DRM_DEBUG_DRIVER("non asle set request??\n");
...@@ -215,31 +215,31 @@ void intel_opregion_asle_intr(struct drm_device *dev) ...@@ -215,31 +215,31 @@ void intel_opregion_asle_intr(struct drm_device *dev)
} }
if (asle_req & ASLE_SET_ALS_ILLUM) if (asle_req & ASLE_SET_ALS_ILLUM)
asle_stat |= asle_set_als_illum(dev, asle->alsi); asle_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
if (asle_req & ASLE_SET_BACKLIGHT) if (asle_req & ASLE_SET_BACKLIGHT)
asle_stat |= asle_set_backlight(dev, asle->bclp); asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
if (asle_req & ASLE_SET_PFIT) if (asle_req & ASLE_SET_PFIT)
asle_stat |= asle_set_pfit(dev, asle->pfit); asle_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
if (asle_req & ASLE_SET_PWM_FREQ) if (asle_req & ASLE_SET_PWM_FREQ)
asle_stat |= asle_set_pwm_freq(dev, asle->pfmb); asle_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
asle->aslc = asle_stat; iowrite32(asle_stat, &asle->aslc);
} }
void intel_opregion_gse_intr(struct drm_device *dev) void intel_opregion_gse_intr(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
u32 asle_stat = 0; u32 asle_stat = 0;
u32 asle_req; u32 asle_req;
if (!asle) if (!asle)
return; return;
asle_req = asle->aslc & ASLE_REQ_MSK; asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
if (!asle_req) { if (!asle_req) {
DRM_DEBUG_DRIVER("non asle set request??\n"); DRM_DEBUG_DRIVER("non asle set request??\n");
...@@ -252,7 +252,7 @@ void intel_opregion_gse_intr(struct drm_device *dev) ...@@ -252,7 +252,7 @@ void intel_opregion_gse_intr(struct drm_device *dev)
} }
if (asle_req & ASLE_SET_BACKLIGHT) if (asle_req & ASLE_SET_BACKLIGHT)
asle_stat |= asle_set_backlight(dev, asle->bclp); asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
if (asle_req & ASLE_SET_PFIT) { if (asle_req & ASLE_SET_PFIT) {
DRM_DEBUG_DRIVER("Pfit is not supported\n"); DRM_DEBUG_DRIVER("Pfit is not supported\n");
...@@ -264,7 +264,7 @@ void intel_opregion_gse_intr(struct drm_device *dev) ...@@ -264,7 +264,7 @@ void intel_opregion_gse_intr(struct drm_device *dev)
asle_stat |= ASLE_PWM_FREQ_FAILED; asle_stat |= ASLE_PWM_FREQ_FAILED;
} }
asle->aslc = asle_stat; iowrite32(asle_stat, &asle->aslc);
} }
#define ASLE_ALS_EN (1<<0) #define ASLE_ALS_EN (1<<0)
#define ASLE_BLC_EN (1<<1) #define ASLE_BLC_EN (1<<1)
...@@ -274,15 +274,16 @@ void intel_opregion_gse_intr(struct drm_device *dev) ...@@ -274,15 +274,16 @@ void intel_opregion_gse_intr(struct drm_device *dev)
void intel_opregion_enable_asle(struct drm_device *dev) void intel_opregion_enable_asle(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct opregion_asle *asle = dev_priv->opregion.asle; struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
if (asle) { if (asle) {
if (IS_MOBILE(dev)) if (IS_MOBILE(dev))
intel_enable_asle(dev); intel_enable_asle(dev);
asle->tche = ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN | iowrite32(ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN |
ASLE_PFMB_EN; ASLE_PFMB_EN,
asle->ardy = 1; &asle->tche);
iowrite32(1, &asle->ardy);
} }
} }
...@@ -300,7 +301,7 @@ static int intel_opregion_video_event(struct notifier_block *nb, ...@@ -300,7 +301,7 @@ static int intel_opregion_video_event(struct notifier_block *nb,
Linux, these are handled by the dock, button and video drivers. Linux, these are handled by the dock, button and video drivers.
*/ */
struct opregion_acpi *acpi; struct opregion_acpi __iomem *acpi;
struct acpi_bus_event *event = data; struct acpi_bus_event *event = data;
int ret = NOTIFY_OK; int ret = NOTIFY_OK;
...@@ -312,10 +313,11 @@ static int intel_opregion_video_event(struct notifier_block *nb, ...@@ -312,10 +313,11 @@ static int intel_opregion_video_event(struct notifier_block *nb,
acpi = system_opregion->acpi; acpi = system_opregion->acpi;
if (event->type == 0x80 && !(acpi->cevt & 0x1)) if (event->type == 0x80 &&
(ioread32(&acpi->cevt) & 1) == 0)
ret = NOTIFY_BAD; ret = NOTIFY_BAD;
acpi->csts = 0; iowrite32(0, &acpi->csts);
return ret; return ret;
} }
...@@ -339,6 +341,7 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -339,6 +341,7 @@ static void intel_didl_outputs(struct drm_device *dev)
struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL; struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
unsigned long long device_id; unsigned long long device_id;
acpi_status status; acpi_status status;
u32 temp;
int i = 0; int i = 0;
handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
...@@ -373,7 +376,8 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -373,7 +376,8 @@ static void intel_didl_outputs(struct drm_device *dev)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
if (!device_id) if (!device_id)
goto blind_set; goto blind_set;
opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f); iowrite32((u32)(device_id & 0x0f0f),
&opregion->acpi->didl[i]);
i++; i++;
} }
} }
...@@ -381,7 +385,7 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -381,7 +385,7 @@ static void intel_didl_outputs(struct drm_device *dev)
end: end:
/* If fewer than 8 outputs, the list must be null terminated */ /* If fewer than 8 outputs, the list must be null terminated */
if (i < 8) if (i < 8)
opregion->acpi->didl[i] = 0; iowrite32(0, &opregion->acpi->didl[i]);
return; return;
blind_set: blind_set:
...@@ -415,7 +419,9 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -415,7 +419,9 @@ static void intel_didl_outputs(struct drm_device *dev)
output_type = ACPI_LVDS_OUTPUT; output_type = ACPI_LVDS_OUTPUT;
break; break;
} }
opregion->acpi->didl[i] |= (1<<31) | output_type | i; temp = ioread32(&opregion->acpi->didl[i]);
iowrite32(temp | (1<<31) | output_type | i,
&opregion->acpi->didl[i]);
i++; i++;
} }
goto end; goto end;
...@@ -436,8 +442,8 @@ void intel_opregion_init(struct drm_device *dev) ...@@ -436,8 +442,8 @@ void intel_opregion_init(struct drm_device *dev)
/* Notify BIOS we are ready to handle ACPI video ext notifs. /* Notify BIOS we are ready to handle ACPI video ext notifs.
* Right now, all the events are handled by the ACPI video module. * Right now, all the events are handled by the ACPI video module.
* We don't actually need to do anything with them. */ * We don't actually need to do anything with them. */
opregion->acpi->csts = 0; iowrite32(0, &opregion->acpi->csts);
opregion->acpi->drdy = 1; iowrite32(1, &opregion->acpi->drdy);
system_opregion = opregion; system_opregion = opregion;
register_acpi_notifier(&intel_opregion_notifier); register_acpi_notifier(&intel_opregion_notifier);
...@@ -456,7 +462,7 @@ void intel_opregion_fini(struct drm_device *dev) ...@@ -456,7 +462,7 @@ void intel_opregion_fini(struct drm_device *dev)
return; return;
if (opregion->acpi) { if (opregion->acpi) {
opregion->acpi->drdy = 0; iowrite32(0, &opregion->acpi->drdy);
system_opregion = NULL; system_opregion = NULL;
unregister_acpi_notifier(&intel_opregion_notifier); unregister_acpi_notifier(&intel_opregion_notifier);
...@@ -476,8 +482,9 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -476,8 +482,9 @@ int intel_opregion_setup(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
void *base; void __iomem *base;
u32 asls, mboxes; u32 asls, mboxes;
char buf[sizeof(OPREGION_SIGNATURE)];
int err = 0; int err = 0;
pci_read_config_dword(dev->pdev, PCI_ASLS, &asls); pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
...@@ -491,7 +498,9 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -491,7 +498,9 @@ int intel_opregion_setup(struct drm_device *dev)
if (!base) if (!base)
return -ENOMEM; return -ENOMEM;
if (memcmp(base, OPREGION_SIGNATURE, 16)) { memcpy_fromio(buf, base, sizeof(buf));
if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
DRM_DEBUG_DRIVER("opregion signature mismatch\n"); DRM_DEBUG_DRIVER("opregion signature mismatch\n");
err = -EINVAL; err = -EINVAL;
goto err_out; goto err_out;
...@@ -501,7 +510,7 @@ int intel_opregion_setup(struct drm_device *dev) ...@@ -501,7 +510,7 @@ int intel_opregion_setup(struct drm_device *dev)
opregion->lid_state = base + ACPI_CLID; opregion->lid_state = base + ACPI_CLID;
mboxes = opregion->header->mboxes; mboxes = ioread32(&opregion->header->mboxes);
if (mboxes & MBOX_ACPI) { if (mboxes & MBOX_ACPI) {
DRM_DEBUG_DRIVER("Public ACPI methods supported\n"); DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
opregion->acpi = base + OPREGION_ACPI_OFFSET; opregion->acpi = base + OPREGION_ACPI_OFFSET;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment