diff mbox series

[v2,07/15] hw/i2c/smbus: Extract QOM ICH9 definitions to 'ich9_smbus.h'

Message ID 20240226111416.39217-8-philmd@linaro.org
State New
Headers show
Series hw/southbridge: Extract ICH9 QOM container model | expand

Commit Message

Philippe Mathieu-Daudé Feb. 26, 2024, 11:14 a.m. UTC
Expose TYPE_ICH9_SMB_DEVICE to the new "hw/i2c/ich9_smbus.h"
header.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS                           |  1 +
 include/hw/i2c/ich9_smbus.h           | 25 +++++++++++++++++++++++++
 hw/i2c/{smbus_ich9.c => ich9_smbus.c} | 15 ++-------------
 hw/i2c/meson.build                    |  2 +-
 4 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 include/hw/i2c/ich9_smbus.h
 rename hw/i2c/{smbus_ich9.c => ich9_smbus.c} (95%)
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index e3f14c28a8..0849283287 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2617,6 +2617,7 @@  F: hw/acpi/ich9*.c
 F: hw/i2c/smbus_ich9.c
 F: hw/isa/lpc_ich9.c
 F: include/hw/acpi/ich9*.h
+F: include/hw/i2c/ich9_smbus.h
 F: include/hw/southbridge/ich9.h
 
 PIIX4 South Bridge (i82371AB)
diff --git a/include/hw/i2c/ich9_smbus.h b/include/hw/i2c/ich9_smbus.h
new file mode 100644
index 0000000000..d6f46ba89c
--- /dev/null
+++ b/include/hw/i2c/ich9_smbus.h
@@ -0,0 +1,25 @@ 
+/*
+ * QEMU ICH9 SMBus emulation
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef HW_I2C_ICH9_SMBUS_H
+#define HW_I2C_ICH9_SMBUS_H
+
+#include "qom/object.h"
+#include "hw/pci/pci_device.h"
+#include "hw/i2c/pm_smbus.h"
+
+#define TYPE_ICH9_SMB_DEVICE "ICH9-SMB"
+
+OBJECT_DECLARE_SIMPLE_TYPE(ICH9SMBState, ICH9_SMB_DEVICE)
+
+struct ICH9SMBState {
+    PCIDevice dev;
+
+    bool irq_enabled;
+
+    PMSMBus smb;
+};
+
+#endif
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/ich9_smbus.c
similarity index 95%
rename from hw/i2c/smbus_ich9.c
rename to hw/i2c/ich9_smbus.c
index 208f263ac5..35f526d71c 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/ich9_smbus.c
@@ -1,5 +1,5 @@ 
 /*
- * ACPI implementation
+ * QEMU ICH9 SMBus emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
  * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
@@ -22,8 +22,7 @@ 
 
 #include "qemu/osdep.h"
 #include "qemu/range.h"
-#include "hw/i2c/pm_smbus.h"
-#include "hw/pci/pci.h"
+#include "hw/i2c/ich9_smbus.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 
@@ -31,16 +30,6 @@ 
 #include "qom/object.h"
 #include "hw/acpi/acpi_aml_interface.h"
 
-OBJECT_DECLARE_SIMPLE_TYPE(ICH9SMBState, ICH9_SMB_DEVICE)
-
-struct ICH9SMBState {
-    PCIDevice dev;
-
-    bool irq_enabled;
-
-    PMSMBus smb;
-};
-
 static bool ich9_vmstate_need_smbus(void *opaque, int version_id)
 {
     return pm_smbus_vmstate_needed();
diff --git a/hw/i2c/meson.build b/hw/i2c/meson.build
index b58bc167db..f1a122c5ec 100644
--- a/hw/i2c/meson.build
+++ b/hw/i2c/meson.build
@@ -2,7 +2,7 @@  i2c_ss = ss.source_set()
 i2c_ss.add(when: 'CONFIG_I2C', if_true: files('core.c'))
 i2c_ss.add(when: 'CONFIG_SMBUS', if_true: files('smbus_slave.c', 'smbus_master.c'))
 i2c_ss.add(when: 'CONFIG_ACPI_SMBUS', if_true: files('pm_smbus.c'))
-i2c_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('smbus_ich9.c'))
+i2c_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9_smbus.c'))
 i2c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i2c.c'))
 i2c_ss.add(when: 'CONFIG_BITBANG_I2C', if_true: files('bitbang_i2c.c'))
 i2c_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_i2c.c'))