diff --git a/src/disk/hdc.c b/src/disk/hdc.c index b7d673bb4..c2a6c8513 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -8,7 +8,7 @@ * * Common code to handle all sorts of disk controllers. * - * Version: @(#)hdc.c 1.0.7 2017/11/08 + * Version: @(#)hdc.c 1.0.8 2017/12/15 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -94,14 +94,9 @@ static struct { { "[ISA] [ESDI] PC/AT ESDI Fixed Disk Adapter", "esdi_at", &esdi_at_wd1007vse1_device, 0 }, -#if 0 { "[ISA] [IDE] PC/AT IDE Adapter", "ide_isa", &ide_isa_device, 0 }, - { "[PCI] [IDE] PCI IDE Adapter", "ide_pci", - &ide_pci_device, 0 }, -#endif - { "[ISA] [IDE] PC/XT XTIDE", "xtide", &xtide_device , 0 }, @@ -117,6 +112,12 @@ static struct { { "[MCA] [ESDI] IBM PS/2 ESDI Fixed Disk Adapter","esdi_mca", &esdi_ps2_device, 1 }, + { "[PCI] [IDE] PCI IDE Adapter", "ide_pci", + &ide_pci_device, 0 }, + + { "[VLB] [IDE] PC/AT IDE Adapter", "vlb_isa", + &ide_vlb_device, 0 }, + { "", "", NULL, 0 } }; diff --git a/src/disk/hdc.h b/src/disk/hdc.h index 7a1223a56..92dbcffff 100644 --- a/src/disk/hdc.h +++ b/src/disk/hdc.h @@ -8,10 +8,11 @@ * * Definitions for the common disk controller handler. * - * Version: @(#)hdc.h 1.0.3 2017/10/01 + * Version: @(#)hdc.h 1.0.4 2017/12/15 * * Authors: Miran Grca, * Fred N. van Kempen, + * * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ @@ -38,6 +39,10 @@ extern device_t mfm_at_wd1003_device; /* mfm_at_wd1003 */ extern device_t esdi_at_wd1007vse1_device; /* esdi_at */ extern device_t esdi_ps2_device; /* esdi_mca */ +extern device_t ide_isa_device; /* isa_ide */ +extern device_t ide_pci_device; /* pci_ide */ +extern device_t ide_vlb_device; /* vlb_ide */ + extern device_t xtide_device; /* xtide_xt */ extern device_t xtide_at_device; /* xtide_at */ extern device_t xtide_ps2_device; /* xtide_ps2 */ diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index eb2228f9d..3c0259abe 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.21 2017/12/09 + * Version: @(#)hdc_ide.c 1.0.22 2017/12/15 * * Authors: Sarah Walker, * Miran Grca, @@ -2426,3 +2426,72 @@ void secondary_ide_check(void) } if (!secondary_cdroms) ide_sec_disable(); } + + +/* + * Initialization of standalone IDE controller instance. + * + * Eventually, we should clean up the whole mess by only + * using device_t units, with configuration parameters to + * indicate primary/secondary and all that, rather than + * keeping a zillion of duplicate functions around. + */ +static void * +ide_sainit(device_t *info) +{ + switch(info->local) { + case 0: /* ISA, single-channel */ + ide_pri_enable(); + ide_bus_master_read = ide_bus_master_write = NULL; + timer_add(ide_callback_pri, &idecallback[0], &idecallback[0], NULL); + break; + + case 1: /* VLB, single-channel */ + ide_pri_enable(); + ide_bus_master_read = ide_bus_master_write = NULL; + timer_add(ide_callback_pri, &idecallback[0], &idecallback[0], NULL); + break; + + case 2: /* PCI, single-channel */ + ide_pri_enable(); + timer_add(ide_callback_pri, &idecallback[0], &idecallback[0], NULL); + break; + } + + return(info); +} + + +/* Close a standalone IDE unit. */ +static void +ide_saclose(void *priv) +{ +} + + +device_t ide_isa_device = { + "ISA PC/AT IDE Controller", + DEVICE_ISA | DEVICE_AT, + 0, + ide_sainit, ide_saclose, NULL, + NULL, NULL, NULL, NULL, + NULL +}; + +device_t ide_pci_device = { + "PCI IDE Controller", + DEVICE_PCI | DEVICE_AT, + 2, + ide_sainit, ide_saclose, NULL, + NULL, NULL, NULL, NULL, + NULL +}; + +device_t ide_vlb_device = { + "VLB IDE Controller", + DEVICE_VLB | DEVICE_AT, + 1, + ide_sainit, ide_saclose, NULL, + NULL, NULL, NULL, NULL, + NULL +};