History

acpi/nfit: Issue Start ARS to retrieve existing records

ACPI 6.2 defines in section 9.20.7.2 that the OSPM may call a Start ARS with Flags Bit [1] set upon receiving the 0x81 notification. Upon receiving the notification, the OSPM may decide to issue a Start ARS with Flags Bit [1] set to prepare for the retrieval of existing records and issue the Query ARS Status function to retrieve the records. Add support to call a Start ARS from acpi_nfit_uc_error_notify() with ND_ARS_RETURN_PREV_DATA set when HW_ERROR_SCRUB_ON is not set.

Toshi Kani committed 9 years ago

Commit 80790031 parent 759d6a94 files · +14 −5Browse files

Unified · Split

4 files
  1. drivers/acpi/nfit/core.c +10 −3
  2. drivers/acpi/nfit/mce.c +1 −1
  3. drivers/acpi/nfit/nfit.h +2 −1
  4. include/uapi/linux/ndctl.h +1 −0
drivers/acpi/nfit/core.c+10−3
@@ -1044,7 +1044,7 @@ static ssize_t scrub_store(struct device *dev, · 1043 unmodified lines
10441044 if (nd_desc) {
10451045 struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
10461046
1047− rc = acpi_nfit_ars_rescan(acpi_desc);
1047+ rc = acpi_nfit_ars_rescan(acpi_desc, 0);
10481048 }
10491049 device_unlock(dev);
10501050 if (rc)
@@ -2137,6 +2137,7 @@ static int ars_start(struct acpi_nfit_desc *acpi_desc, struct nfit_spa *nfit_spa · 1086 unmodified lines
21372137 memset(&ars_start, 0, sizeof(ars_start));
21382138 ars_start.address = spa->address;
21392139 ars_start.length = spa->length;
2140+ ars_start.flags = acpi_desc->ars_start_flags;
21402141 if (nfit_spa_type(spa) == NFIT_SPA_PM)
21412142 ars_start.type = ND_ARS_PERSISTENT;
21422143 else if (nfit_spa_type(spa) == NFIT_SPA_VOLATILE)
@@ -2163,6 +2164,7 @@ static int ars_continue(struct acpi_nfit_desc *acpi_desc) · 20 unmodified lines
21632164 ars_start.address = ars_status->restart_address;
21642165 ars_start.length = ars_status->restart_length;
21652166 ars_start.type = ars_status->type;
2167+ ars_start.flags = acpi_desc->ars_start_flags;
21662168 rc = nd_desc->ndctl(nd_desc, NULL, ND_CMD_ARS_START, &ars_start,
21672169 sizeof(ars_start), &cmd_rc);
21682170 if (rc < 0)
@@ -2684,6 +2686,7 @@ static void acpi_nfit_scrub(struct work_struct *work) · 515 unmodified lines
26842686 list_for_each_entry(nfit_spa, &acpi_desc->spas, list)
26852687 acpi_nfit_async_scrub(acpi_desc, nfit_spa);
26862688 acpi_desc->scrub_count++;
2689+ acpi_desc->ars_start_flags = 0;
26872690 if (acpi_desc->scrub_count_state)
26882691 sysfs_notify_dirent(acpi_desc->scrub_count_state);
26892692 mutex_unlock(&acpi_desc->init_mutex);
@@ -2702,6 +2705,7 @@ static int acpi_nfit_register_regions(struct acpi_nfit_desc *acpi_desc) · 12 unmodified lines
27022705 return rc;
27032706 }
27042707
2708+ acpi_desc->ars_start_flags = 0;
27052709 if (!acpi_desc->cancel)
27062710 queue_work(nfit_wq, &acpi_desc->work);
27072711 return 0;
@@ -2906,7 +2910,7 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, · 198 unmodified lines
29062910 return 0;
29072911 }
29082912
2909−int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc)
2913+int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
29102914 {
29112915 struct device *dev = acpi_desc->dev;
29122916 struct nfit_spa *nfit_spa;
@@ -2928,6 +2932,7 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc) · 15 unmodified lines
29282932
29292933 nfit_spa->ars_required = 1;
29302934 }
2935+ acpi_desc->ars_start_flags = flags;
29312936 queue_work(nfit_wq, &acpi_desc->work);
29322937 dev_dbg(dev, "%s: ars_scan triggered\n", __func__);
29332938 mutex_unlock(&acpi_desc->init_mutex);
@@ -3104,8 +3109,10 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle) · 170 unmodified lines
31043109 static void acpi_nfit_uc_error_notify(struct device *dev, acpi_handle handle)
31053110 {
31063111 struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev);
3112+ u8 flags = (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) ?
3113+ 0 : ND_ARS_RETURN_PREV_DATA;
31073114
3108− acpi_nfit_ars_rescan(acpi_desc);
3115+ acpi_nfit_ars_rescan(acpi_desc, flags);
31093116 }
31103117
31113118 void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event)
drivers/acpi/nfit/mce.c+1−1
@@ -79,7 +79,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, · 78 unmodified lines
7979 * already in progress, just let that be the last
8080 * authoritative one
8181 */
82− acpi_nfit_ars_rescan(acpi_desc);
82+ acpi_nfit_ars_rescan(acpi_desc, 0);
8383 }
8484 break;
8585 }
drivers/acpi/nfit/nfit.h+2−1
@@ -155,6 +155,7 @@ struct acpi_nfit_desc { · 154 unmodified lines
155155 struct list_head idts;
156156 struct nvdimm_bus *nvdimm_bus;
157157 struct device *dev;
158+ u8 ars_start_flags;
158159 struct nd_cmd_ars_status *ars_status;
159160 size_t ars_status_size;
160161 struct work_struct work;
@@ -207,7 +208,7 @@ struct nfit_blk { · 46 unmodified lines
207208
208209 extern struct list_head acpi_descs;
209210 extern struct mutex acpi_desc_lock;
210−int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc);
211+int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags);
211212
212213 #ifdef CONFIG_X86_MCE
213214 void nfit_mce_register(void);
include/uapi/linux/ndctl.h+1−0
@@ -207,6 +207,7 @@ enum { · 206 unmodified lines
207207 enum {
208208 ND_ARS_VOLATILE = 1,
209209 ND_ARS_PERSISTENT = 2,
210+ ND_ARS_RETURN_PREV_DATA = 1 << 1,
210211 ND_CONFIG_LOCKED = 1,
211212 };
212213