2 * Common EFI (Extensible Firmware Interface) support functions
3 * Based on Extensible Firmware Interface Specification version 1.0
5 * Copyright (C) 1999 VA Linux Systems
6 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
7 * Copyright (C) 1999-2002 Hewlett-Packard Co.
8 * David Mosberger-Tang <davidm@hpl.hp.com>
9 * Stephane Eranian <eranian@hpl.hp.com>
10 * Copyright (C) 2005-2008 Intel Co.
11 * Fenghua Yu <fenghua.yu@intel.com>
12 * Bibo Mao <bibo.mao@intel.com>
13 * Chandramouli Narayanan <mouli@linux.intel.com>
14 * Huang Ying <ying.huang@intel.com>
16 * Copied from efi_32.c to eliminate the duplicated code between EFI
17 * 32/64 support code. --ying 2007-10-26
19 * All EFI Runtime Services are not implemented yet as EFI only
20 * supports physical mode addressing on SoftSDV. This is to be fixed
21 * in a future version. --drummond 1999-07-20
23 * Implemented EFI runtime services and virtual mode calls. --davidm
25 * Goutham Rao: <goutham.rao@intel.com>
26 * Skip non-WB memory and ignore empty memory ranges.
29 #include <linux/kernel.h>
30 #include <linux/init.h>
31 #include <linux/efi.h>
32 #include <linux/export.h>
33 #include <linux/bootmem.h>
34 #include <linux/memblock.h>
35 #include <linux/spinlock.h>
36 #include <linux/uaccess.h>
37 #include <linux/time.h>
39 #include <linux/reboot.h>
40 #include <linux/bcd.h>
42 #include <asm/setup.h>
45 #include <asm/cacheflush.h>
46 #include <asm/tlbflush.h>
47 #include <asm/x86_init.h>
52 struct efi __read_mostly efi = {
53 .mps = EFI_INVALID_TABLE_ADDR,
54 .acpi = EFI_INVALID_TABLE_ADDR,
55 .acpi20 = EFI_INVALID_TABLE_ADDR,
56 .smbios = EFI_INVALID_TABLE_ADDR,
57 .sal_systab = EFI_INVALID_TABLE_ADDR,
58 .boot_info = EFI_INVALID_TABLE_ADDR,
59 .hcdp = EFI_INVALID_TABLE_ADDR,
60 .uga = EFI_INVALID_TABLE_ADDR,
61 .uv_systab = EFI_INVALID_TABLE_ADDR,
65 struct efi_memory_map memmap;
67 static struct efi efi_phys __initdata;
68 static efi_system_table_t efi_systab __initdata;
70 static inline bool efi_is_native(void)
72 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
75 unsigned long x86_efi_facility;
78 * Returns 1 if 'facility' is enabled, 0 otherwise.
80 int efi_enabled(int facility)
82 return test_bit(facility, &x86_efi_facility) != 0;
84 EXPORT_SYMBOL(efi_enabled);
86 static bool disable_runtime = false;
87 static int __init setup_noefi(char *arg)
89 disable_runtime = true;
92 early_param("noefi", setup_noefi);
95 EXPORT_SYMBOL(add_efi_memmap);
97 static int __init setup_add_efi_memmap(char *arg)
102 early_param("add_efi_memmap", setup_add_efi_memmap);
105 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
110 spin_lock_irqsave(&rtc_lock, flags);
111 status = efi_call_virt2(get_time, tm, tc);
112 spin_unlock_irqrestore(&rtc_lock, flags);
116 static efi_status_t virt_efi_set_time(efi_time_t *tm)
121 spin_lock_irqsave(&rtc_lock, flags);
122 status = efi_call_virt1(set_time, tm);
123 spin_unlock_irqrestore(&rtc_lock, flags);
127 static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled,
134 spin_lock_irqsave(&rtc_lock, flags);
135 status = efi_call_virt3(get_wakeup_time,
136 enabled, pending, tm);
137 spin_unlock_irqrestore(&rtc_lock, flags);
141 static efi_status_t virt_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
146 spin_lock_irqsave(&rtc_lock, flags);
147 status = efi_call_virt2(set_wakeup_time,
149 spin_unlock_irqrestore(&rtc_lock, flags);
153 static efi_status_t virt_efi_get_variable(efi_char16_t *name,
156 unsigned long *data_size,
159 return efi_call_virt5(get_variable,
164 static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
168 return efi_call_virt3(get_next_variable,
169 name_size, name, vendor);
172 static efi_status_t virt_efi_set_variable(efi_char16_t *name,
175 unsigned long data_size,
178 return efi_call_virt5(set_variable,
183 static efi_status_t virt_efi_query_variable_info(u32 attr,
185 u64 *remaining_space,
186 u64 *max_variable_size)
188 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
189 return EFI_UNSUPPORTED;
191 return efi_call_virt4(query_variable_info, attr, storage_space,
192 remaining_space, max_variable_size);
195 static efi_status_t virt_efi_get_next_high_mono_count(u32 *count)
197 return efi_call_virt1(get_next_high_mono_count, count);
200 static void virt_efi_reset_system(int reset_type,
202 unsigned long data_size,
205 efi_call_virt4(reset_system, reset_type, status,
209 static efi_status_t virt_efi_update_capsule(efi_capsule_header_t **capsules,
211 unsigned long sg_list)
213 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
214 return EFI_UNSUPPORTED;
216 return efi_call_virt3(update_capsule, capsules, count, sg_list);
219 static efi_status_t virt_efi_query_capsule_caps(efi_capsule_header_t **capsules,
224 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
225 return EFI_UNSUPPORTED;
227 return efi_call_virt4(query_capsule_caps, capsules, count, max_size,
231 static efi_status_t __init phys_efi_set_virtual_address_map(
232 unsigned long memory_map_size,
233 unsigned long descriptor_size,
234 u32 descriptor_version,
235 efi_memory_desc_t *virtual_map)
239 efi_call_phys_prelog();
240 status = efi_call_phys4(efi_phys.set_virtual_address_map,
241 memory_map_size, descriptor_size,
242 descriptor_version, virtual_map);
243 efi_call_phys_epilog();
247 static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
253 spin_lock_irqsave(&rtc_lock, flags);
254 efi_call_phys_prelog();
255 status = efi_call_phys2(efi_phys.get_time, tm, tc);
256 efi_call_phys_epilog();
257 spin_unlock_irqrestore(&rtc_lock, flags);
261 int efi_set_rtc_mmss(unsigned long nowtime)
263 int real_seconds, real_minutes;
268 status = efi.get_time(&eft, &cap);
269 if (status != EFI_SUCCESS) {
270 printk(KERN_ERR "Oops: efitime: can't read time!\n");
274 real_seconds = nowtime % 60;
275 real_minutes = nowtime / 60;
276 if (((abs(real_minutes - eft.minute) + 15)/30) & 1)
279 eft.minute = real_minutes;
280 eft.second = real_seconds;
282 status = efi.set_time(&eft);
283 if (status != EFI_SUCCESS) {
284 printk(KERN_ERR "Oops: efitime: can't write time!\n");
290 unsigned long efi_get_time(void)
296 status = efi.get_time(&eft, &cap);
297 if (status != EFI_SUCCESS)
298 printk(KERN_ERR "Oops: efitime: can't read time!\n");
300 return mktime(eft.year, eft.month, eft.day, eft.hour,
301 eft.minute, eft.second);
305 * Tell the kernel about the EFI memory map. This might include
306 * more than the max 128 entries that can fit in the e820 legacy
307 * (zeropage) memory map.
310 static void __init do_add_efi_memmap(void)
314 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
315 efi_memory_desc_t *md = p;
316 unsigned long long start = md->phys_addr;
317 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
321 case EFI_LOADER_CODE:
322 case EFI_LOADER_DATA:
323 case EFI_BOOT_SERVICES_CODE:
324 case EFI_BOOT_SERVICES_DATA:
325 case EFI_CONVENTIONAL_MEMORY:
326 if (md->attribute & EFI_MEMORY_WB)
327 e820_type = E820_RAM;
329 e820_type = E820_RESERVED;
331 case EFI_ACPI_RECLAIM_MEMORY:
332 e820_type = E820_ACPI;
334 case EFI_ACPI_MEMORY_NVS:
335 e820_type = E820_NVS;
337 case EFI_UNUSABLE_MEMORY:
338 e820_type = E820_UNUSABLE;
342 * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE
343 * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO
344 * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE
346 e820_type = E820_RESERVED;
349 e820_add_region(start, size, e820_type);
351 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
354 void __init efi_memblock_x86_reserve_range(void)
359 pmap = boot_params.efi_info.efi_memmap;
361 pmap = (boot_params.efi_info.efi_memmap |
362 ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
364 memmap.phys_map = (void *)pmap;
365 memmap.nr_map = boot_params.efi_info.efi_memmap_size /
366 boot_params.efi_info.efi_memdesc_size;
367 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
368 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
369 memblock_x86_reserve_range(pmap, pmap + memmap.nr_map * memmap.desc_size,
374 static void __init print_efi_memmap(void)
376 efi_memory_desc_t *md;
380 for (p = memmap.map, i = 0;
382 p += memmap.desc_size, i++) {
384 printk(KERN_INFO PFX "mem%02u: type=%u, attr=0x%llx, "
385 "range=[0x%016llx-0x%016llx) (%lluMB)\n",
386 i, md->type, md->attribute, md->phys_addr,
387 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
388 (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
391 #endif /* EFI_DEBUG */
393 void __init efi_reserve_boot_services(void)
397 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
398 efi_memory_desc_t *md = p;
399 u64 start = md->phys_addr;
400 u64 size = md->num_pages << EFI_PAGE_SHIFT;
402 if (md->type != EFI_BOOT_SERVICES_CODE &&
403 md->type != EFI_BOOT_SERVICES_DATA)
405 /* Only reserve where possible:
406 * - Not within any already allocated areas
407 * - Not over any memory area (really needed, if above?)
408 * - Not within any part of the kernel
409 * - Not the bios reserved area
411 if ((start+size >= virt_to_phys(_text)
412 && start <= virt_to_phys(_end)) ||
413 !e820_all_mapped(start, start+size, E820_RAM) ||
414 memblock_x86_check_reserved_size(&start, &size,
415 1<<EFI_PAGE_SHIFT)) {
416 /* Could not reserve, skip it */
418 memblock_dbg(PFX "Could not reserve boot range "
419 "[0x%010llx-0x%010llx]\n",
420 start, start+size-1);
422 memblock_x86_reserve_range(start, start+size,
427 static void __init efi_free_boot_services(void)
431 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
432 efi_memory_desc_t *md = p;
433 unsigned long long start = md->phys_addr;
434 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
436 if (md->type != EFI_BOOT_SERVICES_CODE &&
437 md->type != EFI_BOOT_SERVICES_DATA)
440 /* Could not reserve boot area */
444 free_bootmem_late(start, size);
448 void __init efi_init(void)
450 efi_config_table_t *config_tables;
451 efi_runtime_services_t *runtime;
453 char vendor[100] = "unknown";
457 if (!efi_is_native())
461 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
463 efi_phys.systab = (efi_system_table_t *)
464 (boot_params.efi_info.efi_systab |
465 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
468 efi.systab = early_ioremap((unsigned long)efi_phys.systab,
469 sizeof(efi_system_table_t));
470 if (efi.systab == NULL)
471 printk(KERN_ERR "Couldn't map the EFI system table!\n");
472 memcpy(&efi_systab, efi.systab, sizeof(efi_system_table_t));
473 early_iounmap(efi.systab, sizeof(efi_system_table_t));
474 efi.systab = &efi_systab;
477 * Verify the EFI Table
479 if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
480 printk(KERN_ERR "EFI system table signature incorrect!\n");
481 if ((efi.systab->hdr.revision >> 16) == 0)
482 printk(KERN_ERR "Warning: EFI system table version "
483 "%d.%02d, expected 1.00 or greater!\n",
484 efi.systab->hdr.revision >> 16,
485 efi.systab->hdr.revision & 0xffff);
487 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
490 * Show what we know for posterity
492 c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2);
494 for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i)
498 printk(KERN_ERR PFX "Could not map the firmware vendor!\n");
499 early_iounmap(tmp, 2);
501 printk(KERN_INFO "EFI v%u.%.02u by %s\n",
502 efi.systab->hdr.revision >> 16,
503 efi.systab->hdr.revision & 0xffff, vendor);
506 * Let's see what config tables the firmware passed to us.
508 config_tables = early_ioremap(
510 efi.systab->nr_tables * sizeof(efi_config_table_t));
511 if (config_tables == NULL)
512 printk(KERN_ERR "Could not map EFI Configuration Table!\n");
515 for (i = 0; i < efi.systab->nr_tables; i++) {
516 if (!efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID)) {
517 efi.mps = config_tables[i].table;
518 printk(" MPS=0x%lx ", config_tables[i].table);
519 } else if (!efi_guidcmp(config_tables[i].guid,
520 ACPI_20_TABLE_GUID)) {
521 efi.acpi20 = config_tables[i].table;
522 printk(" ACPI 2.0=0x%lx ", config_tables[i].table);
523 } else if (!efi_guidcmp(config_tables[i].guid,
525 efi.acpi = config_tables[i].table;
526 printk(" ACPI=0x%lx ", config_tables[i].table);
527 } else if (!efi_guidcmp(config_tables[i].guid,
528 SMBIOS_TABLE_GUID)) {
529 efi.smbios = config_tables[i].table;
530 printk(" SMBIOS=0x%lx ", config_tables[i].table);
532 } else if (!efi_guidcmp(config_tables[i].guid,
533 UV_SYSTEM_TABLE_GUID)) {
534 efi.uv_systab = config_tables[i].table;
535 printk(" UVsystab=0x%lx ", config_tables[i].table);
537 } else if (!efi_guidcmp(config_tables[i].guid,
539 efi.hcdp = config_tables[i].table;
540 printk(" HCDP=0x%lx ", config_tables[i].table);
541 } else if (!efi_guidcmp(config_tables[i].guid,
542 UGA_IO_PROTOCOL_GUID)) {
543 efi.uga = config_tables[i].table;
544 printk(" UGA=0x%lx ", config_tables[i].table);
548 early_iounmap(config_tables,
549 efi.systab->nr_tables * sizeof(efi_config_table_t));
551 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
553 if (!disable_runtime) {
555 * Check out the runtime services table. We need to map
556 * the runtime services table so that we can grab the physical
557 * address of several of the EFI runtime functions, needed to
558 * set the firmware into virtual mode.
560 runtime = early_ioremap((unsigned long)efi.systab->runtime,
561 sizeof(efi_runtime_services_t));
562 if (runtime != NULL) {
564 * We will only need *early* access to the following
565 * two EFI runtime services before set_virtual_address_map
568 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
569 efi_phys.set_virtual_address_map =
570 (efi_set_virtual_address_map_t *)
571 runtime->set_virtual_address_map;
573 * Make efi_get_time can be called before entering
576 efi.get_time = phys_efi_get_time;
578 set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
580 printk(KERN_ERR "Could not map the EFI runtime service "
582 early_iounmap(runtime, sizeof(efi_runtime_services_t));
585 /* Map the EFI memory map */
586 memmap.map = early_ioremap((unsigned long)memmap.phys_map,
587 memmap.nr_map * memmap.desc_size);
588 if (memmap.map == NULL)
589 printk(KERN_ERR "Could not map the EFI memory map!\n");
590 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
592 if (memmap.desc_size != sizeof(efi_memory_desc_t))
594 "Kernel-defined memdesc doesn't match the one from EFI!\n");
599 set_bit(EFI_MEMMAP, &x86_efi_facility);
602 x86_platform.get_wallclock = efi_get_time;
603 x86_platform.set_wallclock = efi_set_rtc_mmss;
611 void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
615 addr = md->virt_addr;
616 npages = md->num_pages;
618 memrange_efi_to_native(&addr, &npages);
621 set_memory_x(addr, npages);
623 set_memory_nx(addr, npages);
626 static void __init runtime_code_page_mkexec(void)
628 efi_memory_desc_t *md;
631 /* Make EFI runtime service code area executable */
632 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
635 if (md->type != EFI_RUNTIME_SERVICES_CODE)
638 efi_set_executable(md, true);
643 * This function will switch the EFI runtime services to virtual mode.
644 * Essentially, look through the EFI memmap and map every region that
645 * has the runtime attribute bit set in its memory descriptor and update
646 * that memory descriptor with the virtual address obtained from ioremap().
647 * This enables the runtime services to be called without having to
648 * thunk back into physical mode for every invocation.
650 void __init efi_enter_virtual_mode(void)
652 efi_memory_desc_t *md, *prev_md = NULL;
655 u64 end, systab, addr, npages, end_pfn;
656 void *p, *va, *new_memmap = NULL;
661 /* Merge contiguous regions of the same type and attribute */
662 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
671 if (prev_md->type != md->type ||
672 prev_md->attribute != md->attribute) {
677 prev_size = prev_md->num_pages << EFI_PAGE_SHIFT;
679 if (md->phys_addr == (prev_md->phys_addr + prev_size)) {
680 prev_md->num_pages += md->num_pages;
681 md->type = EFI_RESERVED_TYPE;
688 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
690 if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
691 md->type != EFI_BOOT_SERVICES_CODE &&
692 md->type != EFI_BOOT_SERVICES_DATA)
695 size = md->num_pages << EFI_PAGE_SHIFT;
696 end = md->phys_addr + size;
698 end_pfn = PFN_UP(end);
699 if (end_pfn <= max_low_pfn_mapped
700 || (end_pfn > (1UL << (32 - PAGE_SHIFT))
701 && end_pfn <= max_pfn_mapped))
702 va = __va(md->phys_addr);
704 va = efi_ioremap(md->phys_addr, size, md->type);
706 md->virt_addr = (u64) (unsigned long) va;
709 printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n",
710 (unsigned long long)md->phys_addr);
714 if (!(md->attribute & EFI_MEMORY_WB)) {
715 addr = md->virt_addr;
716 npages = md->num_pages;
717 memrange_efi_to_native(&addr, &npages);
718 set_memory_uc(addr, npages);
721 systab = (u64) (unsigned long) efi_phys.systab;
722 if (md->phys_addr <= systab && systab < end) {
723 systab += md->virt_addr - md->phys_addr;
724 efi.systab = (efi_system_table_t *) (unsigned long) systab;
726 new_memmap = krealloc(new_memmap,
727 (count + 1) * memmap.desc_size,
729 memcpy(new_memmap + (count * memmap.desc_size), md,
736 status = phys_efi_set_virtual_address_map(
737 memmap.desc_size * count,
740 (efi_memory_desc_t *)__pa(new_memmap));
742 if (status != EFI_SUCCESS) {
743 printk(KERN_ALERT "Unable to switch EFI into virtual mode "
744 "(status=%lx)!\n", status);
745 panic("EFI call to SetVirtualAddressMap() failed!");
749 * Thankfully, it does seem that no runtime services other than
750 * SetVirtualAddressMap() will touch boot services code, so we can
751 * get rid of it all at this point
753 efi_free_boot_services();
756 * Now that EFI is in virtual mode, update the function
757 * pointers in the runtime service table to the new virtual addresses.
759 * Call EFI services through wrapper functions.
761 efi.runtime_version = efi_systab.hdr.revision;
762 efi.get_time = virt_efi_get_time;
763 efi.set_time = virt_efi_set_time;
764 efi.get_wakeup_time = virt_efi_get_wakeup_time;
765 efi.set_wakeup_time = virt_efi_set_wakeup_time;
766 efi.get_variable = virt_efi_get_variable;
767 efi.get_next_variable = virt_efi_get_next_variable;
768 efi.set_variable = virt_efi_set_variable;
769 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
770 efi.reset_system = virt_efi_reset_system;
771 efi.set_virtual_address_map = NULL;
772 efi.query_variable_info = virt_efi_query_variable_info;
773 efi.update_capsule = virt_efi_update_capsule;
774 efi.query_capsule_caps = virt_efi_query_capsule_caps;
775 if (__supported_pte_mask & _PAGE_NX)
776 runtime_code_page_mkexec();
777 clear_bit(EFI_MEMMAP, &x86_efi_facility);
778 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
784 * Convenience functions to obtain memory types and attributes
786 u32 efi_mem_type(unsigned long phys_addr)
788 efi_memory_desc_t *md;
791 if (!efi_enabled(EFI_MEMMAP))
794 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
796 if ((md->phys_addr <= phys_addr) &&
797 (phys_addr < (md->phys_addr +
798 (md->num_pages << EFI_PAGE_SHIFT))))
804 u64 efi_mem_attributes(unsigned long phys_addr)
806 efi_memory_desc_t *md;
809 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
811 if ((md->phys_addr <= phys_addr) &&
812 (phys_addr < (md->phys_addr +
813 (md->num_pages << EFI_PAGE_SHIFT))))
814 return md->attribute;
820 * Some firmware has serious problems when using more than 50% of the EFI
821 * variable store, i.e. it triggers bugs that can brick machines. Ensure that
822 * we never use more than this safe limit.
824 * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable
827 efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
830 u64 storage_size, remaining_size, max_size;
832 status = efi.query_variable_info(attributes, &storage_size,
833 &remaining_size, &max_size);
834 if (status != EFI_SUCCESS)
837 if (!storage_size || size > remaining_size || size > max_size ||
838 (remaining_size - size) < (storage_size / 2))
839 return EFI_OUT_OF_RESOURCES;
843 EXPORT_SYMBOL_GPL(efi_query_variable_store);