Commit 98352369101d2f3097e7f75d291b0a438c4dbbe4

Authored by bellard
1 parent e5733356

specific mac-io PCI device_id for paddington/heathrow - fixed atapi requests - r…

…eset IDE drives in quiesce - added heathrow nvram OF description


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1512 c046a42c-6fe2-441c-8c8c-71466251a162
pc-bios/ohw.diff
1 1 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/bios.h OpenHackWare-release-0.4/src/bios.h
2 2 --- OpenHackWare-release-0.4.org/src/bios.h 2005-04-06 23:20:22.000000000 +0200
3   -+++ OpenHackWare-release-0.4/src/bios.h 2005-07-03 16:17:41.000000000 +0200
  3 ++++ OpenHackWare-release-0.4/src/bios.h 2005-07-07 01:10:20.000000000 +0200
4 4 @@ -64,6 +64,7 @@
5 5 ARCH_CHRP,
6 6 ARCH_MAC99,
... ... @@ -9,7 +9,15 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
9 9 };
10 10  
11 11 /* Hardware definition(s) */
12   -@@ -183,12 +184,12 @@
  12 +@@ -174,6 +175,7 @@
  13 + int bd_ioctl (bloc_device_t *bd, int func, void *args);
  14 + uint32_t bd_seclen (bloc_device_t *bd);
  15 + void bd_close (bloc_device_t *bd);
  16 ++void bd_reset_all(void);
  17 + uint32_t bd_seclen (bloc_device_t *bd);
  18 + uint32_t bd_maxbloc (bloc_device_t *bd);
  19 + void bd_sect2CHS (bloc_device_t *bd, uint32_t secnum,
  20 +@@ -183,12 +185,12 @@
13 21 part_t *bd_probe (int boot_device);
14 22 bloc_device_t *bd_get (int device);
15 23 void bd_put (bloc_device_t *bd);
... ... @@ -24,7 +32,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
24 32 void ide_pci_pmac_register (uint32_t io_base0, uint32_t io_base1,
25 33 void *OF_private);
26 34  
27   -@@ -399,17 +400,23 @@
  35 +@@ -399,17 +401,23 @@
28 36 uint16_t min_grant, uint16_t max_latency);
29 37 void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses);
30 38 void OF_finalize_pci_device (void *dev, uint8_t bus, uint8_t devfn,
... ... @@ -53,7 +61,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
53 61 const unsigned char *name, int devnum,
54 62 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/bloc.c OpenHackWare-release-0.4/src/bloc.c
55 63 --- OpenHackWare-release-0.4.org/src/bloc.c 2005-04-06 23:21:00.000000000 +0200
56   -+++ OpenHackWare-release-0.4/src/bloc.c 2005-07-03 16:17:41.000000000 +0200
  64 ++++ OpenHackWare-release-0.4/src/bloc.c 2005-07-08 00:28:26.000000000 +0200
57 65 @@ -55,6 +55,7 @@
58 66 /* Partitions */
59 67 part_t *parts, *bparts;
... ... @@ -62,7 +70,33 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
62 70 /* Chain */
63 71 bloc_device_t *next;
64 72 };
65   -@@ -223,10 +224,12 @@
  73 +@@ -66,6 +67,7 @@
  74 +
  75 + static int ide_initialize (bloc_device_t *bd, int device);
  76 + static int ide_read_sector (bloc_device_t *bd, void *buffer, int secnum);
  77 ++static int ide_reset (bloc_device_t *bd);
  78 +
  79 + static int mem_initialize (bloc_device_t *bd, int device);
  80 + static int mem_read_sector (bloc_device_t *bd, void *buffer, int secnum);
  81 +@@ -212,6 +214,17 @@
  82 + {
  83 + }
  84 +
  85 ++void bd_reset_all(void)
  86 ++{
  87 ++ bloc_device_t *bd;
  88 ++ for (bd = bd_list; bd != NULL; bd = bd->next) {
  89 ++ if (bd->init == &ide_initialize) {
  90 ++ /* reset IDE drive because Darwin wants all IDE devices to be reset */
  91 ++ ide_reset(bd);
  92 ++ }
  93 ++ }
  94 ++}
  95 ++
  96 + uint32_t bd_seclen (bloc_device_t *bd)
  97 + {
  98 + return bd->seclen;
  99 +@@ -223,10 +236,12 @@
66 100 }
67 101  
68 102 /* XXX: to be suppressed */
... ... @@ -76,7 +110,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
76 110 }
77 111 }
78 112  
79   -@@ -240,6 +243,13 @@
  113 +@@ -240,6 +255,13 @@
80 114 return &bd->bparts;
81 115 }
82 116  
... ... @@ -90,7 +124,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
90 124 part_t *bd_probe (int boot_device)
91 125 {
92 126 char devices[] = { /*'a', 'b',*/ 'c', 'd', 'e', 'f', 'm', '\0', };
93   -@@ -272,9 +282,7 @@
  127 +@@ -272,9 +294,7 @@
94 128 tmp = part_probe(bd, force_raw);
95 129 if (boot_device == bd->device) {
96 130 boot_part = tmp;
... ... @@ -101,7 +135,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
101 135 }
102 136 }
103 137  
104   -@@ -717,34 +725,29 @@
  138 +@@ -717,34 +737,29 @@
105 139 /* IDE PCI access for pc */
106 140 static uint8_t ide_pci_port_read (bloc_device_t *bd, int port)
107 141 {
... ... @@ -143,7 +177,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
143 177 }
144 178  
145 179 static ide_ops_t ide_pci_pc_ops = {
146   -@@ -761,7 +764,7 @@
  180 +@@ -761,7 +776,7 @@
147 181  
148 182 void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
149 183 uint32_t io_base2, uint32_t io_base3,
... ... @@ -152,7 +186,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
152 186 {
153 187 if (ide_pci_ops == NULL) {
154 188 ide_pci_ops = malloc(sizeof(ide_ops_t));
155   -@@ -770,19 +773,19 @@
  189 +@@ -770,19 +785,19 @@
156 190 memcpy(ide_pci_ops, &ide_pci_pc_ops, sizeof(ide_ops_t));
157 191 }
158 192 if ((io_base0 != 0 || io_base1 != 0) &&
... ... @@ -178,6 +212,78 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
178 212 #endif
179 213 }
180 214 }
  215 +@@ -935,6 +950,8 @@
  216 + }
  217 +
  218 + static void atapi_pad_req (void *buffer, int len);
  219 ++static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,
  220 ++ int maxlen);
  221 + static int atapi_read_sector (bloc_device_t *bd, void *buffer, int secnum);
  222 +
  223 + static int ide_initialize (bloc_device_t *bd, int device)
  224 +@@ -1035,9 +1052,7 @@
  225 + DPRINTF("INQUIRY\n");
  226 + len = spc_inquiry_req(&atapi_buffer, 36);
  227 + atapi_pad_req(&atapi_buffer, len);
  228 +- ide_port_write(bd, 0x07, 0xA0);
  229 +- for (i = 0; i < 3; i++)
  230 +- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));
  231 ++ atapi_make_req(bd, atapi_buffer, 36);
  232 + status = ide_port_read(bd, 0x07);
  233 + if (status != 0x48) {
  234 + ERROR("ATAPI INQUIRY : status %0x != 0x48\n", status);
  235 +@@ -1053,9 +1068,7 @@
  236 + DPRINTF("READ_CAPACITY\n");
  237 + len = mmc_read_capacity_req(&atapi_buffer);
  238 + atapi_pad_req(&atapi_buffer, len);
  239 +- ide_port_write(bd, 0x07, 0xA0);
  240 +- for (i = 0; i < 3; i++)
  241 +- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));
  242 ++ atapi_make_req(bd, atapi_buffer, 8);
  243 + status = ide_port_read(bd, 0x07);
  244 + if (status != 0x48) {
  245 + ERROR("ATAPI READ_CAPACITY : status %0x != 0x48\n", status);
  246 +@@ -1105,6 +1118,22 @@
  247 + memset(p + len, 0, 12 - len);
  248 + }
  249 +
  250 ++static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,
  251 ++ int maxlen)
  252 ++{
  253 ++ int i;
  254 ++ /* select drive */
  255 ++ if (bd->drv == 0)
  256 ++ ide_port_write(bd, 0x06, 0x40);
  257 ++ else
  258 ++ ide_port_write(bd, 0x06, 0x50);
  259 ++ ide_port_write(bd, 0x04, maxlen & 0xff);
  260 ++ ide_port_write(bd, 0x05, (maxlen >> 8) & 0xff);
  261 ++ ide_port_write(bd, 0x07, 0xA0);
  262 ++ for (i = 0; i < 3; i++)
  263 ++ ide_data_writel(bd, ldswap32(&buffer[i]));
  264 ++}
  265 ++
  266 + static int atapi_read_sector (bloc_device_t *bd, void *buffer, int secnum)
  267 + {
  268 + uint32_t atapi_buffer[4];
  269 +@@ -1112,16 +1141,9 @@
  270 + uint32_t status, value;
  271 + int i, len;
  272 +
  273 +- /* select drive */
  274 +- if (bd->drv == 0)
  275 +- ide_port_write(bd, 0x06, 0x40);
  276 +- else
  277 +- ide_port_write(bd, 0x06, 0x50);
  278 + len = mmc_read12_req(atapi_buffer, secnum, 1);
  279 + atapi_pad_req(&atapi_buffer, len);
  280 +- ide_port_write(bd, 0x07, 0xA0);
  281 +- for (i = 0; i < 3; i++)
  282 +- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));
  283 ++ atapi_make_req(bd, atapi_buffer, bd->seclen);
  284 + status = ide_port_read(bd, 0x07);
  285 + if (status != 0x48) {
  286 + ERROR("ATAPI READ12 : status %0x != 0x48\n", status);
181 287 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/apple.c OpenHackWare-release-0.4/src/libpart/apple.c
182 288 --- OpenHackWare-release-0.4.org/src/libpart/apple.c 2005-03-31 09:23:33.000000000 +0200
183 289 +++ OpenHackWare-release-0.4/src/libpart/apple.c 2005-07-03 16:17:41.000000000 +0200
... ... @@ -527,7 +633,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
527 633 byte = NVRAM_get_byte(nvram, 0x34);
528 634 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/of.c OpenHackWare-release-0.4/src/of.c
529 635 --- OpenHackWare-release-0.4.org/src/of.c 2005-04-06 23:17:26.000000000 +0200
530   -+++ OpenHackWare-release-0.4/src/of.c 2005-07-03 17:46:25.000000000 +0200
  636 ++++ OpenHackWare-release-0.4/src/of.c 2005-07-07 23:30:08.000000000 +0200
531 637 @@ -489,7 +489,7 @@
532 638 ERROR("%s can't alloc new node '%s' name\n", __func__, name);
533 639 return NULL;
... ... @@ -537,7 +643,41 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
537 643 if (new->prop_address == NULL) {
538 644 free(new->prop_name->value);
539 645 free(new->prop_name);
540   -@@ -1421,15 +1421,12 @@
  646 +@@ -1017,6 +1017,33 @@
  647 + string, strlen(string) + 1);
  648 + }
  649 +
  650 ++/* convert '\1' char to '\0' */
  651 ++static OF_prop_t *OF_prop_string_new1 (OF_env_t *env, OF_node_t *node,
  652 ++ const unsigned char *name,
  653 ++ const unsigned char *string)
  654 ++{
  655 ++ int len, i;
  656 ++ OF_prop_t *ret;
  657 ++ unsigned char *str;
  658 ++
  659 ++ if (strchr(string, '\1') == NULL) {
  660 ++ return OF_prop_string_new(env, node, name, string);
  661 ++ } else {
  662 ++ len = strlen(string) + 1;
  663 ++ str = malloc(len);
  664 ++ if (!str)
  665 ++ return NULL;
  666 ++ memcpy(str, string, len);
  667 ++ for(i = 0; i < len; i++)
  668 ++ if (str[i] == '\1')
  669 ++ str[i] = '\0';
  670 ++ ret = OF_property_new(env, node, name,
  671 ++ str, len);
  672 ++ free(str);
  673 ++ return ret;
  674 ++ }
  675 ++}
  676 ++
  677 + __attribute__ (( section (".OpenFirmware") ))
  678 + static OF_prop_t *OF_prop_int_new (OF_env_t *env, OF_node_t *node,
  679 + const unsigned char *name, uint32_t value)
  680 +@@ -1421,15 +1448,12 @@
541 681 __attribute__ (( section (".OpenFirmware") ))
542 682 int OF_init (void)
543 683 {
... ... @@ -553,7 +693,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
553 693 #endif
554 694 OF_env_t *OF_env;
555 695 OF_node_t *als, *opt, *chs, *pks;
556   -@@ -1455,15 +1452,21 @@
  696 +@@ -1455,15 +1479,21 @@
557 697 return -1;
558 698 }
559 699 OF_prop_string_new(OF_env, OF_node_root, "device_type", "bootrom");
... ... @@ -581,7 +721,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
581 721 #if 0
582 722 OF_prop_string_new(OF_env, OF_node_root, "copyright", copyright);
583 723 #else
584   -@@ -1561,14 +1564,15 @@
  724 +@@ -1561,14 +1591,15 @@
585 725 range.size = 0x00800000;
586 726 OF_property_new(OF_env, rom, "ranges", &range, sizeof(OF_range_t));
587 727 OF_prop_int_new(OF_env, rom, "#address-cells", 1);
... ... @@ -599,7 +739,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
599 739 OF_property_new(OF_env, brom, "reg", &regs, sizeof(OF_regprop_t));
600 740 OF_prop_string_new(OF_env, brom, "write-characteristic", "flash");
601 741 OF_prop_string_new(OF_env, brom, "BootROM-build-date",
602   -@@ -1577,7 +1581,7 @@
  742 +@@ -1577,7 +1608,7 @@
603 743 OF_prop_string_new(OF_env, brom, "copyright", copyright);
604 744 OF_prop_string_new(OF_env, brom, "model", BIOS_str);
605 745 OF_prop_int_new(OF_env, brom, "result", 0);
... ... @@ -608,7 +748,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
608 748 {
609 749 /* Hack taken 'as-is' from PearPC */
610 750 unsigned char info[] = {
611   -@@ -1596,7 +1600,9 @@
  751 +@@ -1596,7 +1627,9 @@
612 752 OF_node_put(OF_env, brom);
613 753 OF_node_put(OF_env, rom);
614 754 }
... ... @@ -618,7 +758,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
618 758 /* "/nvram@fff04000" node */
619 759 {
620 760 OF_regprop_t regs;
621   -@@ -1617,6 +1623,7 @@
  761 +@@ -1617,6 +1650,7 @@
622 762 OF_prop_int_new(OF_env, chs, "nvram", OF_pack_handle(OF_env, nvr));
623 763 OF_node_put(OF_env, nvr);
624 764 }
... ... @@ -626,7 +766,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
626 766 /* "/pseudo-hid" : hid emulation as Apple does */
627 767 {
628 768 OF_node_t *hid;
629   -@@ -1663,7 +1670,27 @@
  769 +@@ -1663,7 +1697,27 @@
630 770 }
631 771 OF_node_put(OF_env, hid);
632 772 }
... ... @@ -654,7 +794,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
654 794  
655 795 #if 1 /* This is mandatory for claim to work
656 796 * but I don't know where it should really be (in cpu ?)
657   -@@ -1693,7 +1720,9 @@
  797 +@@ -1693,7 +1747,9 @@
658 798  
659 799 /* "/options/boot-args" node */
660 800 {
... ... @@ -665,7 +805,18 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
665 805 /* Ask MacOS X to print debug messages */
666 806 // OF_prop_string_new(OF_env, chs, "machargs", args);
667 807 // OF_prop_string_new(OF_env, opt, "boot-command", args);
668   -@@ -2021,9 +2050,9 @@
  808 +@@ -2013,17 +2069,17 @@
  809 + OF_prop_int_new(OF_env, node, "min-grant", min_grant);
  810 + OF_prop_int_new(OF_env, node, "max-latency", max_latency);
  811 + if (dev->type != NULL)
  812 +- OF_prop_string_new(OF_env, node, "device_type", dev->type);
  813 ++ OF_prop_string_new1(OF_env, node, "device_type", dev->type);
  814 + if (dev->compat != NULL)
  815 +- OF_prop_string_new(OF_env, node, "compatible", dev->compat);
  816 ++ OF_prop_string_new1(OF_env, node, "compatible", dev->compat);
  817 + if (dev->model != NULL)
  818 +- OF_prop_string_new(OF_env, node, "model", dev->model);
  819 ++ OF_prop_string_new1(OF_env, node, "model", dev->model);
669 820 if (dev->acells != 0)
670 821 OF_prop_int_new(OF_env, node, "#address-cells", dev->acells);
671 822 if (dev->scells != 0)
... ... @@ -677,7 +828,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
677 828 dprintf("Done %p %p\n", parent, node);
678 829  
679 830 return node;
680   -@@ -2040,8 +2069,9 @@
  831 +@@ -2040,8 +2096,9 @@
681 832 OF_env_t *OF_env;
682 833 pci_range_t ranges[3];
683 834 OF_regprop_t regs[1];
... ... @@ -688,7 +839,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
688 839  
689 840 OF_env = OF_env_main;
690 841 dprintf("register PCI host '%s' '%s' '%s' '%s'\n",
691   -@@ -2052,6 +2082,17 @@
  842 +@@ -2052,6 +2109,17 @@
692 843 ERROR("Cannot create pci host\n");
693 844 return NULL;
694 845 }
... ... @@ -706,7 +857,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
706 857 regs[0].address = cfg_base;
707 858 regs[0].size = cfg_len;
708 859 OF_property_new(OF_env, pci_host, "reg", regs, sizeof(OF_regprop_t));
709   -@@ -2136,6 +2177,11 @@
  860 +@@ -2136,6 +2204,11 @@
710 861 return pci_dev;
711 862 }
712 863  
... ... @@ -718,7 +869,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
718 869 void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses)
719 870 {
720 871 OF_env_t *OF_env;
721   -@@ -2145,10 +2191,12 @@
  872 +@@ -2145,10 +2218,12 @@
722 873 regs[0].address = first_bus;
723 874 regs[0].size = nb_busses;
724 875 OF_property_new(OF_env, dev, "bus-range", regs, sizeof(OF_regprop_t));
... ... @@ -732,7 +883,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
732 883 {
733 884 OF_env_t *OF_env;
734 885 pci_reg_prop_t pregs[6], rregs[6];
735   -@@ -2156,6 +2204,7 @@
  886 +@@ -2156,6 +2231,7 @@
736 887 int i, j, k;
737 888  
738 889 OF_env = OF_env_main;
... ... @@ -740,7 +891,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
740 891 if (regions[0] != 0x00000000)
741 892 OF_prop_int_set(OF_env, dev, "address", regions[0] & ~0x0000000F);
742 893 for (i = 0, j = 0, k = 0; i < 6; i++) {
743   -@@ -2222,7 +2271,22 @@
  894 +@@ -2222,7 +2298,22 @@
744 895 } else {
745 896 OF_property_new(OF_env, dev, "assigned-addresses", NULL, 0);
746 897 }
... ... @@ -764,7 +915,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
764 915 {
765 916 OF_prop_t *prop_name = ((OF_node_t *)dev)->prop_name;
766 917  
767   -@@ -2390,6 +2454,54 @@
  918 +@@ -2390,6 +2481,54 @@
768 919 return 0;
769 920 }
770 921  
... ... @@ -819,7 +970,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
819 970 void OF_finalize_pci_macio (void *dev, uint32_t base_address, uint32_t size,
820 971 void *private_data)
821 972 {
822   -@@ -2398,6 +2510,8 @@
  973 +@@ -2398,6 +2537,8 @@
823 974 pci_reg_prop_t pregs[2];
824 975 OF_node_t *mio, *chs, *als;
825 976 uint16_t pic_phandle;
... ... @@ -828,7 +979,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
828 979  
829 980 OF_DPRINTF("mac-io: %p\n", dev);
830 981 OF_env = OF_env_main;
831   -@@ -2416,10 +2530,14 @@
  982 +@@ -2416,10 +2557,14 @@
832 983 mio = dev;
833 984 mio->private_data = private_data;
834 985 pregs[0].addr.hi = 0x00000000;
... ... @@ -844,28 +995,10 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
844 995 OF_property_new(OF_env, mio, "ranges",
845 996 &pregs, sizeof(pci_reg_prop_t));
846 997 #if 0
847   -@@ -2431,8 +2549,49 @@
  998 +@@ -2431,8 +2576,32 @@
848 999 OF_property_new(OF_env, mio, "assigned-addresses",
849 1000 &pregs, sizeof(pci_reg_prop_t));
850 1001 #endif
851   -- /* OpenPIC */
852   -+
853   -+ switch(arch) {
854   -+ default:
855   -+ case ARCH_MAC99:
856   -+ OF_prop_int_new(OF_env, mio, "#interrupt-cells", 2);
857   -+ OF_prop_string_new(OF_env, mio, "model", "AAPL,Keylargo");
858   -+ OF_prop_string_new(OF_env, mio, "compatible", "Keylargo");
859   -+ break;
860   -+ case ARCH_HEATHROW:
861   -+ OF_prop_int_new(OF_env, mio, "#interrupt-cells", 1);
862   -+ OF_prop_string_new(OF_env, mio, "model", "AAPL,343S1211");
863   - {
864   -+ const char str[] = "paddington\0heathrow";
865   -+ OF_property_new(OF_env, mio, "compatible", str, sizeof(str));
866   -+ }
867   -+ break;
868   -+ }
869 1002 +
870 1003 + if (arch == ARCH_HEATHROW) {
871 1004 + /* Heathrow PIC */
... ... @@ -891,11 +1024,12 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
891 1024 + OF_node_put(OF_env, mpic);
892 1025 + rec_len = 6;
893 1026 + } else {
894   -+ /* OpenPIC */
  1027 + /* OpenPIC */
  1028 +- {
895 1029 OF_regprop_t regs[4];
896 1030 OF_node_t *mpic;
897 1031 mpic = OF_node_new(OF_env, mio, "interrupt-controller", 0x40000);
898   -@@ -2455,8 +2614,37 @@
  1032 +@@ -2455,8 +2624,37 @@
899 1033 pic_phandle = OF_pack_handle(OF_env, mpic);
900 1034 OF_prop_int_new(OF_env, chs, "interrupt-controller", pic_phandle);
901 1035 OF_node_put(OF_env, mpic);
... ... @@ -934,7 +1068,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
934 1068 /* escc is usefull to get MacOS X debug messages */
935 1069 {
936 1070 OF_regprop_t regs[8];
937   -@@ -2645,85 +2833,12 @@
  1071 +@@ -2645,85 +2843,12 @@
938 1072 OF_node_put(OF_env, scc);
939 1073 }
940 1074 #endif
... ... @@ -1025,7 +1159,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1025 1159 /* Timer */
1026 1160 {
1027 1161 OF_node_t *tmr;
1028   -@@ -2746,10 +2861,11 @@
  1162 +@@ -2746,10 +2871,11 @@
1029 1163 regs, sizeof(OF_regprop_t));
1030 1164 OF_node_put(OF_env, tmr);
1031 1165 }
... ... @@ -1038,7 +1172,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1038 1172 OF_regprop_t regs[1];
1039 1173 #if 0 // THIS IS A HACK AND IS COMPLETELY ABSURD !
1040 1174 // (but needed has Qemu doesn't emulate via-pmu).
1041   -@@ -2773,14 +2889,21 @@
  1175 +@@ -2773,14 +2899,21 @@
1042 1176 regs[0].size = 0x00002000;
1043 1177 OF_property_new(OF_env, via, "reg", regs, sizeof(OF_regprop_t));
1044 1178 OF_prop_int_new(OF_env, via, "interrupt-parent", pic_phandle);
... ... @@ -1061,7 +1195,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1061 1195 /* ADB pseudo-device */
1062 1196 adb = OF_node_new(OF_env, via, "adb", OF_ADDRESS_NONE);
1063 1197 if (adb == NULL) {
1064   -@@ -2797,9 +2920,26 @@
  1198 +@@ -2797,9 +2930,26 @@
1065 1199 OF_prop_int_new(OF_env, adb, "#size-cells", 0);
1066 1200 OF_pack_get_path(OF_env, tmp, 512, adb);
1067 1201 OF_prop_string_new(OF_env, als, "adb", tmp);
... ... @@ -1091,7 +1225,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1091 1225  
1092 1226 rtc = OF_node_new(OF_env, via, "rtc", OF_ADDRESS_NONE);
1093 1227 if (rtc == NULL) {
1094   -@@ -2813,14 +2953,55 @@
  1228 +@@ -2813,14 +2963,68 @@
1095 1229 OF_prop_string_new(OF_env, rtc, "compatible", "rtc");
1096 1230 #endif
1097 1231 OF_node_put(OF_env, rtc);
... ... @@ -1108,6 +1242,19 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1108 1242 + OF_node_put(OF_env, pmgt);
1109 1243 + }
1110 1244 +
  1245 ++ if (arch == ARCH_HEATHROW) {
  1246 ++ /* NVRAM */
  1247 ++ OF_node_t *nvr;
  1248 ++ OF_regprop_t regs;
  1249 ++ nvr = OF_node_new(OF_env, mio, "nvram", 0x60000);
  1250 ++ OF_prop_string_new(OF_env, nvr, "device_type", "nvram");
  1251 ++ regs.address = 0x60000;
  1252 ++ regs.size = 0x00020000;
  1253 ++ OF_property_new(OF_env, nvr, "reg", &regs, sizeof(regs));
  1254 ++ OF_prop_int_new(OF_env, nvr, "#bytes", 0x2000);
  1255 ++ OF_node_put(OF_env, nvr);
  1256 ++ }
  1257 ++
1111 1258 out:
1112 1259 // OF_node_put(OF_env, mio);
1113 1260 OF_node_put(OF_env, chs);
... ... @@ -1148,7 +1295,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1148 1295 /*****************************************************************************/
1149 1296 /* Fake package */
1150 1297 static void OF_method_fake (OF_env_t *OF_env)
1151   -@@ -2862,11 +3043,11 @@
  1298 +@@ -2862,11 +3066,11 @@
1152 1299 /* As we get a 1:1 mapping, do nothing */
1153 1300 ihandle = popd(OF_env);
1154 1301 args = (void *)popd(OF_env);
... ... @@ -1160,11 +1307,11 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1160 1307 + size = popd(OF_env);
1161 1308 + virt = popd(OF_env);
1162 1309 + address = popd(OF_env);
1163   -+ dprintf("map %0x %0x %0x %0x\n", ihandle, address,
  1310 ++ OF_DPRINTF("Map %0x %0x %0x %0x\n", ihandle, address,
1164 1311 virt, size);
1165 1312 pushd(OF_env, 0);
1166 1313 }
1167   -@@ -3270,7 +3451,7 @@
  1314 +@@ -3270,7 +3474,7 @@
1168 1315 OF_prop_string_new(OF_env, dsk, "device_type", "block");
1169 1316 OF_prop_string_new(OF_env, dsk, "category", type);
1170 1317 OF_prop_int_new(OF_env, dsk, "device_id", devnum);
... ... @@ -1173,7 +1320,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1173 1320 OF_method_new(OF_env, dsk, "open", &OF_blockdev_open);
1174 1321 OF_method_new(OF_env, dsk, "seek", &OF_blockdev_seek);
1175 1322 OF_method_new(OF_env, dsk, "read", &OF_blockdev_read);
1176   -@@ -3432,7 +3613,8 @@
  1323 +@@ -3432,7 +3636,8 @@
1177 1324 }
1178 1325  
1179 1326 void OF_vga_register (const unsigned char *name, unused uint32_t address,
... ... @@ -1183,7 +1330,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1183 1330 {
1184 1331 OF_env_t *OF_env;
1185 1332 unsigned char tmp[OF_NAMELEN_MAX];
1186   -@@ -3504,6 +3686,18 @@
  1333 +@@ -3504,6 +3709,18 @@
1187 1334 OF_prop_string_new(OF_env, als, "display", tmp);
1188 1335 OF_node_put(OF_env, als);
1189 1336 /* XXX: may also need read-rectangle */
... ... @@ -1202,7 +1349,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1202 1349 out:
1203 1350 OF_node_put(OF_env, disp);
1204 1351 }
1205   -@@ -4451,7 +4645,10 @@
  1352 +@@ -4451,7 +4668,10 @@
1206 1353 break;
1207 1354 case 0x233441d3: /* MacOS X 10.2 and OpenDarwin 1.41 */
1208 1355 /* Create "memory-map" pseudo device */
... ... @@ -1214,7 +1361,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1214 1361 /* Find "/packages" */
1215 1362 chs = OF_pack_find_by_name(OF_env, OF_node_root, "/chosen");
1216 1363 if (chs == NULL) {
1217   -@@ -4459,10 +4656,6 @@
  1364 +@@ -4459,10 +4679,6 @@
1218 1365 ERROR("Cannot get '/chosen'\n");
1219 1366 break;
1220 1367 }
... ... @@ -1225,7 +1372,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1225 1372 map = OF_node_new(OF_env, chs, "memory-map", OF_ADDRESS_NONE);
1226 1373 if (map == NULL) {
1227 1374 pushd(OF_env, -1);
1228   -@@ -4473,11 +4666,8 @@
  1375 +@@ -4473,11 +4689,8 @@
1229 1376 OF_node_put(OF_env, map);
1230 1377 OF_node_put(OF_env, chs);
1231 1378 pushd(OF_env, phandle);
... ... @@ -1238,7 +1385,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1238 1385 break;
1239 1386 case 0x32a2d18e: /* MacOS X 10.2 and OpenDarwin 6.02 */
1240 1387 /* Return screen ihandle */
1241   -@@ -4540,9 +4730,10 @@
  1388 +@@ -4540,9 +4753,10 @@
1242 1389 case 0x4ad41f2d:
1243 1390 /* Yaboot: wait 10 ms: sure ! */
1244 1391 break;
... ... @@ -1250,9 +1397,17 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1250 1397 printf("Call %0x NOT IMPLEMENTED !\n", crc);
1251 1398 bug();
1252 1399 break;
  1400 +@@ -4581,6 +4795,7 @@
  1401 + {
  1402 + OF_CHECK_NBARGS(OF_env, 0);
  1403 + /* Should free all OF resources */
  1404 ++ bd_reset_all();
  1405 + #if defined (DEBUG_BIOS)
  1406 + {
  1407 + uint16_t loglevel = 0x02 | 0x10 | 0x80;
1253 1408 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/pci.c OpenHackWare-release-0.4/src/pci.c
1254 1409 --- OpenHackWare-release-0.4.org/src/pci.c 2005-03-31 09:23:33.000000000 +0200
1255   -+++ OpenHackWare-release-0.4/src/pci.c 2005-07-03 15:52:16.000000000 +0200
  1410 ++++ OpenHackWare-release-0.4/src/pci.c 2005-07-07 23:27:37.000000000 +0200
1256 1411 @@ -99,8 +99,8 @@
1257 1412 uint16_t min_grant;
1258 1413 uint16_t max_latency;
... ... @@ -1490,20 +1645,23 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1490 1645 },
1491 1646 {
1492 1647 0x1057, 0x4801, NULL,
1493   -@@ -1446,8 +1531,10 @@
1494   - /* Apple Mac-io controller */
  1648 +@@ -1443,7 +1528,14 @@
  1649 + }
  1650 +
  1651 + static const pci_dev_t misc_pci[] = {
  1652 +- /* Apple Mac-io controller */
  1653 ++ /* Paddington Mac I/O */
  1654 ++ {
  1655 ++ 0x106B, 0x0017,
  1656 ++ "mac-io", "mac-io", "AAPL,343S1211", "paddington\1heathrow",
  1657 ++ 1, 1, 1,
  1658 ++ &macio_config_cb, NULL,
  1659 ++ },
  1660 ++ /* KeyLargo Mac I/O */
1495 1661 {
1496 1662 0x106B, 0x0022,
1497   -- "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo",
1498   -- 1, 1, 2,
1499   -+ /* model, compatible and #interrupt-cells fields are filled in
1500   -+ of.c */
1501   -+ "mac-io", "mac-io", NULL, NULL,
1502   -+ 1, 1, 0,
1503   - &macio_config_cb, NULL,
1504   - },
1505   - {
1506   -@@ -1599,7 +1686,7 @@
  1663 + "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo",
  1664 +@@ -1599,7 +1691,7 @@
1507 1665 uint8_t min_grant, uint8_t max_latency,
1508 1666 int irq_line)
1509 1667 {
... ... @@ -1512,7 +1670,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1512 1670 int i;
1513 1671  
1514 1672 device->min_grant = min_grant;
1515   -@@ -1611,22 +1698,28 @@
  1673 +@@ -1611,22 +1703,28 @@
1516 1674 printf("MAP PCI device %d:%d to IRQ %d\n",
1517 1675 device->bus, device->devfn, irq_line);
1518 1676 }
... ... @@ -1545,7 +1703,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1545 1703 }
1546 1704 }
1547 1705 }
1548   -@@ -1900,7 +1993,7 @@
  1706 +@@ -1900,7 +1998,7 @@
1549 1707 goto out;
1550 1708 }
1551 1709 ret = (pci_u_t *)newd;
... ... @@ -1554,7 +1712,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1554 1712 /* register PCI device in OF tree */
1555 1713 if (bridge->dev.common.type == PCI_FAKE_BRIDGE) {
1556 1714 newd->common.OF_private =
1557   -@@ -1927,6 +2020,9 @@
  1715 +@@ -1927,6 +2025,9 @@
1558 1716 /* Handle 64 bits memory mapping */
1559 1717 continue;
1560 1718 }
... ... @@ -1564,7 +1722,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1564 1722 addr = 0x10 + (i * sizeof(uint32_t));
1565 1723 /* Get region size
1566 1724 * Note: we assume it's always a power of 2
1567   -@@ -1935,7 +2031,7 @@
  1725 +@@ -1935,7 +2036,7 @@
1568 1726 smask = pci_config_readl(bridge, bus, devfn, addr);
1569 1727 if (smask == 0x00000000 || smask == 0xFFFFFFFF)
1570 1728 continue;
... ... @@ -1573,7 +1731,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1573 1731 /* I/O space */
1574 1732 base = io_base;
1575 1733 /* Align to a minimum of 256 bytes (arbitrary) */
1576   -@@ -1947,6 +2043,8 @@
  1734 +@@ -1947,6 +2048,8 @@
1577 1735 /* Align to a minimum of 64 kB (arbitrary) */
1578 1736 min_align = 1 << 16;
1579 1737 amask = 0x0000000F;
... ... @@ -1582,7 +1740,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1582 1740 }
1583 1741 omask = smask & amask;
1584 1742 smask &= ~amask;
1585   -@@ -1980,7 +2078,10 @@
  1743 +@@ -1980,7 +2083,10 @@
1586 1744 if (irq_pin > 0) {
1587 1745 /* assign the IRQ */
1588 1746 irq_pin = ((devfn >> 3) + irq_pin - 1) & 3;
... ... @@ -1594,7 +1752,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1594 1752 int elcr_port, val;
1595 1753 irq_line = prep_pci_irqs[irq_pin];
1596 1754 /* set the IRQ to level-sensitive */
1597   -@@ -1988,14 +2089,22 @@
  1755 +@@ -1988,14 +2094,22 @@
1598 1756 val = inb(elcr_port);
1599 1757 val |= 1 << (irq_line & 7);
1600 1758 outb(elcr_port, val);
... ... @@ -1619,7 +1777,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1619 1777 /* Call special inits if needed */
1620 1778 if (dev->config_cb != NULL)
1621 1779 (*dev->config_cb)(newd);
1622   -@@ -2049,6 +2158,32 @@
  1780 +@@ -2049,6 +2163,32 @@
1623 1781 case ARCH_CHRP:
1624 1782 /* TODO */
1625 1783 break;
... ... @@ -1652,7 +1810,7 @@ diff -wruN --exclude &#39;*~&#39; --exclude &#39;*.o&#39; --exclude &#39;*.bin&#39; --exclude &#39;*.out&#39; --
1652 1810 case ARCH_MAC99:
1653 1811 dev = pci_find_device(0x06, 0x00, 0xFF, checkv, checkp);
1654 1812 if (dev == NULL)
1655   -@@ -2167,6 +2302,30 @@
  1813 +@@ -2167,6 +2307,30 @@
1656 1814 case ARCH_CHRP:
1657 1815 /* TODO */
1658 1816 break;
... ...
pc-bios/ppc_rom.bin
No preview for this file type