📄 ohw.diff
字号:
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--- OpenHackWare-release-0.4.org/src/bios.h 2005-04-06 23:20:22.000000000 +0200+++ OpenHackWare-release-0.4/src/bios.h 2005-07-07 01:10:20.000000000 +0200@@ -64,6 +64,7 @@ ARCH_CHRP, ARCH_MAC99, ARCH_POP,+ ARCH_HEATHROW, }; /* Hardware definition(s) */@@ -174,6 +175,7 @@ int bd_ioctl (bloc_device_t *bd, int func, void *args); uint32_t bd_seclen (bloc_device_t *bd); void bd_close (bloc_device_t *bd);+void bd_reset_all(void); uint32_t bd_seclen (bloc_device_t *bd); uint32_t bd_maxbloc (bloc_device_t *bd); void bd_sect2CHS (bloc_device_t *bd, uint32_t secnum,@@ -183,12 +185,12 @@ part_t *bd_probe (int boot_device); bloc_device_t *bd_get (int device); void bd_put (bloc_device_t *bd);-void bd_set_boot_part (bloc_device_t *bd, part_t *partition);+void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum); part_t **_bd_parts (bloc_device_t *bd); void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1, uint32_t io_base2, uint32_t io_base3,- void *OF_private);+ void *OF_private0, void *OF_private1); void ide_pci_pmac_register (uint32_t io_base0, uint32_t io_base1, void *OF_private); @@ -399,17 +401,23 @@ uint16_t min_grant, uint16_t max_latency); void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses); 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); void OF_finalize_pci_macio (void *dev, uint32_t base_address, uint32_t size, void *private_data);+void OF_finalize_pci_ide (void *dev, + uint32_t io_base0, uint32_t io_base1,+ uint32_t io_base2, uint32_t io_base3); int OF_register_bus (const unsigned char *name, uint32_t address, const unsigned char *type); int OF_register_serial (const unsigned char *bus, const unsigned char *name, uint32_t io_base, int irq); int OF_register_stdio (const unsigned char *dev_in, const unsigned char *dev_out);-void OF_vga_register (const unsigned char *name, uint32_t address,- int width, int height, int depth);+void OF_vga_register (const unsigned char *name, unused uint32_t address,+ int width, int height, int depth,+ unsigned long vga_bios_addr, + unsigned long vga_bios_size); void *OF_blockdev_register (void *parent, void *private, const unsigned char *type, const unsigned char *name, int devnum,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--- OpenHackWare-release-0.4.org/src/bloc.c 2005-04-06 23:21:00.000000000 +0200+++ OpenHackWare-release-0.4/src/bloc.c 2005-07-08 00:28:26.000000000 +0200@@ -55,6 +55,7 @@ /* Partitions */ part_t *parts, *bparts; part_t *boot_part;+ int bpartnum; /* Chain */ bloc_device_t *next; };@@ -66,6 +67,7 @@ static int ide_initialize (bloc_device_t *bd, int device); static int ide_read_sector (bloc_device_t *bd, void *buffer, int secnum);+static int ide_reset (bloc_device_t *bd); static int mem_initialize (bloc_device_t *bd, int device); static int mem_read_sector (bloc_device_t *bd, void *buffer, int secnum);@@ -212,6 +214,17 @@ { } +void bd_reset_all(void)+{+ bloc_device_t *bd;+ for (bd = bd_list; bd != NULL; bd = bd->next) {+ if (bd->init == &ide_initialize) {+ /* reset IDE drive because Darwin wants all IDE devices to be reset */+ ide_reset(bd);+ }+ }+}+ uint32_t bd_seclen (bloc_device_t *bd) { return bd->seclen;@@ -223,10 +236,12 @@ } /* XXX: to be suppressed */-void bd_set_boot_part (bloc_device_t *bd, part_t *partition)+void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum) {+ dprintf("%s: part %p (%p) %d\n", __func__, partition, bd->boot_part, partnum); if (bd->boot_part == NULL) { bd->boot_part = partition;+ bd->bpartnum = partnum; } } @@ -240,6 +255,13 @@ return &bd->bparts; } +void bd_set_boot_device (bloc_device_t *bd)+{+#if defined (USE_OPENFIRMWARE)+ OF_blockdev_set_boot_device(bd->OF_private, bd->bpartnum, "\\\\ofwboot");+#endif+}+ part_t *bd_probe (int boot_device) { char devices[] = { /*'a', 'b',*/ 'c', 'd', 'e', 'f', 'm', '\0', };@@ -272,9 +294,7 @@ tmp = part_probe(bd, force_raw); if (boot_device == bd->device) { boot_part = tmp;-#if defined (USE_OPENFIRMWARE)- OF_blockdev_set_boot_device(bd->OF_private, 2, "\\\\ofwboot");-#endif+ bd_set_boot_device(bd); } } @@ -717,34 +737,29 @@ /* IDE PCI access for pc */ static uint8_t ide_pci_port_read (bloc_device_t *bd, int port) {- eieio();-- return *(uint8_t *)(bd->io_base + port);+ uint8_t value;+ value = inb(bd->io_base + port);+ return value; } static void ide_pci_port_write (bloc_device_t *bd, int port, uint8_t value) {- *(uint8_t *)(bd->io_base + port) = value;- eieio();+ outb(bd->io_base + port, value); } static uint32_t ide_pci_data_readl (bloc_device_t *bd) {- eieio();-- return *((uint32_t *)bd->io_base);+ return inl(bd->io_base); } static void ide_pci_data_writel (bloc_device_t *bd, uint32_t val) {- *(uint32_t *)(bd->io_base) = val;- eieio();+ outl(bd->io_base, val); } static void ide_pci_control_write (bloc_device_t *bd, uint32_t val) {- *((uint8_t *)bd->tmp) = val;- eieio();+ outb(bd->tmp + 2, val); } static ide_ops_t ide_pci_pc_ops = {@@ -761,7 +776,7 @@ void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1, uint32_t io_base2, uint32_t io_base3,- unused void *OF_private)+ void *OF_private0, void *OF_private1) { if (ide_pci_ops == NULL) { ide_pci_ops = malloc(sizeof(ide_ops_t));@@ -770,19 +785,19 @@ memcpy(ide_pci_ops, &ide_pci_pc_ops, sizeof(ide_ops_t)); } if ((io_base0 != 0 || io_base1 != 0) &&- ide_pci_ops->base[0] == 0 && ide_pci_ops->base[1] == 0) {+ ide_pci_ops->base[0] == 0 && ide_pci_ops->base[2] == 0) { ide_pci_ops->base[0] = io_base0;- ide_pci_ops->base[1] = io_base1;+ ide_pci_ops->base[2] = io_base1; #ifdef USE_OPENFIRMWARE- ide_pci_ops->OF_private[0] = OF_private;+ ide_pci_ops->OF_private[0] = OF_private0; #endif } if ((io_base2 != 0 || io_base3 != 0) &&- ide_pci_ops->base[2] == 0 && ide_pci_ops->base[3] == 0) {- ide_pci_ops->base[2] = io_base2;+ ide_pci_ops->base[1] == 0 && ide_pci_ops->base[3] == 0) {+ ide_pci_ops->base[1] = io_base2; ide_pci_ops->base[3] = io_base3; #ifdef USE_OPENFIRMWARE- ide_pci_ops->OF_private[1] = OF_private;+ ide_pci_ops->OF_private[1] = OF_private1; #endif } }@@ -935,6 +950,8 @@ } static void atapi_pad_req (void *buffer, int len);+static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,+ int maxlen); static int atapi_read_sector (bloc_device_t *bd, void *buffer, int secnum); static int ide_initialize (bloc_device_t *bd, int device)@@ -1035,9 +1052,7 @@ DPRINTF("INQUIRY\n"); len = spc_inquiry_req(&atapi_buffer, 36); atapi_pad_req(&atapi_buffer, len);- ide_port_write(bd, 0x07, 0xA0);- for (i = 0; i < 3; i++)- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));+ atapi_make_req(bd, atapi_buffer, 36); status = ide_port_read(bd, 0x07); if (status != 0x48) { ERROR("ATAPI INQUIRY : status %0x != 0x48\n", status);@@ -1053,9 +1068,7 @@ DPRINTF("READ_CAPACITY\n"); len = mmc_read_capacity_req(&atapi_buffer); atapi_pad_req(&atapi_buffer, len);- ide_port_write(bd, 0x07, 0xA0);- for (i = 0; i < 3; i++)- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));+ atapi_make_req(bd, atapi_buffer, 8); status = ide_port_read(bd, 0x07); if (status != 0x48) { ERROR("ATAPI READ_CAPACITY : status %0x != 0x48\n", status);@@ -1105,6 +1118,22 @@ memset(p + len, 0, 12 - len); } +static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,+ int maxlen)+{+ int i;+ /* select drive */+ if (bd->drv == 0)+ ide_port_write(bd, 0x06, 0x40);+ else+ ide_port_write(bd, 0x06, 0x50);+ ide_port_write(bd, 0x04, maxlen & 0xff);+ ide_port_write(bd, 0x05, (maxlen >> 8) & 0xff);+ ide_port_write(bd, 0x07, 0xA0);+ for (i = 0; i < 3; i++)+ ide_data_writel(bd, ldswap32(&buffer[i]));+}+ static int atapi_read_sector (bloc_device_t *bd, void *buffer, int secnum) { uint32_t atapi_buffer[4];@@ -1112,16 +1141,9 @@ uint32_t status, value; int i, len; - /* select drive */- if (bd->drv == 0)- ide_port_write(bd, 0x06, 0x40);- else- ide_port_write(bd, 0x06, 0x50); len = mmc_read12_req(atapi_buffer, secnum, 1); atapi_pad_req(&atapi_buffer, len);- ide_port_write(bd, 0x07, 0xA0);- for (i = 0; i < 3; i++)- ide_data_writel(bd, ldswap32(&atapi_buffer[i]));+ atapi_make_req(bd, atapi_buffer, bd->seclen); status = ide_port_read(bd, 0x07); if (status != 0x48) { ERROR("ATAPI READ12 : status %0x != 0x48\n", status);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--- OpenHackWare-release-0.4.org/src/libpart/apple.c 2005-03-31 09:23:33.000000000 +0200+++ OpenHackWare-release-0.4/src/libpart/apple.c 2005-07-03 16:17:41.000000000 +0200@@ -199,14 +199,18 @@ if (len == 0) { /* Place holder. Skip it */ DPRINTF("%s placeholder part\t%d\n", __func__, i);+ part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;+ part_register(bd, part, name, i); } else if (strncmp("Apple_Void", type, 32) == 0) { /* Void partition. Skip it */ DPRINTF("%s Void part\t%d [%s]\n", __func__, i, type);+ part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;+ part_register(bd, part, name, i); } else if (strncmp("Apple_Free", type, 32) == 0) { /* Free space. Skip it */ DPRINTF("%s Free part (%d)\n", __func__, i); part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;- part_register(bd, part, name);+ part_register(bd, part, name, i); } else if (strncmp("Apple_partition_map", type, 32) == 0 || strncmp("Apple_Partition_Map", type, 32) == 0 #if 0 // Is this really used or is it just a mistake ?@@ -226,7 +230,7 @@ */ } part->flags = PART_TYPE_APPLE | PART_FLAG_DUMMY;- part_register(bd, part, name);+ part_register(bd, part, name, i); } else if (strncmp("Apple_Driver", type, 32) == 0 || strncmp("Apple_Driver43", type, 32) == 0 || strncmp("Apple_Driver43_CD", type, 32) == 0 ||@@ -236,8 +240,12 @@ strncmp("Apple_Driver_IOKit", type, 32) == 0) { /* Drivers. don't care for now */ DPRINTF("%s Drivers part\t%d [%s]\n", __func__, i, type);+ part->flags = PART_TYPE_APPLE | PART_FLAG_DRIVER;+ part_register(bd, part, name, i); } else if (strncmp("Apple_Patches", type, 32) == 0) { /* Patches: don't care for now */+ part->flags = PART_TYPE_APPLE | PART_FLAG_PATCH;+ part_register(bd, part, name, i); DPRINTF("%s Patches part\t%d [%s]\n", __func__, i, type); } else if (strncmp("Apple_HFS", type, 32) == 0 || strncmp("Apple_MFS", type, 32) == 0 ||@@ -256,9 +264,8 @@ count = partmap->bloc_cnt * HFS_BLOCSIZE; if (partmap->boot_size == 0 || partmap->boot_load == 0) { printf("Not a bootable partition %d %d (%p %p)\n",- partmap->boot_size, partmap->boot_load,boot_part, part);- if (boot_part == NULL)- boot_part = part;+ partmap->boot_size, partmap->boot_load,+ boot_part, part); part->flags = PART_TYPE_APPLE | PART_FLAG_FS; } else { part->boot_start.bloc = partmap->boot_start;@@ -278,8 +285,8 @@ boot_part = part; part->flags = PART_TYPE_APPLE | PART_FLAG_FS | PART_FLAG_BOOT; }- printf("Partition: %d %s st %0x size %0x",- i, name, partmap->start_bloc, partmap->bloc_cnt);+ printf("Partition: %d '%s' '%s' st %0x size %0x",+ i, name, type, partmap->start_bloc, partmap->bloc_cnt); #ifndef DEBUG printf("\n"); #endif@@ -290,11 +297,13 @@ part->boot_load, part->boot_entry); DPRINTF(" load %0x entry %0x %0x\n", partmap->boot_load2, partmap->boot_entry2, HFS_BLOCSIZE);- part_register(bd, part, name);+ part_register(bd, part, name, i); } else { memcpy(tmp, type, 32); tmp[32] = '\0';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -