(linenum→info "unix/slp.c:2238")

qemu/0.9.1/pc-bios/ohw.diff

    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: --- 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-07 01:10:20.000000000 +0200
    4: @@ -64,6 +64,7 @@
    5:      ARCH_CHRP,
    6:      ARCH_MAC99,
    7:      ARCH_POP,
    8: +    ARCH_HEATHROW,
    9:  };
   10:  
   11:  /* Hardware definition(s) */
   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 @@
   21:  part_t *bd_probe (int boot_device);
   22:  bloc_device_t *bd_get (int device);
   23:  void bd_put (bloc_device_t *bd);
   24: -void bd_set_boot_part (bloc_device_t *bd, part_t *partition);
   25: +void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum);
   26:  part_t **_bd_parts (bloc_device_t *bd);
   27:  
   28:  void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
   29:                            uint32_t io_base2, uint32_t io_base3,
   30: -                          void *OF_private);
   31: +                          void *OF_private0, void *OF_private1);
   32:  void ide_pci_pmac_register (uint32_t io_base0, uint32_t io_base1,
   33:                              void *OF_private);
   34:  
   35: @@ -399,17 +401,23 @@
   36:                                uint16_t min_grant, uint16_t max_latency);
   37:  void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses);
   38:  void OF_finalize_pci_device (void *dev, uint8_t bus, uint8_t devfn,
   39: -                             uint32_t *regions, uint32_t *sizes);
   40: +                             uint32_t *regions, uint32_t *sizes,
   41: +                             int irq_line);
   42:  void OF_finalize_pci_macio (void *dev, uint32_t base_address, uint32_t size,
   43:                              void *private_data);
   44: +void OF_finalize_pci_ide (void *dev, 
   45: +                          uint32_t io_base0, uint32_t io_base1,
   46: +                          uint32_t io_base2, uint32_t io_base3);
   47:  int OF_register_bus (const unsigned char *name, uint32_t address,
   48:                       const unsigned char *type);
   49:  int OF_register_serial (const unsigned char *bus, const unsigned char *name,
   50:                          uint32_t io_base, int irq);
   51:  int OF_register_stdio (const unsigned char *dev_in,
   52:                         const unsigned char *dev_out);
   53: -void OF_vga_register (const unsigned char *name, uint32_t address,
   54: -                      int width, int height, int depth);
   55: +void OF_vga_register (const unsigned char *name, unused uint32_t address,
   56: +                      int width, int height, int depth,
   57: +                      unsigned long vga_bios_addr, 
   58: +                      unsigned long vga_bios_size);
   59:  void *OF_blockdev_register (void *parent, void *private,
   60:                              const unsigned char *type,
   61:                              const unsigned char *name, int devnum,
   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
   63: --- OpenHackWare-release-0.4.org/src/bloc.c     2005-04-06 23:21:00.000000000 +0200
   64: +++ OpenHackWare-release-0.4/src/bloc.c 2005-07-08 00:28:26.000000000 +0200
   65: @@ -55,6 +55,7 @@
   66:      /* Partitions */
   67:      part_t *parts, *bparts;
   68:      part_t *boot_part;
   69: +    int bpartnum;
   70:      /* Chain */
   71:      bloc_device_t *next;
   72:  };
   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 @@
  100:  }
  101:  
  102:  /* XXX: to be suppressed */
  103: -void bd_set_boot_part (bloc_device_t *bd, part_t *partition)
  104: +void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum)
  105:  {
  106: +    dprintf("%s: part %p (%p) %d\n", __func__, partition, bd->boot_part, partnum);
  107:      if (bd->boot_part == NULL) {
  108:          bd->boot_part = partition;
  109: +        bd->bpartnum = partnum;
  110:      }
  111:  }
  112:  
  113: @@ -240,6 +255,13 @@
  114:      return &bd->bparts;
  115:  }
  116:  
  117: +void bd_set_boot_device (bloc_device_t *bd)
  118: +{
  119: +#if defined (USE_OPENFIRMWARE)
  120: +    OF_blockdev_set_boot_device(bd->OF_private, bd->bpartnum, "\\\\ofwboot");
  121: +#endif
  122: +}
  123: +
  124:  part_t *bd_probe (int boot_device)
  125:  {
  126:      char devices[] = { /*'a', 'b',*/ 'c', 'd', 'e', 'f', 'm', '\0', };
  127: @@ -272,9 +294,7 @@
  128:          tmp = part_probe(bd, force_raw);
  129:          if (boot_device == bd->device) {
  130:              boot_part = tmp;
  131: -#if defined (USE_OPENFIRMWARE)
  132: -            OF_blockdev_set_boot_device(bd->OF_private, 2, "\\\\ofwboot");
  133: -#endif
  134: +            bd_set_boot_device(bd);
  135:          }
  136:      }
  137:  
  138: @@ -717,34 +737,29 @@
  139:  /* IDE PCI access for pc */
  140:  static uint8_t ide_pci_port_read (bloc_device_t *bd, int port)
  141:  {
  142: -    eieio();
  143: -
  144: -    return *(uint8_t *)(bd->io_base + port);
  145: +    uint8_t value;
  146: +    value = inb(bd->io_base + port);
  147: +    return value;
  148:  }
  149:  
  150:  static void ide_pci_port_write (bloc_device_t *bd, int port, uint8_t value)
  151:  {
  152: -    *(uint8_t *)(bd->io_base + port) = value;
  153: -    eieio();
  154: +    outb(bd->io_base + port, value);
  155:  }
  156:  
  157:  static uint32_t ide_pci_data_readl (bloc_device_t *bd)
  158:  {
  159: -    eieio();
  160: -
  161: -    return *((uint32_t *)bd->io_base);
  162: +    return inl(bd->io_base);
  163:  }
  164:  
  165:  static void ide_pci_data_writel (bloc_device_t *bd, uint32_t val)
  166:  {
  167: -    *(uint32_t *)(bd->io_base) = val;
  168: -    eieio();
  169: +    outl(bd->io_base, val);
  170:  }
  171:  
  172:  static void ide_pci_control_write (bloc_device_t *bd, uint32_t val)
  173:  {
  174: -    *((uint8_t *)bd->tmp) = val;
  175: -    eieio();
  176: +    outb(bd->tmp + 2, val);
  177:  }
  178:  
  179:  static ide_ops_t ide_pci_pc_ops = {
  180: @@ -761,7 +776,7 @@
  181:  
  182:  void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
  183:                            uint32_t io_base2, uint32_t io_base3,
  184: -                          unused void *OF_private)
  185: +                          void *OF_private0, void *OF_private1)
  186:  {
  187:      if (ide_pci_ops == NULL) {
  188:          ide_pci_ops = malloc(sizeof(ide_ops_t));
  189: @@ -770,19 +785,19 @@
  190:          memcpy(ide_pci_ops, &ide_pci_pc_ops, sizeof(ide_ops_t));
  191:      }
  192:      if ((io_base0 != 0 || io_base1 != 0) &&
  193: -        ide_pci_ops->base[0] == 0 && ide_pci_ops->base[1] == 0) {
  194: +        ide_pci_ops->base[0] == 0 && ide_pci_ops->base[2] == 0) {
  195:          ide_pci_ops->base[0] = io_base0;
  196: -        ide_pci_ops->base[1] = io_base1;
  197: +        ide_pci_ops->base[2] = io_base1;
  198:  #ifdef USE_OPENFIRMWARE
  199: -        ide_pci_ops->OF_private[0] = OF_private;
  200: +        ide_pci_ops->OF_private[0] = OF_private0;
  201:  #endif
  202:      }
  203:      if ((io_base2 != 0 || io_base3 != 0) &&
  204: -        ide_pci_ops->base[2] == 0 && ide_pci_ops->base[3] == 0) {
  205: -        ide_pci_ops->base[2] = io_base2;
  206: +        ide_pci_ops->base[1] == 0 && ide_pci_ops->base[3] == 0) {
  207: +        ide_pci_ops->base[1] = io_base2;
  208:          ide_pci_ops->base[3] = io_base3;
  209:  #ifdef USE_OPENFIRMWARE
  210: -        ide_pci_ops->OF_private[1] = OF_private;
  211: +        ide_pci_ops->OF_private[1] = OF_private1;
  212:  #endif
  213:      }
  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);
  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
  288: --- OpenHackWare-release-0.4.org/src/libpart/apple.c    2005-03-31 09:23:33.000000000 +0200
  289: +++ OpenHackWare-release-0.4/src/libpart/apple.c        2005-07-03 16:17:41.000000000 +0200
  290: @@ -199,14 +199,18 @@
  291:          if (len == 0) {
  292:              /* Place holder. Skip it */
  293:              DPRINTF("%s placeholder part\t%d\n", __func__, i);
  294: +            part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;
  295: +            part_register(bd, part, name, i);
  296:          } else if (strncmp("Apple_Void", type, 32) == 0) {
  297:              /* Void partition. Skip it */
  298:              DPRINTF("%s Void part\t%d [%s]\n", __func__, i, type);
  299: +            part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;
  300: +            part_register(bd, part, name, i);
  301:          } else if (strncmp("Apple_Free", type, 32) == 0) {
  302:              /* Free space. Skip it */
  303:              DPRINTF("%s Free part (%d)\n", __func__, i);
  304:              part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;
  305: -            part_register(bd, part, name);
  306: +            part_register(bd, part, name, i);
  307:          } else if (strncmp("Apple_partition_map", type, 32) == 0 ||
  308:                     strncmp("Apple_Partition_Map", type, 32) == 0
  309:  #if 0 // Is this really used or is it just a mistake ?
  310: @@ -226,7 +230,7 @@
  311:                   */
  312:              }
  313:              part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;
  314: -            part_register(bd, part, name);
  315: +            part_register(bd, part, name, i);
  316:          } else if (strncmp("Apple_Driver", type, 32) == 0 ||
  317:                     strncmp("Apple_Driver43", type, 32) == 0 ||
  318:                     strncmp("Apple_Driver43_CD", type, 32) == 0 ||
  319: @@ -236,8 +240,12 @@
  320:                     strncmp("Apple_Driver_IOKit", type, 32) == 0) {
  321:              /* Drivers. don't care for now */
  322:              DPRINTF("%s Drivers part\t%d [%s]\n", __func__, i, type);
  323: +            part->flags = PART_TYPE_APPLE | PART_FLAG_DRIVER;
  324: +            part_register(bd, part, name, i);
  325:          } else if (strncmp("Apple_Patches", type, 32) == 0) {
  326:              /* Patches: don't care for now */
  327: +            part->flags = PART_TYPE_APPLE | PART_FLAG_PATCH;
  328: +            part_register(bd, part, name, i);
  329:              DPRINTF("%s Patches part\t%d [%s]\n", __func__, i, type);
  330:          } else if (strncmp("Apple_HFS", type, 32) == 0 ||
  331:                     strncmp("Apple_MFS", type, 32) == 0 ||
  332: @@ -256,9 +264,8 @@
  333:              count = partmap->bloc_cnt * HFS_BLOCSIZE;
  334:              if (partmap->boot_size == 0 || partmap->boot_load == 0) {
  335:                  printf("Not a bootable partition %d %d (%p %p)\n",
  336: -                       partmap->boot_size, partmap->boot_load,boot_part, part);
  337: -                if (boot_part == NULL)
  338: -                    boot_part = part;
  339: +                       partmap->boot_size, partmap->boot_load,
  340: +                       boot_part, part);
  341:                  part->flags = PART_TYPE_APPLE | PART_FLAG_FS;
  342:              } else {
  343:                  part->boot_start.bloc = partmap->boot_start;
  344: @@ -278,8 +285,8 @@
  345:                  boot_part = part;
  346:                  part->flags = PART_TYPE_APPLE | PART_FLAG_FS | PART_FLAG_BOOT;
  347:              }
  348: -            printf("Partition: %d %s st %0x size %0x",
  349: -                    i, name, partmap->start_bloc, partmap->bloc_cnt);
  350: +            printf("Partition: %d '%s' '%s' st %0x size %0x",
  351: +                    i, name, type, partmap->start_bloc, partmap->bloc_cnt);
  352:  #ifndef DEBUG
  353:              printf("\n");
  354:  #endif
  355: @@ -290,11 +297,13 @@
  356:                      part->boot_load, part->boot_entry);
  357:              DPRINTF("                           load %0x entry %0x %0x\n",
  358:                      partmap->boot_load2, partmap->boot_entry2, HFS_BLOCSIZE);
  359: -            part_register(bd, part, name);
  360: +            part_register(bd, part, name, i);
  361:          } else {
  362:              memcpy(tmp, type, 32);
  363:              tmp[32] = '\0';
  364:              ERROR("Unknown partition type [%s]\n", tmp);
  365: +            part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;
  366: +            part_register(bd, part, name, i);
  367:          }
  368:      }
  369:   error:
  370: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/core.c OpenHackWare-release-0.4/src/libpart/core.c
  371: --- OpenHackWare-release-0.4.org/src/libpart/core.c     2005-03-31 09:23:33.000000000 +0200
  372: +++ OpenHackWare-release-0.4/src/libpart/core.c 2005-07-03 16:17:41.000000000 +0200
  373: @@ -126,7 +126,7 @@
  374:  }
  375:  
  376:  int part_register (bloc_device_t *bd, part_t *partition,
  377: -                   const unsigned char *name)
  378: +                   const unsigned char *name, int partnum)
  379:  {
  380:      part_t **cur;
  381:  
  382: @@ -134,6 +134,7 @@
  383:      partition->bd = bd;
  384:      partition->next = NULL;
  385:      partition->name = strdup(name);
  386: +    partition->partnum = partnum;
  387:      for (cur = _bd_parts(bd); *cur != NULL; cur = &(*cur)->next)
  388:          continue;
  389:      *cur = partition;
  390: @@ -141,29 +142,15 @@
  391:      return 0;
  392:  }
  393:  
  394: -static inline int set_boot_part (bloc_device_t *bd, int partnum)
  395: -{
  396: -    part_t *cur;
  397: -
  398: -    cur = part_get(bd, partnum);
  399: -    if (cur == NULL)
  400: -        return -1;
  401: -    bd_set_boot_part(bd, cur);
  402: -
  403: -    return 0;
  404: -}
  405: -
  406:  part_t *part_get (bloc_device_t *bd, int partnum)
  407:  {
  408:      part_t **listp, *cur;
  409: -    int i;
  410:  
  411:      listp = _bd_parts(bd);
  412: -    cur = *listp;
  413: -    for (i = 0; i != partnum; i++) {
  414: -        if (cur == NULL)
  415: +    
  416: +    for (cur = *listp; cur != NULL; cur = cur->next) {
  417: +        if (cur->partnum == partnum)
  418:              break;
  419: -        cur = cur->next;
  420:      }
  421:      
  422:      return cur;
  423: @@ -192,17 +179,20 @@
  424:      part_set_blocsize(bd, part, 512);
  425:      part->bd = bd;
  426:      part->flags = PART_TYPE_RAW | PART_FLAG_BOOT;
  427: -    part_register(bd, part, "Raw");
  428: +    part_register(bd, part, "Raw", 0);
  429:  
  430:      return part;
  431:  }
  432:  
  433: +bloc_device_t *part_get_bd (part_t *part)
  434: +{
  435: +    return part->bd;
  436: +}
  437: +
  438:  part_t *part_probe (bloc_device_t *bd, int set_raw)
  439:  {
  440: -    part_t *part0, *boot_part, **cur;
  441: +    part_t *part0 = NULL, *boot_part, **cur;
  442:  
  443: -    /* Register the 0 partition: raw partition containing the whole disk */
  444: -    part0 = part_get_raw(bd);
  445:      /* Try to find a valid boot partition */
  446:      boot_part = Apple_probe_partitions(bd);
  447:      if (boot_part == NULL) {
  448: @@ -210,10 +200,13 @@
  449:          if (boot_part == NULL && arch == ARCH_PREP)
  450:              boot_part = PREP_find_partition(bd);
  451:          if (boot_part == NULL && set_raw != 0) {
  452: -            boot_part = part0;
  453: -            set_boot_part(bd, 0);
  454: +            dprintf("Use bloc device as raw partition\n");
  455:          }
  456:      }
  457: +    if (_bd_parts(bd) == NULL) {
  458: +        /* Register the 0 partition: raw partition containing the whole disk */
  459: +        part0 = part_get_raw(bd);
  460: +    }
  461:      /* Probe filesystem on each found partition */
  462:      for (cur = _bd_parts(bd); *cur != NULL; cur = &(*cur)->next) {
  463:          const unsigned char *map, *type;
  464: @@ -248,23 +241,28 @@
  465:              type = "unknown";
  466:              break;
  467:          }
  468: -        DPRINTF("Probe filesystem on %s %s partition '%s' %s\n",
  469: +        dprintf("Probe filesystem on %s %s partition '%s' %s %p\n",
  470:                  type, map, (*cur)->name,
  471: -                ((*cur)->flags) & PART_FLAG_BOOT ? "(bootable)" : "");
  472: +                ((*cur)->flags) & PART_FLAG_BOOT ? "(bootable)" : "", *cur);
  473:          if (((*cur)->flags) & PART_FLAG_FS) {
  474:              if (((*cur)->flags) & PART_FLAG_BOOT)
  475:                  (*cur)->fs = fs_probe(*cur, 1);
  476:              else
  477:                  (*cur)->fs = fs_probe(*cur, 0);
  478: +        } else if (((*cur)->flags) & PART_TYPE_RAW) {
  479: +            (*cur)->fs = fs_probe(*cur, 2);
  480:          } else {
  481:              (*cur)->fs = fs_probe(*cur, 2);
  482:          }
  483: -        if (((*cur)->flags) & PART_FLAG_BOOT) {
  484: -            bd_set_boot_part(bd, *cur);
  485:              fs_get_bootfile((*cur)->fs);
  486: +        if (((*cur)->flags) & PART_FLAG_BOOT) {
  487: +            dprintf("Partition is bootable (%d)\n", (*cur)->partnum);
  488: +            bd_set_boot_part(bd, *cur, (*cur)->partnum);
  489: +            if (boot_part == NULL)
  490: +                boot_part = *cur;
  491:          }
  492:      }
  493: -    DPRINTF("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,
  494: +    dprintf("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,
  495:              part_fs(boot_part), part0);
  496:  
  497:      return boot_part;
  498: @@ -279,6 +277,7 @@
  499:      part->boot_size.offset = 0;
  500:      part->boot_load = 0;
  501:      part->boot_entry = 0;
  502: +    part->flags |= PART_FLAG_BOOT;
  503:  
  504:      return 0;
  505:  }
  506: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/isofs.c OpenHackWare-release-0.4/src/libpart/isofs.c
  507: --- OpenHackWare-release-0.4.org/src/libpart/isofs.c    2005-03-31 09:23:33.000000000 +0200
  508: +++ OpenHackWare-release-0.4/src/libpart/isofs.c        2005-07-03 16:17:41.000000000 +0200
  509: @@ -242,7 +242,7 @@
  510:                     part->boot_start.bloc, part->boot_size.bloc,
  511:                     part->boot_load, part->boot_entry);
  512:              part->flags = PART_TYPE_ISO9660 | PART_FLAG_BOOT;
  513: -            part_register(bd, part, name);
  514: +            part_register(bd, part, name, i + 1);
  515:              fs_raw_set_bootfile(part, part->boot_start.bloc,
  516:                                  part->boot_start.offset,
  517:                                  part->boot_size.bloc,
  518: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/libpart.h OpenHackWare-release-0.4/src/libpart/libpart.h
  519: --- OpenHackWare-release-0.4.org/src/libpart/libpart.h  2005-03-31 09:23:33.000000000 +0200
  520: +++ OpenHackWare-release-0.4/src/libpart/libpart.h      2005-07-03 16:17:41.000000000 +0200
  521: @@ -30,6 +30,7 @@
  522:  
  523:  struct part_t {
  524:      bloc_device_t *bd;
  525: +    int partnum;
  526:      uint32_t start;      /* Partition first bloc             */
  527:      uint32_t size;       /* Partition size, in blocs         */
  528:      uint32_t spb;
  529: @@ -54,7 +55,7 @@
  530:  };
  531:  
  532:  int part_register (bloc_device_t *bd, part_t *partition,
  533: -                   const unsigned char *name);
  534: +                   const unsigned char *name, int partnum);
  535:  void part_set_blocsize (bloc_device_t *bd, part_t *part, uint32_t blocsize);
  536:  void part_private_set (part_t *part, void *private);
  537:  void *part_private_get (part_t *part);
  538: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/prep.c OpenHackWare-release-0.4/src/libpart/prep.c
  539: --- OpenHackWare-release-0.4.org/src/libpart/prep.c     2005-03-31 09:23:33.000000000 +0200
  540: +++ OpenHackWare-release-0.4/src/libpart/prep.c 2005-07-03 16:17:41.000000000 +0200
  541: @@ -164,7 +164,7 @@
  542:              part->boot_load = 0;
  543:              part->boot_entry = boot_offset - part->bloc_size;
  544:              part->flags = PART_TYPE_PREP | PART_FLAG_BOOT;
  545: -            part_register(bd, part, "PREP boot");
  546: +            part_register(bd, part, "PREP boot", i);
  547:              fs_raw_set_bootfile(part, part->boot_start.bloc,
  548:                                  part->boot_start.offset,
  549:                                  part->boot_size.bloc,
  550: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/main.c OpenHackWare-release-0.4/src/main.c
  551: --- OpenHackWare-release-0.4.org/src/main.c     2005-03-31 09:23:33.000000000 +0200
  552: +++ OpenHackWare-release-0.4/src/main.c 2005-06-07 23:48:39.000000000 +0200
  553: @@ -364,20 +364,24 @@
  554:      void *load_base, *load_entry, *last_alloc, *load_end;
  555:      uint32_t memsize, boot_image_size, cmdline_size, ramdisk_size;
  556:      uint32_t boot_base, boot_nb;
  557: -    int boot_device;
  558: +    int boot_device, i;
  559: +    static const uint32_t isa_base_tab[3] = {
  560: +        0x80000000, /* PREP */
  561: +        0xFE000000, /* Grackle (Heathrow) */
  562: +        0xF2000000, /* UniNorth (Mac99)  */
  563: +    };
  564:  
  565:      /* Retrieve NVRAM configuration */
  566: - nvram_retry:
  567: +    for(i = 0; i < 3; i++) {
  568: +        isa_io_base = isa_base_tab[i];
  569:      nvram = NVRAM_get_config(&memsize, &boot_device,
  570:                               &boot_image, &boot_image_size,
  571:                               &cmdline, &cmdline_size,
  572:                               &ramdisk, &ramdisk_size);
  573: -    if (nvram == NULL) {
  574: -        /* Retry with another isa_io_base */
  575: -        if (isa_io_base == 0x80000000) {
  576: -            isa_io_base = 0xF2000000;
  577: -            goto nvram_retry;
  578: +        if (nvram)
  579: +            break;
  580:          }
  581: +    if (i == 3) {
  582:          ERROR("Unable to load configuration from NVRAM. Aborting...\n");
  583:          return -1;
  584:      }
  585: @@ -402,7 +406,7 @@
  586:          cpu_name = CPU_get_name(pvr);
  587:          OF_register_cpu(cpu_name, 0, pvr,
  588:                          200 * 1000 * 1000, 200 * 1000 * 1000,
  589: -                        100 * 1000 * 1000, 10 * 1000 * 1000,
  590: +                        100 * 1000 * 1000, 100 * 1000 * 1000,
  591:                          0x0092);
  592:      }
  593:      OF_register_memory(memsize, 512 * 1024 /* TOFIX */);
  594: @@ -433,9 +437,12 @@
  595:      vga_puts(copyright);
  596:      vga_puts("\n");
  597:  
  598: +#if 0
  599:      /* QEMU is quite incoherent: d is cdrom, not second drive */
  600: +    /* XXX: should probe CD-ROM position */
  601:      if (boot_device == 'd')
  602:          boot_device = 'e';
  603: +#endif
  604:      /* Open boot device */
  605:      boot_part = bd_probe(boot_device);
  606:      if (boot_device == 'm') {
  607: diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/nvram.c OpenHackWare-release-0.4/src/nvram.c
  608: --- OpenHackWare-release-0.4.org/src/nvram.c    2005-03-31 09:23:33.000000000 +0200
  609: +++ OpenHackWare-release-0.4/src/nvram.c        2005-06-04 23:44:03.000000000 +0200
  610: @@ -334,6 +334,7 @@
  611:          ret = NVRAM_chrp_format(nvram);
  612:          break;
  613:      case ARCH_MAC99:
  614: +    case ARCH_HEATHROW: /* XXX: may be incorrect */
  615:          ret = NVRAM_mac99_format(nvram);
  616:          break;
  617:      case ARCH_POP:
  618: @@ -409,13 +410,12 @@
  619:          arch = ARCH_MAC99;
  620:      } else if (strcmp(sign, "POP") == 0) {
  621:          arch = ARCH_POP;
  622: +    } else if (strcmp(sign, "HEATHROW") == 0) {
  623: +        arch = ARCH_HEATHROW;
  624:      } else {
  625:          ERROR("Unknown PPC architecture: '%s'\n", sign);
  626:          return NULL;
  627:      }
  628: -    /* HACK */
  629: -    if (arch == ARCH_CHRP)
  630: -        arch = ARCH_MAC99;
  631:      lword = NVRAM_get_lword(nvram, 0x30);
  632:      *RAM_size = lword;
  633:      byte = NVRAM_get_byte(nvram, 0x34);
  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
  635: --- OpenHackWare-release-0.4.org/src/of.c       2005-04-06 23:17:26.000000000 +0200
  636: +++ OpenHackWare-release-0.4/src/of.c   2005-07-07 23:30:08.000000000 +0200
  637: @@ -489,7 +489,7 @@
  638:          ERROR("%s can't alloc new node '%s' name\n", __func__, name);
  639:          return NULL;
  640:      }
  641: -    new->prop_address = OF_prop_int_new(env, new, "address", address);
  642: +    new->prop_address = OF_prop_int_new(env, new, "unit-address", address);
  643:      if (new->prop_address == NULL) {
  644:          free(new->prop_name->value);
  645:          free(new->prop_name);
  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 @@
  681:  __attribute__ (( section (".OpenFirmware") ))
  682:  int OF_init (void)
  683:  {
  684: -    const unsigned char compat_str[] =
  685:  #if 0
  686:          "PowerMac3,1\0MacRISC\0Power Macintosh\0";
  687:          "PowerMac1,2\0MacRISC\0Power Macintosh\0";
  688:          "AAPL,PowerMac G3\0PowerMac G3\0MacRISC\0Power Macintosh\0";
  689:          "AAPL,PowerMac3,0\0MacRISC\0Power Macintosh\0";
  690:          "AAPL,Gossamer\0MacRISC\0Power Macintosh\0";
  691: -#else
  692: -        "AAPL,PowerMac G3\0PowerMac G3\0MacRISC\0Power Macintosh\0";
  693:  #endif
  694:      OF_env_t *OF_env;
  695:      OF_node_t *als, *opt, *chs, *pks;
  696: @@ -1455,15 +1479,21 @@
  697:          return -1;
  698:      }
  699:      OF_prop_string_new(OF_env, OF_node_root, "device_type", "bootrom");
  700: -#if 0
  701: -    OF_prop_string_new(OF_env, OF_node_root,
  702: -                       "model", "PPC Open Hack'Ware " BIOS_VERSION);
  703: -#else
  704: +    if (arch == ARCH_HEATHROW) {
  705: +        const unsigned char compat_str[] =
  706: +            "PowerMac1,1\0MacRISC\0Power Macintosh";
  707: +        OF_property_new(OF_env, OF_node_root, "compatible",
  708: +                        compat_str, sizeof(compat_str));
  709:      OF_prop_string_new(OF_env, OF_node_root,
  710: -                       "model", compat_str);
  711: -#endif
  712: +                           "model", "Power Macintosh");
  713: +    } else {
  714: +        const unsigned char compat_str[] =
  715: +            "PowerMac3,1\0MacRISC\0Power Macintosh";
  716:      OF_property_new(OF_env, OF_node_root, "compatible",
  717:                      compat_str, sizeof(compat_str));
  718: +        OF_prop_string_new(OF_env, OF_node_root,
  719: +                           "model", "PowerMac3,1");
  720: +    }
  721:  #if 0
  722:      OF_prop_string_new(OF_env, OF_node_root, "copyright", copyright);
  723:  #else
  724: @@ -1561,14 +1591,15 @@
  725:          range.size = 0x00800000;
  726:          OF_property_new(OF_env, rom, "ranges", &range, sizeof(OF_range_t));
  727:          OF_prop_int_new(OF_env, rom, "#address-cells", 1);
  728: +
  729:          /* "/rom/boot-rom@fff00000" node */
  730: -        brom = OF_node_new(OF_env, OF_node_root, "boot-rom", 0xfff00000);
  731: +        brom = OF_node_new(OF_env, rom, "boot-rom", 0xfff00000);
  732:          if (brom == NULL) {
  733:              ERROR("Cannot create 'boot-rom'\n");
  734:              return -1;
  735:          }
  736:          regs.address = 0xFFF00000;
  737: -        regs.size = 0x00010000;
  738: +        regs.size = 0x00100000;
  739:          OF_property_new(OF_env, brom, "reg", &regs, sizeof(OF_regprop_t));
  740:          OF_prop_string_new(OF_env, brom, "write-characteristic", "flash");
  741:          OF_prop_string_new(OF_env, brom, "BootROM-build-date",
  742: @@ -1577,7 +1608,7 @@
  743:          OF_prop_string_new(OF_env, brom, "copyright", copyright);
  744:          OF_prop_string_new(OF_env, brom, "model", BIOS_str);
  745:          OF_prop_int_new(OF_env, brom, "result", 0);
  746: -#if 0
  747: +#if 1
  748:          {
  749:              /* Hack taken 'as-is' from PearPC */
  750:              unsigned char info[] = {
  751: @@ -1596,7 +1627,9 @@
  752:          OF_node_put(OF_env, brom);
  753:          OF_node_put(OF_env, rom);
  754:      }
  755: +#if 0
  756:      /* From here, hardcoded hacks to get a Mac-like machine */
  757: +    /* XXX: Core99 does not seem