More general changes and cleanups, mostly in machine/ now. Also updated SCSI and Network device drivers to use new device init method.

This commit is contained in:
waltje
2017-10-07 22:18:30 -04:00
parent 7f267bba8b
commit ffa22a216c
62 changed files with 450 additions and 570 deletions

View File

@@ -12,10 +12,11 @@
*
* NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go.
*
* Version: @(#)scsi_aha154x.c 1.0.20 2017/10/04
* Version: @(#)scsi_aha154x.c 1.0.21 2017/10/07
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca.
*
* Copyright 2017 Fred N. van Kempen.
*/
#include <stdio.h>
@@ -1994,7 +1995,7 @@ aha_setnvr(aha_t *dev)
/* General initialization routine for all boards. */
static void *
aha_init(int type)
aha_init(device_t *info)
{
aha_t *dev;
@@ -2002,7 +2003,7 @@ aha_init(int type)
dev = malloc(sizeof(aha_t));
if (dev == NULL) return(dev);
memset(dev, 0x00, sizeof(aha_t));
dev->type = type;
dev->type = info->local;
/*
* Set up the (initial) I/O address, IRQ and DMA info.
@@ -2022,7 +2023,7 @@ aha_init(int type)
#endif
/* Perform per-board initialization. */
switch(type) {
switch(dev->type) {
case AHA_154xB:
strcpy(dev->name, "AHA-154xB");
switch(dev->Base) {
@@ -2111,34 +2112,6 @@ aha_init(int type)
}
static void *
aha_154xB_init(device_t *info)
{
return(aha_init(AHA_154xB));
}
static void *
aha_154xC_init(device_t *info)
{
return(aha_init(AHA_154xC));
}
static void *
aha_154xCF_init(device_t *info)
{
return(aha_init(AHA_154xCF));
}
static void *
aha_1640_init(device_t *info)
{
return(aha_init(AHA_1640));
}
static void
aha_close(void *priv)
{
@@ -2276,55 +2249,35 @@ static device_config_t aha_154x_config[] = {
device_t aha1540b_device = {
"Adaptec AHA-1540B",
0,
0,
aha_154xB_init,
aha_close,
NULL,
NULL,
NULL,
NULL,
NULL,
0, AHA_154xB,
aha_init, aha_close, NULL,
NULL, NULL, NULL, NULL,
aha_154x_config
};
device_t aha1542c_device = {
"Adaptec AHA-1542C",
0,
0,
aha_154xC_init,
aha_close,
NULL,
NULL,
NULL,
NULL,
NULL,
AHA_154xC,
aha_init, aha_close, NULL,
NULL, NULL, NULL, NULL,
aha_154x_config
};
device_t aha1542cf_device = {
"Adaptec AHA-1542CF",
0,
0,
aha_154xCF_init,
aha_close,
NULL,
NULL,
NULL,
NULL,
NULL,
AHA_154xCF,
aha_init, aha_close, NULL,
NULL, NULL, NULL, NULL,
aha_154x_config
};
device_t aha1640_device = {
"Adaptec AHA-1640",
DEVICE_MCA,
0,
aha_1640_init,
aha_close,
NULL,
NULL,
NULL,
NULL,
AHA_1640,
aha_init, aha_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -10,11 +10,12 @@
* 0 - BT-545C ISA;
* 1 - BT-958D PCI (but BT-545C ISA on non-PCI machines)
*
* Version: @(#)scsi_buslogic.c 1.0.16 2017/10/04
* Version: @(#)scsi_buslogic.c 1.0.17 2017/10/07
*
* Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
@@ -2863,7 +2864,7 @@ BuslogicDeviceReset(void *p)
static void *
BuslogicInit(int chip)
Buslogic_Init(device_t *info)
{
Buslogic_t *bl;
wchar_t *bios_rom_name;
@@ -2879,12 +2880,12 @@ BuslogicInit(int chip)
bl = malloc(sizeof(Buslogic_t));
memset(bl, 0x00, sizeof(Buslogic_t));
if (!PCI && (chip == CHIP_BUSLOGIC_PCI))
bl->chip = info->local;
if ((bl->chip == CHIP_BUSLOGIC_PCI) && !PCI)
{
chip = CHIP_BUSLOGIC_ISA;
/* This is just wrong. Simply disallow PCI cards in non-PCI systems! */
bl->chip = CHIP_BUSLOGIC_ISA;
}
bl->chip = chip;
bl->Base = device_get_config_hex16("base");
bl->PCIBase = 0;
bl->MMIOBase = 0;
@@ -2892,7 +2893,6 @@ BuslogicInit(int chip)
bl->DmaChannel = device_get_config_int("dma");
bl->has_bios = device_get_config_int("bios");
if (bl->Base != 0) {
if (bl->chip == CHIP_BUSLOGIC_PCI) {
io_sethandler(bl->Base, 4,
@@ -3018,22 +3018,8 @@ BuslogicInit(int chip)
}
static void *
Buslogic_545C_Init(device_t *info)
{
return BuslogicInit(CHIP_BUSLOGIC_ISA);
}
static void *
Buslogic_958D_Init(device_t *info)
{
return BuslogicInit(CHIP_BUSLOGIC_PCI);
}
static void
BuslogicClose(void *p)
Buslogic_Close(void *p)
{
Buslogic_t *bl = (Buslogic_t *)p;
if (bl)
@@ -3143,27 +3129,17 @@ static device_config_t BuslogicConfig[] = {
device_t buslogic_device = {
"Buslogic BT-545C ISA",
0,
0,
Buslogic_545C_Init,
BuslogicClose,
NULL,
NULL,
NULL,
NULL,
NULL,
CHIP_BUSLOGIC_ISA,
Buslogic_Init, Buslogic_Close, NULL,
NULL, NULL, NULL, NULL,
BuslogicConfig
};
device_t buslogic_pci_device = {
"Buslogic BT-958D PCI",
0,
0,
Buslogic_958D_Init,
BuslogicClose,
NULL,
NULL,
NULL,
NULL,
NULL,
CHIP_BUSLOGIC_PCI,
Buslogic_Init, Buslogic_Close, NULL,
NULL, NULL, NULL, NULL,
BuslogicConfig
};