⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ohw.diff

📁 xen虚拟机源代码安装包
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
         OF_prop_int_new(OF_env, rom, "#address-cells", 1);+         /* "/rom/boot-rom@fff00000" node */-        brom = OF_node_new(OF_env, OF_node_root, "boot-rom", 0xfff00000);+        brom = OF_node_new(OF_env, rom, "boot-rom", 0xfff00000);         if (brom == NULL) {             ERROR("Cannot create 'boot-rom'\n");             return -1;         }         regs.address = 0xFFF00000;-        regs.size = 0x00010000;+        regs.size = 0x00100000;         OF_property_new(OF_env, brom, "reg", &regs, sizeof(OF_regprop_t));         OF_prop_string_new(OF_env, brom, "write-characteristic", "flash");         OF_prop_string_new(OF_env, brom, "BootROM-build-date",@@ -1577,7 +1608,7 @@         OF_prop_string_new(OF_env, brom, "copyright", copyright);         OF_prop_string_new(OF_env, brom, "model", BIOS_str);         OF_prop_int_new(OF_env, brom, "result", 0);-#if 0+#if 1         {             /* Hack taken 'as-is' from PearPC */             unsigned char info[] = {@@ -1596,7 +1627,9 @@         OF_node_put(OF_env, brom);         OF_node_put(OF_env, rom);     }+#if 0     /* From here, hardcoded hacks to get a Mac-like machine */+    /* XXX: Core99 does not seem to like this NVRAM tree */     /* "/nvram@fff04000" node */     {         OF_regprop_t regs;@@ -1617,6 +1650,7 @@         OF_prop_int_new(OF_env, chs, "nvram", OF_pack_handle(OF_env, nvr));         OF_node_put(OF_env, nvr);     }+#endif     /* "/pseudo-hid" : hid emulation as Apple does */     {         OF_node_t *hid;@@ -1663,7 +1697,27 @@         }         OF_node_put(OF_env, hid);     }+    if (arch == ARCH_MAC99) {+        OF_node_t *unin;+        OF_regprop_t regs; +        unin = OF_node_new(OF_env, OF_node_root,+                           "uni-n", 0xf8000000);+        if (unin == NULL) {+            ERROR("Cannot create 'uni-n'\n");+            return -1;+        }+        OF_prop_string_new(OF_env, unin, "device-type", "memory-controller");+        OF_prop_string_new(OF_env, unin, "model", "AAPL,UniNorth");+        OF_prop_string_new(OF_env, unin, "compatible", "uni-north");+        regs.address = 0xf8000000;+        regs.size = 0x01000000;+        OF_property_new(OF_env, unin, "reg", &regs, sizeof(regs));+        OF_prop_int_new(OF_env, unin, "#address-cells", 1);+        OF_prop_int_new(OF_env, unin, "#size-cells", 1);+        OF_prop_int_new(OF_env, unin, "device-rev", 3);+        OF_node_put(OF_env, unin);+    }      #if 1 /* This is mandatory for claim to work        * but I don't know where it should really be (in cpu ?)@@ -1693,7 +1747,9 @@      /* "/options/boot-args" node */     {-        const unsigned char *args = "-v rootdev cdrom";+        //        const unsigned char *args = "-v rootdev cdrom";+        //const unsigned char *args = "-v io=0xffffffff";+        const unsigned char *args = "-v";         /* Ask MacOS X to print debug messages */         //        OF_prop_string_new(OF_env, chs, "machargs", args);         //        OF_prop_string_new(OF_env, opt, "boot-command", args);@@ -2013,17 +2069,17 @@     OF_prop_int_new(OF_env, node, "min-grant", min_grant);     OF_prop_int_new(OF_env, node, "max-latency", max_latency);     if (dev->type != NULL)-        OF_prop_string_new(OF_env, node, "device_type", dev->type);+        OF_prop_string_new1(OF_env, node, "device_type", dev->type);     if (dev->compat != NULL)-        OF_prop_string_new(OF_env, node, "compatible", dev->compat);+        OF_prop_string_new1(OF_env, node, "compatible", dev->compat);     if (dev->model != NULL)-        OF_prop_string_new(OF_env, node, "model", dev->model);+        OF_prop_string_new1(OF_env, node, "model", dev->model);     if (dev->acells != 0)         OF_prop_int_new(OF_env, node, "#address-cells", dev->acells);     if (dev->scells != 0)-        OF_prop_int_new(OF_env, node, "#interrupt-cells", dev->acells);+        OF_prop_int_new(OF_env, node, "#size-cells", dev->scells);     if (dev->icells != 0)-        OF_prop_int_new(OF_env, node, "#size-cells", dev->acells);+        OF_prop_int_new(OF_env, node, "#interrupt-cells", dev->icells);     dprintf("Done %p %p\n", parent, node);          return node;@@ -2040,8 +2096,9 @@     OF_env_t *OF_env;     pci_range_t ranges[3];     OF_regprop_t regs[1];-    OF_node_t *pci_host;+    OF_node_t *pci_host, *als;     int nranges;+    unsigned char buffer[OF_NAMELEN_MAX];      OF_env = OF_env_main;     dprintf("register PCI host '%s' '%s' '%s' '%s'\n",@@ -2052,6 +2109,17 @@         ERROR("Cannot create pci host\n");         return NULL;     }+    +    als = OF_node_get(OF_env, "aliases");+    if (als == NULL) {+        ERROR("Cannot get 'aliases'\n");+        return NULL;+    }+    sprintf(buffer, "/%s", dev->name);+    OF_prop_string_set(OF_env, als, "pci", buffer);+    OF_node_put(OF_env, als);+    +     regs[0].address = cfg_base;     regs[0].size = cfg_len;     OF_property_new(OF_env, pci_host, "reg", regs, sizeof(OF_regprop_t));@@ -2136,6 +2204,11 @@     return pci_dev; } +/* XXX: suppress that, used for interrupt map init */+OF_node_t *pci_host_node;+uint32_t pci_host_interrupt_map[7 * 32];+int pci_host_interrupt_map_len = 0;+ void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses) {     OF_env_t *OF_env;@@ -2145,10 +2218,12 @@     regs[0].address = first_bus;     regs[0].size = nb_busses;     OF_property_new(OF_env, dev, "bus-range", regs, sizeof(OF_regprop_t));+    pci_host_node = dev; }  void OF_finalize_pci_device (void *dev, uint8_t bus, uint8_t devfn,-                             uint32_t *regions, uint32_t *sizes)+                             uint32_t *regions, uint32_t *sizes,+                             int irq_line) {     OF_env_t *OF_env;     pci_reg_prop_t pregs[6], rregs[6];@@ -2156,6 +2231,7 @@     int i, j, k;      OF_env = OF_env_main;+    /* XXX: only useful for VGA card in fact */     if (regions[0] != 0x00000000)         OF_prop_int_set(OF_env, dev, "address", regions[0] & ~0x0000000F);     for (i = 0, j = 0, k = 0; i < 6; i++) {@@ -2222,7 +2298,22 @@     } else {         OF_property_new(OF_env, dev, "assigned-addresses", NULL, 0);     }-#if 0+    if (irq_line >= 0) {+        int i;+        OF_prop_int_new(OF_env, dev, "interrupts", 1);+        i = pci_host_interrupt_map_len;+        pci_host_interrupt_map[i++] = (devfn << 8) & 0xf800;+        pci_host_interrupt_map[i++] = 0;+        pci_host_interrupt_map[i++] = 0;+        pci_host_interrupt_map[i++] = 0;+        pci_host_interrupt_map[i++] = 0; /* pic handle will be patched later */+        pci_host_interrupt_map[i++] = irq_line;+        if (arch != ARCH_HEATHROW) {+            pci_host_interrupt_map[i++] = 1;+        }+        pci_host_interrupt_map_len = i;+    }+#if 1     {         OF_prop_t *prop_name = ((OF_node_t *)dev)->prop_name; @@ -2390,6 +2481,54 @@     return 0; } +static void keylargo_ata(OF_node_t *mio, uint32_t base_address,+                         uint32_t base, int irq1, int irq2, +                         uint16_t pic_phandle)+{+    OF_env_t *OF_env = OF_env_main;+    OF_node_t *ata;+    OF_regprop_t regs[2];++    ata = OF_node_new(OF_env, mio, "ata-4", base);+    if (ata == NULL) {+        ERROR("Cannot create 'ata-4'\n");+        return;+    }+    OF_prop_string_new(OF_env, ata, "device_type", "ata");+#if 1+    OF_prop_string_new(OF_env, ata, "compatible", "key2largo-ata");+    OF_prop_string_new(OF_env, ata, "model", "ata-4");+    OF_prop_string_new(OF_env, ata, "cable-type", "80-conductor");+#else+    OF_prop_string_new(OF_env, ata, "compatible", "cmd646-ata");+    OF_prop_string_new(OF_env, ata, "model", "ata-4");+#endif+    OF_prop_int_new(OF_env, ata, "#address-cells", 1);+    OF_prop_int_new(OF_env, ata, "#size-cells", 0);+    regs[0].address = base;+    regs[0].size = 0x00001000;+#if 0 // HACK: Don't set up DMA registers+    regs[1].address = 0x00008A00;+    regs[1].size = 0x00001000;+    OF_property_new(OF_env, ata, "reg",+                    regs, 2 * sizeof(OF_regprop_t));+#else+    OF_property_new(OF_env, ata, "reg",+                    regs, sizeof(OF_regprop_t));+#endif+    OF_prop_int_new(OF_env, ata, "interrupt-parent", pic_phandle);+    regs[0].address = irq1;+    regs[0].size = 0x00000001;+    regs[1].address = irq2;+    regs[1].size = 0x00000000;+    OF_property_new(OF_env, ata, "interrupts",+                    regs, 2 * sizeof(OF_regprop_t));+    if (base == 0x1f000)+        ide_pci_pmac_register(base_address + base, 0x00000000, ata);+    else+        ide_pci_pmac_register(0x00000000, base_address + base, ata);+}+ void OF_finalize_pci_macio (void *dev, uint32_t base_address, uint32_t size,                             void *private_data) {@@ -2398,6 +2537,8 @@     pci_reg_prop_t pregs[2];     OF_node_t *mio, *chs, *als;     uint16_t pic_phandle;+    int rec_len;+    OF_prop_t *mio_reg;      OF_DPRINTF("mac-io: %p\n", dev);     OF_env = OF_env_main;@@ -2416,10 +2557,14 @@     mio = dev;     mio->private_data = private_data;     pregs[0].addr.hi = 0x00000000;-    pregs[0].addr.mid = 0x82013810;+    pregs[0].addr.mid = 0x00000000;     pregs[0].addr.lo = 0x00000000;     pregs[0].size_hi = base_address;     pregs[0].size_lo = size;+    mio_reg = OF_property_get(OF_env, mio, "reg");+    if (mio_reg && mio_reg->vlen >= 5 * 4) {+        pregs[0].addr.mid = ((pci_reg_prop_t *)mio_reg->value)->addr.hi;+    }     OF_property_new(OF_env, mio, "ranges",                     &pregs, sizeof(pci_reg_prop_t)); #if 0@@ -2431,8 +2576,32 @@     OF_property_new(OF_env, mio, "assigned-addresses",                     &pregs, sizeof(pci_reg_prop_t)); #endif++    if (arch == ARCH_HEATHROW) {+        /* Heathrow PIC */+        OF_regprop_t regs;+        OF_node_t *mpic;+        const char compat_str[] = "heathrow\0mac-risc";++        mpic = OF_node_new(OF_env, mio, "interrupt-controller", 0x10);+        if (mpic == NULL) {+            ERROR("Cannot create 'mpic'\n");+            goto out;+        }+        OF_prop_string_new(OF_env, mpic, "device_type", "interrupt-controller");+        OF_property_new(OF_env, mpic, "compatible", compat_str, sizeof(compat_str));+        OF_prop_int_new(OF_env, mpic, "#interrupt-cells", 1);+        regs.address = 0x10;+        regs.size = 0x20;+        OF_property_new(OF_env, mpic, "reg",+                        &regs, sizeof(regs));+        OF_property_new(OF_env, mpic, "interrupt-controller", NULL, 0);+        pic_phandle = OF_pack_handle(OF_env, mpic);+        OF_prop_int_new(OF_env, chs, "interrupt-controller", pic_phandle);+        OF_node_put(OF_env, mpic);+        rec_len = 6;+    } else {     /* OpenPIC */-    {         OF_regprop_t regs[4];         OF_node_t *mpic;         mpic = OF_node_new(OF_env, mio, "interrupt-controller", 0x40000);@@ -2455,8 +2624,37 @@         pic_phandle = OF_pack_handle(OF_env, mpic);         OF_prop_int_new(OF_env, chs, "interrupt-controller", pic_phandle);         OF_node_put(OF_env, mpic);+        rec_len = 7;     }-#if 1++    /* patch pci host table */+    /* XXX: do it after the PCI init */+    {+        int i;+        uint32_t tab[4];++        for(i = 0; i < pci_host_interrupt_map_len; i += rec_len)+            pci_host_interrupt_map[i + 4] = pic_phandle;+#if 0+        dprintf("interrupt-map:\n");+        for(i = 0; i < pci_host_interrupt_map_len; i++) {+            dprintf(" %08x", pci_host_interrupt_map[i]);+            if ((i % rec_len) == (rec_len - 1))+                dprintf("\n");+        }+        dprintf("\n");+#endif+        OF_property_new(OF_env, pci_host_node, "interrupt-map", +                        pci_host_interrupt_map, +                        pci_host_interrupt_map_len * sizeof(uint32_t));+        tab[0] = 0xf800;+        tab[1] = 0;+        tab[2] = 0;+        tab[3] = 0;+        OF_property_new(OF_env, pci_host_node, "interrupt-map-mask", +                        tab, 4 * sizeof(uint32_t));+    }+#if 0     /* escc is usefull to get MacOS X debug messages */     {         OF_regprop_t regs[8];@@ -2645,85 +2843,12 @@         OF_node_put(OF_env, scc);     } #endif-    /* IDE controller */-    {-        OF_node_t *ata;-        OF_regprop_t regs[2];-        ata = OF_node_new(OF_env, mio, "ata-4", 0x1f000);-        if (ata == NULL) {-            ERROR("Cannot create 'ata-4'\n");-            goto out;-        }-        OF_prop_string_new(OF_env, ata, "device_type", "ata");-#if 1-        OF_prop_string_new(OF_env, ata, "compatible", "keylargo-ata");-        OF_prop_string_new(OF_env, ata, "model", "ata-4");-#else-        OF_prop_string_new(OF_env, ata, "compatible", "cmd646-ata");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -