qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg
@ 2013-05-30  9:30 Michael S. Tsirkin
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge Michael S. Tsirkin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2013-05-30  9:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

Here are some patches fixing up minor issues
in the tree reorganization.

Michael S. Tsirkin (2):
  dec.c - move to pci-bridge
  firmware_abi: move to include/hw/nvram/

 hw/pci-bridge/Makefile.objs              |   2 +
 hw/pci-bridge/dec.c                      | 156 +++++++++++++++++++++++++++++++
 hw/pci-bridge/dec.h                      |  10 ++
 hw/pci-host/Makefile.objs                |   1 -
 hw/pci-host/dec.c                        | 156 -------------------------------
 hw/pci-host/dec.h                        |  10 --
 hw/sparc/sun4m.c                         |   2 +-
 hw/sparc64/sun4u.c                       |   2 +-
 include/hw/nvram/openbios_firmware_abi.h |  73 +++++++++++++++
 include/hw/sparc/firmware_abi.h          |  73 ---------------
 10 files changed, 243 insertions(+), 242 deletions(-)
 create mode 100644 hw/pci-bridge/dec.c
 create mode 100644 hw/pci-bridge/dec.h
 delete mode 100644 hw/pci-host/dec.c
 delete mode 100644 hw/pci-host/dec.h
 create mode 100644 include/hw/nvram/openbios_firmware_abi.h
 delete mode 100644 include/hw/sparc/firmware_abi.h

-- 
MST

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge
  2013-05-30  9:30 [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Michael S. Tsirkin
@ 2013-05-30  9:30 ` Michael S. Tsirkin
  2013-05-30 15:27   ` Andreas Färber
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/ Michael S. Tsirkin
  2013-05-30 13:04 ` [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Paolo Bonzini
  2 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2013-05-30  9:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?=

Looks like dec.c is in pci-host by mistake.
Moving it over to pci-bridge.

Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci-bridge/Makefile.objs |   2 +
 hw/pci-bridge/dec.c         | 156 ++++++++++++++++++++++++++++++++++++++++++++
 hw/pci-bridge/dec.h         |  10 +++
 hw/pci-host/Makefile.objs   |   1 -
 hw/pci-host/dec.c           | 156 --------------------------------------------
 hw/pci-host/dec.h           |  10 ---
 6 files changed, 168 insertions(+), 167 deletions(-)
 create mode 100644 hw/pci-bridge/dec.c
 create mode 100644 hw/pci-bridge/dec.h
 delete mode 100644 hw/pci-host/dec.c
 delete mode 100644 hw/pci-host/dec.h

diff --git a/hw/pci-bridge/Makefile.objs b/hw/pci-bridge/Makefile.objs
index 5dd92d2..968b369 100644
--- a/hw/pci-bridge/Makefile.objs
+++ b/hw/pci-bridge/Makefile.objs
@@ -1,3 +1,5 @@
 common-obj-y += pci_bridge_dev.o
 common-obj-y += ioh3420.o xio3130_upstream.o xio3130_downstream.o
 common-obj-y += i82801b11.o
+# NewWorld PowerMac
+common-obj-$(CONFIG_DEC_PCI) += dec.o
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
new file mode 100644
index 0000000..cff458b
--- /dev/null
+++ b/hw/pci-bridge/dec.c
@@ -0,0 +1,156 @@
+/*
+ * QEMU DEC 21154 PCI bridge
+ *
+ * Copyright (c) 2006-2007 Fabrice Bellard
+ * Copyright (c) 2007 Jocelyn Mayer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "dec.h"
+#include "hw/sysbus.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_host.h"
+#include "hw/pci/pci_bridge.h"
+#include "hw/pci/pci_bus.h"
+
+/* debug DEC */
+//#define DEBUG_DEC
+
+#ifdef DEBUG_DEC
+#define DEC_DPRINTF(fmt, ...)                               \
+    do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DEC_DPRINTF(fmt, ...)
+#endif
+
+#define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154)
+
+typedef struct DECState {
+    PCIHostState parent_obj;
+} DECState;
+
+static int dec_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
+static int dec_pci_bridge_initfn(PCIDevice *pci_dev)
+{
+    return pci_bridge_initfn(pci_dev, TYPE_PCI_BUS);
+}
+
+static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = dec_pci_bridge_initfn;
+    k->exit = pci_bridge_exitfn;
+    k->vendor_id = PCI_VENDOR_ID_DEC;
+    k->device_id = PCI_DEVICE_ID_DEC_21154;
+    k->config_write = pci_bridge_write_config;
+    k->is_bridge = 1;
+    dc->desc = "DEC 21154 PCI-PCI bridge";
+    dc->reset = pci_bridge_reset;
+    dc->vmsd = &vmstate_pci_device;
+}
+
+static const TypeInfo dec_21154_pci_bridge_info = {
+    .name          = "dec-21154-p2p-bridge",
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(PCIBridge),
+    .class_init    = dec_21154_pci_bridge_class_init,
+};
+
+PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
+{
+    PCIDevice *dev;
+    PCIBridge *br;
+
+    dev = pci_create_multifunction(parent_bus, devfn, false,
+                                   "dec-21154-p2p-bridge");
+    br = DO_UPCAST(PCIBridge, dev, dev);
+    pci_bridge_map_irq(br, "DEC 21154 PCI-PCI bridge", dec_map_irq);
+    qdev_init_nofail(&dev->qdev);
+    return pci_bridge_get_sec_bus(br);
+}
+
+static int pci_dec_21154_device_init(SysBusDevice *dev)
+{
+    PCIHostState *phb;
+
+    phb = PCI_HOST_BRIDGE(dev);
+
+    memory_region_init_io(&phb->conf_mem, &pci_host_conf_le_ops,
+                          dev, "pci-conf-idx", 0x1000);
+    memory_region_init_io(&phb->data_mem, &pci_host_data_le_ops,
+                          dev, "pci-data-idx", 0x1000);
+    sysbus_init_mmio(dev, &phb->conf_mem);
+    sysbus_init_mmio(dev, &phb->data_mem);
+    return 0;
+}
+
+static int dec_21154_pci_host_init(PCIDevice *d)
+{
+    /* PCI2PCI bridge same values as PearPC - check this */
+    return 0;
+}
+
+static void dec_21154_pci_host_class_init(ObjectClass *klass, void *data)
+{
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->init = dec_21154_pci_host_init;
+    k->vendor_id = PCI_VENDOR_ID_DEC;
+    k->device_id = PCI_DEVICE_ID_DEC_21154;
+    k->revision = 0x02;
+    k->class_id = PCI_CLASS_BRIDGE_PCI;
+    k->is_bridge = 1;
+}
+
+static const TypeInfo dec_21154_pci_host_info = {
+    .name          = "dec-21154",
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(PCIDevice),
+    .class_init    = dec_21154_pci_host_class_init,
+};
+
+static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
+{
+    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+
+    sdc->init = pci_dec_21154_device_init;
+}
+
+static const TypeInfo pci_dec_21154_device_info = {
+    .name          = TYPE_DEC_21154,
+    .parent        = TYPE_PCI_HOST_BRIDGE,
+    .instance_size = sizeof(DECState),
+    .class_init    = pci_dec_21154_device_class_init,
+};
+
+static void dec_register_types(void)
+{
+    type_register_static(&pci_dec_21154_device_info);
+    type_register_static(&dec_21154_pci_host_info);
+    type_register_static(&dec_21154_pci_bridge_info);
+}
+
+type_init(dec_register_types)
diff --git a/hw/pci-bridge/dec.h b/hw/pci-bridge/dec.h
new file mode 100644
index 0000000..17dc0c2
--- /dev/null
+++ b/hw/pci-bridge/dec.h
@@ -0,0 +1,10 @@
+#ifndef DEC_PCI_H
+#define DEC_PCI_H
+
+#include "qemu-common.h"
+
+#define TYPE_DEC_21154 "dec-21154-sysbus"
+
+PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn);
+
+#endif
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index 909e702..bb65f9c 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -5,7 +5,6 @@ common-obj-$(CONFIG_PREP_PCI) += prep.o
 common-obj-$(CONFIG_GRACKLE_PCI) += grackle.o
 # NewWorld PowerMac
 common-obj-$(CONFIG_UNIN_PCI) += uninorth.o
-common-obj-$(CONFIG_DEC_PCI) += dec.o
 # PowerPC E500 boards
 common-obj-$(CONFIG_PPCE500_PCI) += ppce500.o
 
diff --git a/hw/pci-host/dec.c b/hw/pci-host/dec.c
deleted file mode 100644
index cff458b..0000000
--- a/hw/pci-host/dec.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * QEMU DEC 21154 PCI bridge
- *
- * Copyright (c) 2006-2007 Fabrice Bellard
- * Copyright (c) 2007 Jocelyn Mayer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "dec.h"
-#include "hw/sysbus.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pci_host.h"
-#include "hw/pci/pci_bridge.h"
-#include "hw/pci/pci_bus.h"
-
-/* debug DEC */
-//#define DEBUG_DEC
-
-#ifdef DEBUG_DEC
-#define DEC_DPRINTF(fmt, ...)                               \
-    do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DEC_DPRINTF(fmt, ...)
-#endif
-
-#define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154)
-
-typedef struct DECState {
-    PCIHostState parent_obj;
-} DECState;
-
-static int dec_map_irq(PCIDevice *pci_dev, int irq_num)
-{
-    return irq_num;
-}
-
-static int dec_pci_bridge_initfn(PCIDevice *pci_dev)
-{
-    return pci_bridge_initfn(pci_dev, TYPE_PCI_BUS);
-}
-
-static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->init = dec_pci_bridge_initfn;
-    k->exit = pci_bridge_exitfn;
-    k->vendor_id = PCI_VENDOR_ID_DEC;
-    k->device_id = PCI_DEVICE_ID_DEC_21154;
-    k->config_write = pci_bridge_write_config;
-    k->is_bridge = 1;
-    dc->desc = "DEC 21154 PCI-PCI bridge";
-    dc->reset = pci_bridge_reset;
-    dc->vmsd = &vmstate_pci_device;
-}
-
-static const TypeInfo dec_21154_pci_bridge_info = {
-    .name          = "dec-21154-p2p-bridge",
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(PCIBridge),
-    .class_init    = dec_21154_pci_bridge_class_init,
-};
-
-PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
-{
-    PCIDevice *dev;
-    PCIBridge *br;
-
-    dev = pci_create_multifunction(parent_bus, devfn, false,
-                                   "dec-21154-p2p-bridge");
-    br = DO_UPCAST(PCIBridge, dev, dev);
-    pci_bridge_map_irq(br, "DEC 21154 PCI-PCI bridge", dec_map_irq);
-    qdev_init_nofail(&dev->qdev);
-    return pci_bridge_get_sec_bus(br);
-}
-
-static int pci_dec_21154_device_init(SysBusDevice *dev)
-{
-    PCIHostState *phb;
-
-    phb = PCI_HOST_BRIDGE(dev);
-
-    memory_region_init_io(&phb->conf_mem, &pci_host_conf_le_ops,
-                          dev, "pci-conf-idx", 0x1000);
-    memory_region_init_io(&phb->data_mem, &pci_host_data_le_ops,
-                          dev, "pci-data-idx", 0x1000);
-    sysbus_init_mmio(dev, &phb->conf_mem);
-    sysbus_init_mmio(dev, &phb->data_mem);
-    return 0;
-}
-
-static int dec_21154_pci_host_init(PCIDevice *d)
-{
-    /* PCI2PCI bridge same values as PearPC - check this */
-    return 0;
-}
-
-static void dec_21154_pci_host_class_init(ObjectClass *klass, void *data)
-{
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->init = dec_21154_pci_host_init;
-    k->vendor_id = PCI_VENDOR_ID_DEC;
-    k->device_id = PCI_DEVICE_ID_DEC_21154;
-    k->revision = 0x02;
-    k->class_id = PCI_CLASS_BRIDGE_PCI;
-    k->is_bridge = 1;
-}
-
-static const TypeInfo dec_21154_pci_host_info = {
-    .name          = "dec-21154",
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(PCIDevice),
-    .class_init    = dec_21154_pci_host_class_init,
-};
-
-static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
-{
-    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
-
-    sdc->init = pci_dec_21154_device_init;
-}
-
-static const TypeInfo pci_dec_21154_device_info = {
-    .name          = TYPE_DEC_21154,
-    .parent        = TYPE_PCI_HOST_BRIDGE,
-    .instance_size = sizeof(DECState),
-    .class_init    = pci_dec_21154_device_class_init,
-};
-
-static void dec_register_types(void)
-{
-    type_register_static(&pci_dec_21154_device_info);
-    type_register_static(&dec_21154_pci_host_info);
-    type_register_static(&dec_21154_pci_bridge_info);
-}
-
-type_init(dec_register_types)
diff --git a/hw/pci-host/dec.h b/hw/pci-host/dec.h
deleted file mode 100644
index 17dc0c2..0000000
--- a/hw/pci-host/dec.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef DEC_PCI_H
-#define DEC_PCI_H
-
-#include "qemu-common.h"
-
-#define TYPE_DEC_21154 "dec-21154-sysbus"
-
-PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn);
-
-#endif
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/
  2013-05-30  9:30 [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Michael S. Tsirkin
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge Michael S. Tsirkin
@ 2013-05-30  9:30 ` Michael S. Tsirkin
  2013-05-30 15:29   ` Andreas Färber
  2013-05-30 13:04 ` [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Paolo Bonzini
  2 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2013-05-30  9:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, =?UTF-8?q?Andreas=20F=C3=A4rber?=

firmware_abi.h with structs for OpenBIOS landed in hw/sparc/ by mistake
- move it to hw/nvram/ alongside fw_cfg.h.  In addition to sparc it's
included from ppc mac_nvram.c and will need to include it from prep.c in
the future.

Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/sparc/sun4m.c                         |  2 +-
 hw/sparc64/sun4u.c                       |  2 +-
 include/hw/nvram/openbios_firmware_abi.h | 73 ++++++++++++++++++++++++++++++++
 include/hw/sparc/firmware_abi.h          | 73 --------------------------------
 4 files changed, 75 insertions(+), 75 deletions(-)
 create mode 100644 include/hw/nvram/openbios_firmware_abi.h
 delete mode 100644 include/hw/sparc/firmware_abi.h

diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 8840881..6e62d17 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -30,7 +30,7 @@
 #include "sysemu/sysemu.h"
 #include "net/net.h"
 #include "hw/boards.h"
-#include "hw/sparc/firmware_abi.h"
+#include "hw/nvram/openbios_firmware_abi.h"
 #include "hw/scsi/esp.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 5c2bbd4..13672de 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -32,7 +32,7 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
-#include "hw/sparc/firmware_abi.h"
+#include "hw/nvram/openbios_firmware_abi.h"
 #include "hw/nvram/fw_cfg.h"
 #include "hw/sysbus.h"
 #include "hw/ide.h"
diff --git a/include/hw/nvram/openbios_firmware_abi.h b/include/hw/nvram/openbios_firmware_abi.h
new file mode 100644
index 0000000..5e6e5d4
--- /dev/null
+++ b/include/hw/nvram/openbios_firmware_abi.h
@@ -0,0 +1,73 @@
+#ifndef FIRMWARE_ABI_H
+#define FIRMWARE_ABI_H
+
+/* OpenBIOS NVRAM partition */
+struct OpenBIOS_nvpart_v1 {
+    uint8_t signature;
+    uint8_t checksum;
+    uint16_t len; // BE, length divided by 16
+    char name[12];
+};
+
+#define OPENBIOS_PART_SYSTEM 0x70
+#define OPENBIOS_PART_FREE 0x7f
+
+static inline void
+OpenBIOS_finish_partition(struct OpenBIOS_nvpart_v1 *header, uint32_t size)
+{
+    unsigned int i, sum;
+    uint8_t *tmpptr;
+
+    // Length divided by 16
+    header->len = cpu_to_be16(size >> 4);
+
+    // Checksum
+    tmpptr = (uint8_t *)header;
+    sum = *tmpptr;
+    for (i = 0; i < 14; i++) {
+        sum += tmpptr[2 + i];
+        sum = (sum + ((sum & 0xff00) >> 8)) & 0xff;
+    }
+    header->checksum = sum & 0xff;
+}
+
+static inline uint32_t
+OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const char *str)
+{
+    uint32_t len;
+
+    len = strlen(str) + 1;
+    memcpy(&nvram[addr], str, len);
+
+    return addr + len;
+}
+
+/* Sun IDPROM structure at the end of NVRAM */
+/* from http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html */
+struct Sun_nvram {
+    uint8_t type;       /* always 01 */
+    uint8_t machine_id; /* first byte of host id (machine type) */
+    uint8_t macaddr[6]; /* 6 byte ethernet address (first 3 bytes 08, 00, 20) */
+    uint8_t date[4];    /* date of manufacture */
+    uint8_t hostid[3];  /* remaining 3 bytes of host id (serial number) */
+    uint8_t checksum;   /* bitwise xor of previous bytes */
+};
+
+static inline void
+Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, int machine_id)
+{
+    uint8_t tmp, *tmpptr;
+    unsigned int i;
+
+    header->type = 1;
+    header->machine_id = machine_id & 0xff;
+    memcpy(&header->macaddr, macaddr, 6);
+    /* Calculate checksum */
+    tmp = 0;
+    tmpptr = (uint8_t *)header;
+    for (i = 0; i < 15; i++)
+        tmp ^= tmpptr[i];
+
+    header->checksum = tmp;
+}
+#endif /* FIRMWARE_ABI_H */
diff --git a/include/hw/sparc/firmware_abi.h b/include/hw/sparc/firmware_abi.h
deleted file mode 100644
index 5e6e5d4..0000000
--- a/include/hw/sparc/firmware_abi.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef FIRMWARE_ABI_H
-#define FIRMWARE_ABI_H
-
-/* OpenBIOS NVRAM partition */
-struct OpenBIOS_nvpart_v1 {
-    uint8_t signature;
-    uint8_t checksum;
-    uint16_t len; // BE, length divided by 16
-    char name[12];
-};
-
-#define OPENBIOS_PART_SYSTEM 0x70
-#define OPENBIOS_PART_FREE 0x7f
-
-static inline void
-OpenBIOS_finish_partition(struct OpenBIOS_nvpart_v1 *header, uint32_t size)
-{
-    unsigned int i, sum;
-    uint8_t *tmpptr;
-
-    // Length divided by 16
-    header->len = cpu_to_be16(size >> 4);
-
-    // Checksum
-    tmpptr = (uint8_t *)header;
-    sum = *tmpptr;
-    for (i = 0; i < 14; i++) {
-        sum += tmpptr[2 + i];
-        sum = (sum + ((sum & 0xff00) >> 8)) & 0xff;
-    }
-    header->checksum = sum & 0xff;
-}
-
-static inline uint32_t
-OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const char *str)
-{
-    uint32_t len;
-
-    len = strlen(str) + 1;
-    memcpy(&nvram[addr], str, len);
-
-    return addr + len;
-}
-
-/* Sun IDPROM structure at the end of NVRAM */
-/* from http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html */
-struct Sun_nvram {
-    uint8_t type;       /* always 01 */
-    uint8_t machine_id; /* first byte of host id (machine type) */
-    uint8_t macaddr[6]; /* 6 byte ethernet address (first 3 bytes 08, 00, 20) */
-    uint8_t date[4];    /* date of manufacture */
-    uint8_t hostid[3];  /* remaining 3 bytes of host id (serial number) */
-    uint8_t checksum;   /* bitwise xor of previous bytes */
-};
-
-static inline void
-Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, int machine_id)
-{
-    uint8_t tmp, *tmpptr;
-    unsigned int i;
-
-    header->type = 1;
-    header->machine_id = machine_id & 0xff;
-    memcpy(&header->macaddr, macaddr, 6);
-    /* Calculate checksum */
-    tmp = 0;
-    tmpptr = (uint8_t *)header;
-    for (i = 0; i < 15; i++)
-        tmp ^= tmpptr[i];
-
-    header->checksum = tmp;
-}
-#endif /* FIRMWARE_ABI_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg
  2013-05-30  9:30 [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Michael S. Tsirkin
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge Michael S. Tsirkin
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/ Michael S. Tsirkin
@ 2013-05-30 13:04 ` Paolo Bonzini
  2013-05-30 13:07   ` Michael S. Tsirkin
  2 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2013-05-30 13:04 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

Il 30/05/2013 11:30, Michael S. Tsirkin ha scritto:
> Here are some patches fixing up minor issues
> in the tree reorganization.
> 
> Michael S. Tsirkin (2):
>   dec.c - move to pci-bridge
>   firmware_abi: move to include/hw/nvram/
> 
>  hw/pci-bridge/Makefile.objs              |   2 +
>  hw/pci-bridge/dec.c                      | 156 +++++++++++++++++++++++++++++++
>  hw/pci-bridge/dec.h                      |  10 ++
>  hw/pci-host/Makefile.objs                |   1 -
>  hw/pci-host/dec.c                        | 156 -------------------------------
>  hw/pci-host/dec.h                        |  10 --
>  hw/sparc/sun4m.c                         |   2 +-
>  hw/sparc64/sun4u.c                       |   2 +-
>  include/hw/nvram/openbios_firmware_abi.h |  73 +++++++++++++++
>  include/hw/sparc/firmware_abi.h          |  73 ---------------
>  10 files changed, 243 insertions(+), 242 deletions(-)
>  create mode 100644 hw/pci-bridge/dec.c
>  create mode 100644 hw/pci-bridge/dec.h
>  delete mode 100644 hw/pci-host/dec.c
>  delete mode 100644 hw/pci-host/dec.h
>  create mode 100644 include/hw/nvram/openbios_firmware_abi.h
>  delete mode 100644 include/hw/sparc/firmware_abi.h
> 

Thanks.  Please give Blue a couple of days to comment.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg
  2013-05-30 13:04 ` [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Paolo Bonzini
@ 2013-05-30 13:07   ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2013-05-30 13:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Thu, May 30, 2013 at 03:04:39PM +0200, Paolo Bonzini wrote:
> Il 30/05/2013 11:30, Michael S. Tsirkin ha scritto:
> > Here are some patches fixing up minor issues
> > in the tree reorganization.
> > 
> > Michael S. Tsirkin (2):
> >   dec.c - move to pci-bridge
> >   firmware_abi: move to include/hw/nvram/
> > 
> >  hw/pci-bridge/Makefile.objs              |   2 +
> >  hw/pci-bridge/dec.c                      | 156 +++++++++++++++++++++++++++++++
> >  hw/pci-bridge/dec.h                      |  10 ++
> >  hw/pci-host/Makefile.objs                |   1 -
> >  hw/pci-host/dec.c                        | 156 -------------------------------
> >  hw/pci-host/dec.h                        |  10 --
> >  hw/sparc/sun4m.c                         |   2 +-
> >  hw/sparc64/sun4u.c                       |   2 +-
> >  include/hw/nvram/openbios_firmware_abi.h |  73 +++++++++++++++
> >  include/hw/sparc/firmware_abi.h          |  73 ---------------
> >  10 files changed, 243 insertions(+), 242 deletions(-)
> >  create mode 100644 hw/pci-bridge/dec.c
> >  create mode 100644 hw/pci-bridge/dec.h
> >  delete mode 100644 hw/pci-host/dec.c
> >  delete mode 100644 hw/pci-host/dec.h
> >  create mode 100644 include/hw/nvram/openbios_firmware_abi.h
> >  delete mode 100644 include/hw/sparc/firmware_abi.h
> > 
> 
> Thanks.  Please give Blue a couple of days to comment.
> 
> Paolo

I always do this: pci tree tip is documented as
being rebased so I drop stuff from there
if there are nacks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge Michael S. Tsirkin
@ 2013-05-30 15:27   ` Andreas Färber
  2013-05-30 17:37     ` Michael S. Tsirkin
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2013-05-30 15:27 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

Am 30.05.2013 11:30, schrieb Michael S. Tsirkin:
> Looks like dec.c is in pci-host by mistake.
> Moving it over to pci-bridge.
> 
> Cc: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/pci-bridge/Makefile.objs |   2 +
>  hw/pci-bridge/dec.c         | 156 ++++++++++++++++++++++++++++++++++++++++++++
>  hw/pci-bridge/dec.h         |  10 +++
>  hw/pci-host/Makefile.objs   |   1 -
>  hw/pci-host/dec.c           | 156 --------------------------------------------
>  hw/pci-host/dec.h           |  10 ---
>  6 files changed, 168 insertions(+), 167 deletions(-)
>  create mode 100644 hw/pci-bridge/dec.c
>  create mode 100644 hw/pci-bridge/dec.h
>  delete mode 100644 hw/pci-host/dec.c
>  delete mode 100644 hw/pci-host/dec.h

Unfortunately you seem to have rename detection disabled - if this is
just a move of the file with includes adjusted then

Acked-by: Andreas Färber <afaerber@suse.de>

Otherwise please supply a "readable" diff or point to a Git branch where
we can check.

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/
  2013-05-30  9:30 ` [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/ Michael S. Tsirkin
@ 2013-05-30 15:29   ` Andreas Färber
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Färber @ 2013-05-30 15:29 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Blue Swirl, qemu-devel

Am 30.05.2013 11:30, schrieb Michael S. Tsirkin:
> firmware_abi.h with structs for OpenBIOS landed in hw/sparc/ by mistake
> - move it to hw/nvram/ alongside fw_cfg.h.  In addition to sparc it's
> included from ppc mac_nvram.c and will need to include it from prep.c in
> the future.
> 
> Cc: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/sparc/sun4m.c                         |  2 +-
>  hw/sparc64/sun4u.c                       |  2 +-
>  include/hw/nvram/openbios_firmware_abi.h | 73 ++++++++++++++++++++++++++++++++
>  include/hw/sparc/firmware_abi.h          | 73 --------------------------------
>  4 files changed, 75 insertions(+), 75 deletions(-)
>  create mode 100644 include/hw/nvram/openbios_firmware_abi.h
>  delete mode 100644 include/hw/sparc/firmware_abi.h

Thanks for picking my suggestion up! Same applies as for other patch: In
general

Acked-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge
  2013-05-30 15:27   ` Andreas Färber
@ 2013-05-30 17:37     ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2013-05-30 17:37 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

On Thu, May 30, 2013 at 05:27:46PM +0200, Andreas Färber wrote:
> Am 30.05.2013 11:30, schrieb Michael S. Tsirkin:
> > Looks like dec.c is in pci-host by mistake.
> > Moving it over to pci-bridge.
> > 
> > Cc: Andreas Färber <afaerber@suse.de>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  hw/pci-bridge/Makefile.objs |   2 +
> >  hw/pci-bridge/dec.c         | 156 ++++++++++++++++++++++++++++++++++++++++++++
> >  hw/pci-bridge/dec.h         |  10 +++
> >  hw/pci-host/Makefile.objs   |   1 -
> >  hw/pci-host/dec.c           | 156 --------------------------------------------
> >  hw/pci-host/dec.h           |  10 ---
> >  6 files changed, 168 insertions(+), 167 deletions(-)
> >  create mode 100644 hw/pci-bridge/dec.c
> >  create mode 100644 hw/pci-bridge/dec.h
> >  delete mode 100644 hw/pci-host/dec.c
> >  delete mode 100644 hw/pci-host/dec.h
> 
> Unfortunately you seem to have rename detection disabled - if this is
> just a move of the file with includes adjusted then
> 
> Acked-by: Andreas Färber <afaerber@suse.de>
> 
> Otherwise please supply a "readable" diff or point to a Git branch where
> we can check.
> 
> Thanks,
> Andreas

True. It will be readable in the pull request.

> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-30 17:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30  9:30 [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Michael S. Tsirkin
2013-05-30  9:30 ` [Qemu-devel] [PATCH 1/2] dec.c - move to pci-bridge Michael S. Tsirkin
2013-05-30 15:27   ` Andreas Färber
2013-05-30 17:37     ` Michael S. Tsirkin
2013-05-30  9:30 ` [Qemu-devel] [PATCH 2/2] firmware_abi: move to include/hw/nvram/ Michael S. Tsirkin
2013-05-30 15:29   ` Andreas Färber
2013-05-30 13:04 ` [Qemu-devel] [PATCH 0/2] fixup some fallback from tree reorg Paolo Bonzini
2013-05-30 13:07   ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).