qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] (What happened to the pci_databases.c?) Adding Voodoo2 em


From: Jd Lyons
Subject: Re: [Qemu-ppc] (What happened to the pci_databases.c?) Adding Voodoo2 emulation.
Date: Mon, 13 Feb 2017 19:00:38 -0500


On Feb 13, 2017, at 5:56 PM, Jd Lyons <address@hidden> wrote:

I can’t seem to find any info on adding Openbios as a submodule to qemu, can you give me any information on that?


On Feb 13, 2017, at 4:24 PM, Mark Cave-Ayland <address@hidden> wrote:

On 13/02/17 18:13, Jd Lyons wrote:

Do you have a git repository somewhere showing your changes to both
OpenBIOS and QEMU? It's a bit difficult to provide some pointers when
it's not possible to see how far you've got.

I’ve not gotten very far, I’m just enumerating the device on the device
tree. I haven’t done anything about emulating the Voodoo2 Chipset,
itself. I’m not really a programmer, more of a hacker. I figured first
step is to get the pci121a,2 into the device tree, then get the OS 9
Voodoo Extension to load, then work on emulating the actual Voodoo chip,
ram, and ringbus, the the second may not be possible without the third.
I don’t really understand how Driver Matching works in the classic Mac
OS’s. I know I can hand OS X the ATY, Rage 128 Pro, in the device tree,
and it loads the drivers, even the OpenGL drivers, but I have done
nothing about emulating the actual Rage 128 Chip.

If you've changed the PCI vendor/device id in QEMU then you'll need to
do the same in OpenBIOS:

static const pci_dev_t vga_devices[] = {
   {
       PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RAGE128_PF,
       NULL, "ATY",      "ATY Rage128", "VGA\0",
       0, 0, 0,
       NULL, NULL,
   },
   {
       PCI_VENDOR_ID_QEMU, PCI_DEVICE_ID_QEMU_VGA,
       NULL, "QEMU,VGA", "Qemu VGA",    "VGA\0",
       0, 0, 0,
       NULL, NULL,
   },
Add, something like:

 {
       PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_Voodoo2,
       NULL, “3DFX,Voodoo2", “3DFX_Voodoo2",    
       0, 0, 0,
       NULL, NULL,
   },

I’ve tried that in the source code I have that includes OpenBios, but it doesn’t seem to do anything. I think this code sets the .name property in Openbios, but I sill get pci121a,2, which should be ok, because the Voodoo2 didn’t have a Option Rom, so there’s no FCode to set  that property anyway.

   {
       0xFFFF, 0xFFFF,
       NULL, NULL, NULL, NULL,
       -1, -1, -1,
       NULL, NULL,
   },
};

For starters if you've simply changed the IDs in QEMU, change the
corresponding values for QEMU,VGA in the section above to make sure that
OpenBIOS initialises the display correctly (don't worry about the
PCI_SUBCLASS_DISPLAY_3D for the moment) and that should get you further.

The key part is to check with ".properties" that the PCI device has the
correct vendor/device IDs along with a "display" device_type property.
If the display doesn't initialise correctly then you should still be
able to test this by starting QEMU with -nographic.


Thanks for the -nographic tip, should come in handy, do you know the shut-down command for Openbios, I can’t seem to figure that one out?

I can’t seem to set the Revision ID, I found some info on the PCI Configuration Registers in Bochs voodoo2 emulation:

  v = new voodoo_state;
  Bit8u model = (Bit8u)SIM->get_param_enum("model", base)->get();
  if (model == VOODOO_2) {
    init_pci_conf(0x121a, 0x0002, 0x02, 0x038000, 0x00);
    BX_VOODOO_THIS pci_conf[0x10] = 0x08;
  } else {
    init_pci_conf(0x121a, 0x0001, 0x02, 0x000000, 0x00);
  }
  BX_VOODOO_THIS pci_conf[0x3d] = BX_PCI_INTA;
  BX_VOODOO_THIS pci_base_address[0] = 0;

  voodoo_init(model);

Obviously, 0x121a is the Vendor ID, and 0x0002 is the Device ID, 0x038000 must be the Class-code, and I’m not sure if 0x02 is the Sub-device ID or the Sub-System ID, I think 0x00 is the Revision ID.

Not sure how to set the revision ID, or the Sub-device ID, I tried:

diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index ac9a764..6537a19 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -357,8 +357,13 @@ static void secondary_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->vendor_id = PCI_VENDOR_ID_3DFX;
+    k->device_id = PCI_DEVICE_ID_3DFX_Voodoo2;
     k->realize = pci_secondary_vga_realize;
     k->class_id = PCI_CLASS_DISPLAY_OTHER;
+    k->subclass_id = PCI_SUBCLASS_DISPLAY_3D;
+    k->revision_id = PCI_VOODOO2_REVISION;
+    k->subsystem_id = PCI_SUBSYSTEM_ID_VOODOO2;
     dc->props = secondary_pci_properties;
     dc->reset = pci_secondary_vga_reset;
 }
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index a563555..42a071d 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -177,8 +177,8 @@ static void pci_irq_handler(void *opaque, int irq_num, int level);
 static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, Error **);
 static void pci_del_option_rom(PCIDevice *pdev);
 
-static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET;
-static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU;
+static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_3DFX;
+static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_Voodoo2;
 
 static QLIST_HEAD(, PCIHostState) pci_host_bridges;
 
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index cbc1fdf..ce6ab6c 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -55,6 +55,16 @@
 #define PCI_VENDOR_ID_QEMU               0x1234
 #define PCI_DEVICE_ID_QEMU_VGA           0x1111
 
+/*_3DFX_Voodoo2(0x121a)  */
+#define PCI_VENDOR_ID_3DFX               0x121a
+#define PCI_DEVICE_ID_3DFX_Voodoo2       0x0002
+#define PCI_SUBCLASS_DISPLAY_3D          0x02
+#define PCI_SUBVENDOR_ID_3DFX            0x121a
+#define PCI_SUBDEVICE_ID_Voodoo2         0x02
+#define PCI_VOODOO2_REVISION             0x00
+#define PCI_SUBSYSTEM_ID_VOODOO2         0x0200
+
+
 /* VMWare (0x15ad) */
 #define PCI_VENDOR_ID_VMWARE             0x15ad
 #define PCI_DEVICE_ID_VMWARE_SVGA2       0x0405
@@ -75,6 +85,7 @@
 #define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
 #define PCI_SUBDEVICE_ID_QEMU            0x1100
 
+
 #define PCI_DEVICE_ID_VIRTIO_NET         0x1000
 #define PCI_DEVICE_ID_VIRTIO_BLOCK       0x1001
 #define PCI_DEVICE_ID_VIRTIO_BALLOON     0x1002
@@ -213,7 +224,9 @@ typedef struct PCIDeviceClass {
     uint16_t vendor_id;
     uint16_t device_id;
     uint8_t revision;
+    uint8_t revision_id;
     uint16_t class_id;
+    uint16_t subclass_id;
     uint16_t subsystem_vendor_id;       /* only for header type = 0 */
     uint16_t subsystem_id;              /* only for header type = 0 */
 
@@ -525,12 +538,24 @@ pci_config_set_device_id(uint8_t *pci_config, uint16_t val)
 }
 
 static inline void
+pci_config_set_subclass_id(uint8_t *pci_config, uint16_t val)
+{
+    pci_set_word(&pci_config[PCI_DEVICE_ID], val);
+}
+
+static inline void
 pci_config_set_revision(uint8_t *pci_config, uint8_t val)
 {
     pci_set_byte(&pci_config[PCI_REVISION_ID], val);
 }
 
 static inline void
+pci_config_set_revision_id(uint8_t *pci_config, uint8_t val)
+{
+    pci_set_byte(&pci_config[PCI_REVISION_ID], val);
+}
+
+static inline void
 pci_config_set_class(uint8_t *pci_config, uint16_t val)
 {
     pci_set_word(&pci_config[PCI_CLASS_DEVICE], val);
(END)

But I don’t get any .property for the Sub_Class_ID in Opennbios, or Display Name Registry in the Mac OS, nor does the Revision ID change, it stays 2, even tho I’m trying to set it to 0x00?

  


ATB,

Mark.


Thanks Mark,

JD

I found the Voodoo2 Databook:

http://ohwc.narod.ru/video/3dfx/v2_voodoo2_spec.pdf


6. PCI CONFIGURATION REGISTER SET ..............................................................................................102

  1. 6.1  VENDOR_ID REGISTER .............................................................................................................................102

  2. 6.2  DEVICE_ID REGISTER...............................................................................................................................102

  3. 6.3  COMMAND REGISTER ................................................................................................................................102

  4. 6.4  STATUS REGISTER .....................................................................................................................................103

  5. 6.5  REVISION_ID REGISTER............................................................................................................................103

  6. 6.6  CLASS_CODE REGISTER ............................................................................................................................104

  7. 6.7  CACHE_LINE_SIZE REGISTER.....................................................................................................................104

  8. 6.8  LATENCY_TIMER REGISTER .......................................................................................................................104

  9. 6.9  HEADER_TYPE REGISTER ..........................................................................................................................104

  10. 6.10  BIST REGISTER ........................................................................................................................................104

  11. 6.11  MEMBASEADDR REGISTER ........................................................................................................................104

  12. 6.12  INTERRUPT_LINE REGISTER.......................................................................................................................105

  13. 6.13  INTERRUPT_PIN REGISTER.........................................................................................................................105

  14. 6.14  MIN_GNT REGISTER .................................................................................................................................105

  15. 6.15  MAX_LAT REGISTER .................................................................................................................................105

  16. 6.16  INITENABLE REGISTER ..............................................................................................................................106

  17. 6.17  BUSSNOOP0 AND BUSSNOOP1 REGISTERS ..................................................................................................107

  18. 6.18  CFGSTATUS REGISTER ...............................................................................................................................107

  19. 6.19  CFGSCRATCH REGISTER ............................................................................................................................107

            6.20 SIPROCESS REGISTER ................................................................................................................................107 


Doesn’t seem to have any info on the Sub-Device ID, Sub-Vendor ID, or any Sub-Class ID?


  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]