Fixed to support RSA98-III non-pnp mode. rman_get_start() had returned

iobase + 8 because the I/O address table for RSA98-III starts with +8.
Now, bus_alloc_resource() is used instead of isa_alloc_resourcev() if
device type is RSA98III.
This commit is contained in:
Yoshihiro Takahashi 2000-06-21 11:21:14 +00:00
parent cf5af79cac
commit b5f05e294c
2 changed files with 74 additions and 58 deletions

View file

@ -807,36 +807,42 @@ static bus_addr_t port_table_1[] =
{0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e};
static bus_addr_t port_table_8[] =
{0x000, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700};
static bus_addr_t port_table_rsa[] =
{0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f};
static bus_addr_t port_table_rsa[] = {
0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f,
0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007
};
struct {
char *name;
short irr_read;
short irr_write;
bus_addr_t *port_table;
bus_addr_t *iat;
bus_size_t iatsz;
struct speedtab *speedtab;
} if_16550a_type[] = {
/* COM_IF_RSA98 */
{ " (RSA-98)", -1, -1, port_table_0, comspeedtab },
{" (RSA-98)", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_NS16550 */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_SECOND_CCU */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_MC16550II */
{ " (MC16550II)", -1, 0x1000, port_table_8, comspeedtab_mc16550 },
{" (MC16550II)", -1, 0x1000, port_table_8, IO_COMSIZE,
comspeedtab_mc16550},
/* COM_IF_MCRS98 */
{ " (MC-RS98)", -1, 0x1000, port_table_8, comspeedtab_mc16550 },
{" (MC-RS98)", -1, 0x1000, port_table_8, IO_COMSIZE,
comspeedtab_mc16550},
/* COM_IF_RSB3000 */
{ " (RSB-3000)", 0xbf, -1, port_table_1, comspeedtab_rsb384 },
{" (RSB-3000)", 0xbf, -1, port_table_1, IO_COMSIZE,
comspeedtab_rsb384},
/* COM_IF_RSB384 */
{ " (RSB-384)", 0xbf, -1, port_table_1, comspeedtab_rsb384 },
{" (RSB-384)", 0xbf, -1, port_table_1, IO_COMSIZE, comspeedtab_rsb384},
/* COM_IF_MODEM_CARD */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_RSA98III */
{ " (RSA-98III)", -1, -1, port_table_rsa, comspeedtab_rsa },
{" (RSA-98III)", -1, -1, port_table_rsa, 16, comspeedtab_rsa},
/* COM_IF_ESP98 */
{ " (ESP98)", -1, -1, port_table_1, comspeedtab_mc16550 },
{" (ESP98)", -1, -1, port_table_1, IO_COMSIZE, comspeedtab_mc16550},
};
#endif /* PC98 */
@ -1188,13 +1194,14 @@ sioprobe(dev, xrid)
if (IS_8251(iod.if_type)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, 1, RF_ACTIVE);
} else if (isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
} else if (iod.if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[iod.if_type & 0x0f].port_table,
IO_COMSIZE, RF_ACTIVE);
if_16550a_type[iod.if_type & 0x0f].iat,
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
@ -1205,8 +1212,8 @@ sioprobe(dev, xrid)
#ifdef PC98
if (!IS_8251(iod.if_type)) {
if (isa_load_resourcev(port,
if_16550a_type[iod.if_type & 0x0f].port_table,
IO_COMSIZE) != 0) {
if_16550a_type[iod.if_type & 0x0f].iat,
if_16550a_type[iod.if_type & 0x0f].iatsz) != 0) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return ENXIO;
}
@ -1248,7 +1255,7 @@ sioprobe(dev, xrid)
if (IS_8251(xiftype))
outb((xioport & 0xff00) | PC98SIO_cmd_port(xiftype & 0x0f), 0xf2);
else
outb(xioport + if_16550a_type[xiftype & 0x0f].port_table[com_mcr], 0);
outb(xioport + if_16550a_type[xiftype & 0x0f].iat[com_mcr], 0);
}
}
#else
@ -1722,13 +1729,14 @@ sioattach(dev, xrid)
if (IS_8251(if_type)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, 1, RF_ACTIVE);
} else if (isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
} else if (if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[if_type & 0x0f].port_table,
IO_COMSIZE, RF_ACTIVE);
if_16550a_type[if_type & 0x0f].iat,
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
@ -1739,8 +1747,8 @@ sioattach(dev, xrid)
#ifdef PC98
if (!IS_8251(if_type)) {
if (isa_load_resourcev(port,
if_16550a_type[if_type & 0x0f].port_table,
IO_COMSIZE) != 0) {
if_16550a_type[if_type & 0x0f].iat,
if_16550a_type[if_type & 0x0f].iatsz) != 0) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return ENXIO;
}
@ -1807,7 +1815,7 @@ sioattach(dev, xrid)
com->pc98_8251fifo_enable = 0;
}
} else {
bus_addr_t *iat = if_16550a_type[if_type & 0x0f].port_table;
bus_addr_t *iat = if_16550a_type[if_type & 0x0f].iat;
com->data_port = iobase + iat[com_data];
com->int_id_port = iobase + iat[com_iir];

View file

@ -807,36 +807,42 @@ static bus_addr_t port_table_1[] =
{0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e};
static bus_addr_t port_table_8[] =
{0x000, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700};
static bus_addr_t port_table_rsa[] =
{0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f};
static bus_addr_t port_table_rsa[] = {
0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f,
0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007
};
struct {
char *name;
short irr_read;
short irr_write;
bus_addr_t *port_table;
bus_addr_t *iat;
bus_size_t iatsz;
struct speedtab *speedtab;
} if_16550a_type[] = {
/* COM_IF_RSA98 */
{ " (RSA-98)", -1, -1, port_table_0, comspeedtab },
{" (RSA-98)", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_NS16550 */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_SECOND_CCU */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_MC16550II */
{ " (MC16550II)", -1, 0x1000, port_table_8, comspeedtab_mc16550 },
{" (MC16550II)", -1, 0x1000, port_table_8, IO_COMSIZE,
comspeedtab_mc16550},
/* COM_IF_MCRS98 */
{ " (MC-RS98)", -1, 0x1000, port_table_8, comspeedtab_mc16550 },
{" (MC-RS98)", -1, 0x1000, port_table_8, IO_COMSIZE,
comspeedtab_mc16550},
/* COM_IF_RSB3000 */
{ " (RSB-3000)", 0xbf, -1, port_table_1, comspeedtab_rsb384 },
{" (RSB-3000)", 0xbf, -1, port_table_1, IO_COMSIZE,
comspeedtab_rsb384},
/* COM_IF_RSB384 */
{ " (RSB-384)", 0xbf, -1, port_table_1, comspeedtab_rsb384 },
{" (RSB-384)", 0xbf, -1, port_table_1, IO_COMSIZE, comspeedtab_rsb384},
/* COM_IF_MODEM_CARD */
{ "", -1, -1, port_table_0, comspeedtab },
{"", -1, -1, port_table_0, IO_COMSIZE, comspeedtab},
/* COM_IF_RSA98III */
{ " (RSA-98III)", -1, -1, port_table_rsa, comspeedtab_rsa },
{" (RSA-98III)", -1, -1, port_table_rsa, 16, comspeedtab_rsa},
/* COM_IF_ESP98 */
{ " (ESP98)", -1, -1, port_table_1, comspeedtab_mc16550 },
{" (ESP98)", -1, -1, port_table_1, IO_COMSIZE, comspeedtab_mc16550},
};
#endif /* PC98 */
@ -1188,13 +1194,14 @@ sioprobe(dev, xrid)
if (IS_8251(iod.if_type)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, 1, RF_ACTIVE);
} else if (isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
} else if (iod.if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[iod.if_type & 0x0f].port_table,
IO_COMSIZE, RF_ACTIVE);
if_16550a_type[iod.if_type & 0x0f].iat,
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
@ -1205,8 +1212,8 @@ sioprobe(dev, xrid)
#ifdef PC98
if (!IS_8251(iod.if_type)) {
if (isa_load_resourcev(port,
if_16550a_type[iod.if_type & 0x0f].port_table,
IO_COMSIZE) != 0) {
if_16550a_type[iod.if_type & 0x0f].iat,
if_16550a_type[iod.if_type & 0x0f].iatsz) != 0) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return ENXIO;
}
@ -1248,7 +1255,7 @@ sioprobe(dev, xrid)
if (IS_8251(xiftype))
outb((xioport & 0xff00) | PC98SIO_cmd_port(xiftype & 0x0f), 0xf2);
else
outb(xioport + if_16550a_type[xiftype & 0x0f].port_table[com_mcr], 0);
outb(xioport + if_16550a_type[xiftype & 0x0f].iat[com_mcr], 0);
}
}
#else
@ -1722,13 +1729,14 @@ sioattach(dev, xrid)
if (IS_8251(if_type)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, 1, RF_ACTIVE);
} else if (isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
} else if (if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[if_type & 0x0f].port_table,
IO_COMSIZE, RF_ACTIVE);
if_16550a_type[if_type & 0x0f].iat,
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
@ -1739,8 +1747,8 @@ sioattach(dev, xrid)
#ifdef PC98
if (!IS_8251(if_type)) {
if (isa_load_resourcev(port,
if_16550a_type[if_type & 0x0f].port_table,
IO_COMSIZE) != 0) {
if_16550a_type[if_type & 0x0f].iat,
if_16550a_type[if_type & 0x0f].iatsz) != 0) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return ENXIO;
}
@ -1807,7 +1815,7 @@ sioattach(dev, xrid)
com->pc98_8251fifo_enable = 0;
}
} else {
bus_addr_t *iat = if_16550a_type[if_type & 0x0f].port_table;
bus_addr_t *iat = if_16550a_type[if_type & 0x0f].iat;
com->data_port = iobase + iat[com_data];
com->int_id_port = iobase + iat[com_iir];