+ AcpiTable table = { .sig = "ERST", .rev = 1, .oem_id = oem_id,
+ .oem_table_id = oem_table_id };
+
+ bar0 = (hwaddr)pci_get_bar_addr(PCI_DEVICE(erst_dev), 0);
+ trace_acpi_erst_pci_bar_0(bar0);
+ bar1 = (hwaddr)pci_get_bar_addr(PCI_DEVICE(erst_dev), 1);
+ trace_acpi_erst_pci_bar_1(bar1);
+
+#define MASK8 0x00000000000000FFUL
+#define MASK16 0x000000000000FFFFUL
+#define MASK32 0x00000000FFFFFFFFUL
+#define MASK64 0xFFFFFFFFFFFFFFFFUL
+
+ /*
+ * Serialization Action Table
+ * The serialization action table must be generated first
+ * so that its size can be known in order to populate the
+ * Instruction Entry Count field.
+ */
+ table_instruction_data = g_array_new(FALSE, FALSE, sizeof(char));
+
+ /* Serialization Instruction Entries */
+ action = ACTION_BEGIN_WRITE_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_BEGIN_READ_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_BEGIN_CLEAR_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_END_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_SET_RECORD_OFFSET;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER , 0, 32,
+ bar0 + ERST_VALUE_OFFSET , 0, MASK32);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_EXECUTE_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_VALUE_OFFSET , ERST_EXECUTE_OPERATION_MAGIC, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_CHECK_BUSY_STATUS;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER_VALUE , 0, 32,
+ bar0 + ERST_VALUE_OFFSET, 0x01, MASK8);
+
+ action = ACTION_GET_COMMAND_STATUS;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 32,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK8);
+
+ action = ACTION_GET_RECORD_IDENTIFIER;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 64,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK64);
+
+ action = ACTION_SET_RECORD_IDENTIFIER;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER , 0, 64,
+ bar0 + ERST_VALUE_OFFSET , 0, MASK64);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_GET_RECORD_COUNT;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 32,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK32);
+
+ action = ACTION_BEGIN_DUMMY_WRITE_OPERATION;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+
+ action = ACTION_GET_ERROR_LOG_ADDRESS_RANGE;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 64,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK64);
+
+ action = ACTION_GET_ERROR_LOG_ADDRESS_LENGTH;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 64,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK32);
+
+ action = ACTION_GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 32,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK32);
+
+ action = ACTION_GET_EXECUTE_OPERATION_TIMINGS;
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_WRITE_REGISTER_VALUE, 0, 32,
+ bar0 + ERST_ACTION_OFFSET, action, MASK8);
+ build_serialization_instruction_entry(table_instruction_data,
+ action, INST_READ_REGISTER , 0, 64,
+ bar0 + ERST_VALUE_OFFSET, 0, MASK64);
+
+ /* Serialization Header */
+ acpi_table_begin(&table, table_data);
+
+ /* Serialization Header Size */
+ build_append_int_noprefix(table_data, 48, 4);
+
+ /* Reserved */
+ build_append_int_noprefix(table_data, 0, 4);
+
+ /*
+ * Instruction Entry Count
+ * Each instruction entry is 32 bytes
+ */
+ build_append_int_noprefix(table_data,
+ (table_instruction_data->len / 32), 4);
+
+ /* Serialization Instruction Entries */
+ g_array_append_vals(table_data, table_instruction_data->data,
+ table_instruction_data->len);
+ g_array_free(table_instruction_data, TRUE);
+
+ acpi_table_end(linker, &table);
+}
+
/*******************************************************************/
/*******************************************************************/
static int erst_post_load(void *opaque, int version_id)
--
1.8.3.1