Commit 0d913fdb62765554d613e2fe99b7812ed1c95122

Authored by j_mayer
1 parent be98f1f8

Fix PowerPC boot device selection.

Fix gcc warning in PowerPC PreP machine init routine.
Add second IDE channel to Heathrow Mac machine (still not handled by OHW).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3586 c046a42c-6fe2-441c-8c8c-71466251a162
hw/ppc_chrp.c
@@ -179,10 +179,11 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, @@ -179,10 +179,11 @@ static void ppc_core99_init (int ram_size, int vga_ram_size,
179 /* We consider that NewWorld PowerMac never have any floppy drive 179 /* We consider that NewWorld PowerMac never have any floppy drive
180 * For now, OHW cannot boot from the network. 180 * For now, OHW cannot boot from the network.
181 */ 181 */
182 - for (i = 0; i < boot_device[i] != '\0'; i++) {  
183 - ppc_boot_device = boot_device[i];  
184 - if (ppc_boot_device >= 'c' && ppc_boot_device <= 'f') 182 + for (i = 0; boot_device[i] != '\0'; i++) {
  183 + if (boot_device[i] >= 'c' && boot_device[i] <= 'f') {
  184 + ppc_boot_device = boot_device[i];
185 break; 185 break;
  186 + }
186 } 187 }
187 if (ppc_boot_device == '\0') { 188 if (ppc_boot_device == '\0') {
188 fprintf(stderr, "No valid boot device for Mac99 machine\n"); 189 fprintf(stderr, "No valid boot device for Mac99 machine\n");
hw/ppc_oldworld.c
@@ -113,6 +113,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, @@ -113,6 +113,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
113 int vga_bios_size, bios_size; 113 int vga_bios_size, bios_size;
114 qemu_irq *dummy_irq; 114 qemu_irq *dummy_irq;
115 int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index; 115 int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index;
  116 + int ide_mem_index[2];
116 int ppc_boot_device; 117 int ppc_boot_device;
117 118
118 linux_boot = (kernel_filename != NULL); 119 linux_boot = (kernel_filename != NULL);
@@ -213,18 +214,21 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, @@ -213,18 +214,21 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
213 initrd_base = 0; 214 initrd_base = 0;
214 initrd_size = 0; 215 initrd_size = 0;
215 ppc_boot_device = '\0'; 216 ppc_boot_device = '\0';
216 - for (i = 0; i < boot_device[i] != '\0'; i++) {  
217 - ppc_boot_device = boot_device[i]; 217 + for (i = 0; boot_device[i] != '\0'; i++) {
218 /* TOFIX: for now, the second IDE channel is not properly 218 /* TOFIX: for now, the second IDE channel is not properly
219 - * emulated. The Mac floppy disk are not emulated. 219 + * used by OHW. The Mac floppy disk are not emulated.
220 * For now, OHW cannot boot from the network. 220 * For now, OHW cannot boot from the network.
221 */ 221 */
222 #if 0 222 #if 0
223 - if (ppc_boot_device >= 'a' && ppc_boot_device <= 'f') 223 + if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
  224 + ppc_boot_device = boot_device[i];
224 break; 225 break;
  226 + }
225 #else 227 #else
226 - if (ppc_boot_device >= 'c' && ppc_boot_device <= 'd') 228 + if (boot_device[i] >= 'c' && boot_device[i] <= 'd') {
  229 + ppc_boot_device = boot_device[i];
227 break; 230 break;
  231 + }
228 #endif 232 #endif
229 } 233 }
230 if (ppc_boot_device == '\0') { 234 if (ppc_boot_device == '\0') {
@@ -278,8 +282,12 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, @@ -278,8 +282,12 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
278 nd_table[i].model = "ne2k_pci"; 282 nd_table[i].model = "ne2k_pci";
279 pci_nic_init(pci_bus, &nd_table[i], -1); 283 pci_nic_init(pci_bus, &nd_table[i], -1);
280 } 284 }
281 - 285 +
  286 + /* First IDE channel is a CMD646 on the PCI bus */
282 pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); 287 pci_cmd646_ide_init(pci_bus, &bs_table[0], 0);
  288 + /* Second IDE channel is a MAC IDE on the MacIO bus */
  289 + ide_mem_index[0] = -1;
  290 + ide_mem_index[1] = pmac_ide_init(&bs_table[2], pic[0x0D]);
283 291
284 /* cuda also initialize ADB */ 292 /* cuda also initialize ADB */
285 cuda_init(&cuda_mem_index, pic[0x12]); 293 cuda_init(&cuda_mem_index, pic[0x12]);
@@ -293,7 +301,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, @@ -293,7 +301,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size,
293 dbdma_init(&dbdma_mem_index); 301 dbdma_init(&dbdma_mem_index);
294 302
295 macio_init(pci_bus, 0x0017, 1, pic_mem_index, dbdma_mem_index, 303 macio_init(pci_bus, 0x0017, 1, pic_mem_index, dbdma_mem_index,
296 - cuda_mem_index, nvr, 0, NULL); 304 + cuda_mem_index, nvr, 2, ide_mem_index);
297 305
298 if (usb_enabled) { 306 if (usb_enabled) {
299 usb_ohci_init_pci(pci_bus, 3, -1); 307 usb_ohci_init_pci(pci_bus, 3, -1);
hw/ppc_prep.c
@@ -529,7 +529,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, @@ -529,7 +529,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size,
529 const char *initrd_filename, 529 const char *initrd_filename,
530 const char *cpu_model) 530 const char *cpu_model)
531 { 531 {
532 - CPUState *env, *envs[MAX_CPUS]; 532 + CPUState *env = NULL, *envs[MAX_CPUS];
533 char buf[1024]; 533 char buf[1024];
534 nvram_t nvram; 534 nvram_t nvram;
535 m48t59_t *m48t59; 535 m48t59_t *m48t59;
@@ -614,10 +614,11 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, @@ -614,10 +614,11 @@ static void ppc_prep_init (int ram_size, int vga_ram_size,
614 initrd_size = 0; 614 initrd_size = 0;
615 ppc_boot_device = '\0'; 615 ppc_boot_device = '\0';
616 /* For now, OHW cannot boot from the network. */ 616 /* For now, OHW cannot boot from the network. */
617 - for (i = 0; i < boot_device[i] != '\0'; i++) {  
618 - ppc_boot_device = boot_device[i];  
619 - if (ppc_boot_device >= 'a' && ppc_boot_device <= 'f') 617 + for (i = 0; boot_device[i] != '\0'; i++) {
  618 + if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
  619 + ppc_boot_device = boot_device[i];
620 break; 620 break;
  621 + }
621 } 622 }
622 if (ppc_boot_device == '\0') { 623 if (ppc_boot_device == '\0') {
623 fprintf(stderr, "No valid boot device for Mac99 machine\n"); 624 fprintf(stderr, "No valid boot device for Mac99 machine\n");