mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
- Removed unecesary code.
- Correct smapi32_new() asm (still doesn't work.) - Attach to mainboard not isa.
This commit is contained in:
parent
49b2a6863b
commit
95ca467a68
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109463
@ -117,9 +117,14 @@ smapi_ioctl (dev, cmd, data, fflag, td)
|
||||
error = 0;
|
||||
break;
|
||||
case SMAPIOCGFUNCTION:
|
||||
#if 1
|
||||
smapi32_segment = SMAPI32_SEGMENT;
|
||||
smapi32_offset = sc->smapi32_entry;
|
||||
error = smapi32((struct smapi_bios_parameter *)data,
|
||||
error = smapi32(
|
||||
#else
|
||||
error = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
|
||||
#endif
|
||||
(struct smapi_bios_parameter *)data,
|
||||
(struct smapi_bios_parameter *)data);
|
||||
break;
|
||||
default:
|
||||
@ -133,9 +138,6 @@ smapi_ioctl (dev, cmd, data, fflag, td)
|
||||
int
|
||||
smapi_attach (struct smapi_softc *sc)
|
||||
{
|
||||
struct smapi_bios_parameter input_param;
|
||||
struct smapi_bios_parameter output_param;
|
||||
int retval;
|
||||
|
||||
sc->cdev = make_dev(&smapi_cdevsw,
|
||||
device_get_unit(sc->dev),
|
||||
@ -144,17 +146,6 @@ smapi_attach (struct smapi_softc *sc)
|
||||
smapi_cdevsw.d_name,
|
||||
device_get_unit(sc->dev));
|
||||
|
||||
bzero(&input_param, sizeof(struct smapi_bios_parameter));
|
||||
bzero(&output_param, sizeof(struct smapi_bios_parameter));
|
||||
smapi32_segment = SMAPI32_SEGMENT;
|
||||
smapi32_offset = sc->smapi32_entry;
|
||||
retval = smapi32(&output_param, &output_param);
|
||||
|
||||
#if 0
|
||||
retval = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
|
||||
&output_param, &output_param);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
||||
.data
|
||||
smapi32_segment_tmp: .word 0
|
||||
smapi32_offset_tmp: .long 0
|
||||
.text
|
||||
/*
|
||||
* smapi32(input_param, output_param)
|
||||
@ -36,10 +33,12 @@ ENTRY(smapi32)
|
||||
*/
|
||||
ENTRY(smapi32_new)
|
||||
pushl %ebp /* Save frame */
|
||||
movl 0x08(%esp),%ebp
|
||||
movl %ebp,smapi32_offset_tmp
|
||||
movw 0x0c(%esp),%bp
|
||||
movw %bp,smapi32_segment_tmp
|
||||
movl %esp,%ebp
|
||||
|
||||
movl 0x08(%ebp),%eax
|
||||
movl %eax,smapi32_offset
|
||||
movw 0x0c(%ebp),%ax
|
||||
movw %ax,smapi32_segment
|
||||
|
||||
pushl %ds
|
||||
pushl 0x20(%ebp) /* Output Param */
|
||||
@ -47,8 +46,8 @@ ENTRY(smapi32_new)
|
||||
pushl 0x10(%ebp) /* Input Param */
|
||||
|
||||
movl $0,%eax
|
||||
movw %cs,smapi32_segment_tmp
|
||||
lcall *(smapi32_offset_tmp)
|
||||
movw %cs,smapi32_segment
|
||||
lcall *(smapi32_offset)
|
||||
|
||||
leave
|
||||
ret
|
||||
|
@ -38,9 +38,6 @@
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
#include <isa/pnpvar.h>
|
||||
|
||||
/* And all this for BIOS_PADDRTOVADDR() */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
@ -58,13 +55,6 @@ static int smapi_modevent (module_t, int, void *);
|
||||
|
||||
static int smapi_header_cksum (struct smapi_bios_header *);
|
||||
|
||||
#define SMAPI_ID 0x0000a24d
|
||||
|
||||
static struct isa_pnp_id smapi_ids[] = {
|
||||
{ SMAPI_ID, NULL }, /* SMB0000 */
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#define SMAPI_START 0xf0000
|
||||
#define SMAPI_END 0xffff0
|
||||
#define SMAPI_STEP 0x10
|
||||
@ -73,23 +63,21 @@ static struct isa_pnp_id smapi_ids[] = {
|
||||
(h->signature[1] == 'S') && \
|
||||
(h->signature[2] == 'M') && \
|
||||
(h->signature[3] == 'B'))
|
||||
#define RES2HEADER(res) ((struct smapi_bios_header *)rman_get_virtual(res))
|
||||
|
||||
static void
|
||||
smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
{
|
||||
device_t child;
|
||||
struct resource *res;
|
||||
struct smapi_bios_header *header;
|
||||
u_int32_t chunk;
|
||||
int rid;
|
||||
|
||||
rid = 0;
|
||||
chunk = SMAPI_START;
|
||||
|
||||
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, "smapi", -1);
|
||||
child = BUS_ADD_CHILD(parent, 0, "smapi", -1);
|
||||
device_set_driver(child, driver);
|
||||
isa_set_logicalid(child, SMAPI_ID);
|
||||
isa_set_vendorid(child, SMAPI_ID);
|
||||
|
||||
while (chunk < SMAPI_END) {
|
||||
bus_set_resource(child, SYS_RES_MEMORY, rid, chunk,
|
||||
@ -101,14 +89,9 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
chunk += SMAPI_STEP;
|
||||
continue;
|
||||
}
|
||||
header = (struct smapi_bios_header *)rman_get_virtual(res);
|
||||
|
||||
if (SMAPI_SIGNATURE(header)) {
|
||||
if (smapi_header_cksum(header)) {
|
||||
device_printf(child, "SMAPI header checksum failed.\n");
|
||||
} else {
|
||||
if (SMAPI_SIGNATURE(RES2HEADER(res))) {
|
||||
goto found;
|
||||
}
|
||||
} else {
|
||||
bus_release_resource(child, SYS_RES_MEMORY, rid, res);
|
||||
bus_delete_resource(child, SYS_RES_MEMORY, rid);
|
||||
@ -121,6 +104,7 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
return;
|
||||
|
||||
found:
|
||||
bus_release_resource(child, SYS_RES_MEMORY, rid, res);
|
||||
device_set_desc(child, "SMAPI BIOS");
|
||||
return;
|
||||
}
|
||||
@ -128,7 +112,30 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
static int
|
||||
smapi_isa_probe (device_t dev)
|
||||
{
|
||||
return (ISA_PNP_PROBE(device_get_parent(dev), dev, smapi_ids));
|
||||
struct resource *res;
|
||||
int rid;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
rid = 0;
|
||||
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
|
||||
0ul, ~0ul, 1, RF_ACTIVE);
|
||||
if (res == NULL) {
|
||||
device_printf(dev, "Unable to allocate memory resource.\n");
|
||||
error = ENOMEM;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (smapi_header_cksum(RES2HEADER(res))) {
|
||||
device_printf(dev, "SMAPI header checksum failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
bad:
|
||||
if (res)
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -154,21 +161,17 @@ smapi_isa_attach (device_t dev)
|
||||
sc->header->prot32_segment +
|
||||
sc->header->prot32_offset);
|
||||
|
||||
if (smapi_header_cksum(sc->header)) {
|
||||
device_printf(dev, "SMAPI header checksum failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (smapi_attach(sc)) {
|
||||
device_printf(dev, "SMAPI attach failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
device_printf(dev, "Version %02d.%02d, Length %d, Checksum 0x%02x\n",
|
||||
sc->header->version_major, sc->header->version_minor,
|
||||
sc->header->length, sc->header->checksum);
|
||||
device_printf(dev, "Version %d.%02d, Length %d, Checksum 0x%02x\n",
|
||||
bcd2bin(sc->header->version_major),
|
||||
bcd2bin(sc->header->version_minor),
|
||||
sc->header->length,
|
||||
sc->header->checksum);
|
||||
device_printf(dev, "Information=0x%b\n",
|
||||
sc->header->information,
|
||||
"\020"
|
||||
@ -254,7 +257,7 @@ static driver_t smapi_driver = {
|
||||
sizeof(struct smapi_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(smapi, isa, smapi_driver, smapi_devclass, smapi_modevent, 0);
|
||||
DRIVER_MODULE(smapi, legacy, smapi_driver, smapi_devclass, smapi_modevent, 0);
|
||||
MODULE_VERSION(smapi, 1);
|
||||
|
||||
static int
|
||||
|
@ -117,9 +117,14 @@ smapi_ioctl (dev, cmd, data, fflag, td)
|
||||
error = 0;
|
||||
break;
|
||||
case SMAPIOCGFUNCTION:
|
||||
#if 1
|
||||
smapi32_segment = SMAPI32_SEGMENT;
|
||||
smapi32_offset = sc->smapi32_entry;
|
||||
error = smapi32((struct smapi_bios_parameter *)data,
|
||||
error = smapi32(
|
||||
#else
|
||||
error = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
|
||||
#endif
|
||||
(struct smapi_bios_parameter *)data,
|
||||
(struct smapi_bios_parameter *)data);
|
||||
break;
|
||||
default:
|
||||
@ -133,9 +138,6 @@ smapi_ioctl (dev, cmd, data, fflag, td)
|
||||
int
|
||||
smapi_attach (struct smapi_softc *sc)
|
||||
{
|
||||
struct smapi_bios_parameter input_param;
|
||||
struct smapi_bios_parameter output_param;
|
||||
int retval;
|
||||
|
||||
sc->cdev = make_dev(&smapi_cdevsw,
|
||||
device_get_unit(sc->dev),
|
||||
@ -144,17 +146,6 @@ smapi_attach (struct smapi_softc *sc)
|
||||
smapi_cdevsw.d_name,
|
||||
device_get_unit(sc->dev));
|
||||
|
||||
bzero(&input_param, sizeof(struct smapi_bios_parameter));
|
||||
bzero(&output_param, sizeof(struct smapi_bios_parameter));
|
||||
smapi32_segment = SMAPI32_SEGMENT;
|
||||
smapi32_offset = sc->smapi32_entry;
|
||||
retval = smapi32(&output_param, &output_param);
|
||||
|
||||
#if 0
|
||||
retval = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
|
||||
&output_param, &output_param);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
||||
.data
|
||||
smapi32_segment_tmp: .word 0
|
||||
smapi32_offset_tmp: .long 0
|
||||
.text
|
||||
/*
|
||||
* smapi32(input_param, output_param)
|
||||
@ -36,10 +33,12 @@ ENTRY(smapi32)
|
||||
*/
|
||||
ENTRY(smapi32_new)
|
||||
pushl %ebp /* Save frame */
|
||||
movl 0x08(%esp),%ebp
|
||||
movl %ebp,smapi32_offset_tmp
|
||||
movw 0x0c(%esp),%bp
|
||||
movw %bp,smapi32_segment_tmp
|
||||
movl %esp,%ebp
|
||||
|
||||
movl 0x08(%ebp),%eax
|
||||
movl %eax,smapi32_offset
|
||||
movw 0x0c(%ebp),%ax
|
||||
movw %ax,smapi32_segment
|
||||
|
||||
pushl %ds
|
||||
pushl 0x20(%ebp) /* Output Param */
|
||||
@ -47,8 +46,8 @@ ENTRY(smapi32_new)
|
||||
pushl 0x10(%ebp) /* Input Param */
|
||||
|
||||
movl $0,%eax
|
||||
movw %cs,smapi32_segment_tmp
|
||||
lcall *(smapi32_offset_tmp)
|
||||
movw %cs,smapi32_segment
|
||||
lcall *(smapi32_offset)
|
||||
|
||||
leave
|
||||
ret
|
||||
|
@ -38,9 +38,6 @@
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
#include <isa/pnpvar.h>
|
||||
|
||||
/* And all this for BIOS_PADDRTOVADDR() */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
@ -58,13 +55,6 @@ static int smapi_modevent (module_t, int, void *);
|
||||
|
||||
static int smapi_header_cksum (struct smapi_bios_header *);
|
||||
|
||||
#define SMAPI_ID 0x0000a24d
|
||||
|
||||
static struct isa_pnp_id smapi_ids[] = {
|
||||
{ SMAPI_ID, NULL }, /* SMB0000 */
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#define SMAPI_START 0xf0000
|
||||
#define SMAPI_END 0xffff0
|
||||
#define SMAPI_STEP 0x10
|
||||
@ -73,23 +63,21 @@ static struct isa_pnp_id smapi_ids[] = {
|
||||
(h->signature[1] == 'S') && \
|
||||
(h->signature[2] == 'M') && \
|
||||
(h->signature[3] == 'B'))
|
||||
#define RES2HEADER(res) ((struct smapi_bios_header *)rman_get_virtual(res))
|
||||
|
||||
static void
|
||||
smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
{
|
||||
device_t child;
|
||||
struct resource *res;
|
||||
struct smapi_bios_header *header;
|
||||
u_int32_t chunk;
|
||||
int rid;
|
||||
|
||||
rid = 0;
|
||||
chunk = SMAPI_START;
|
||||
|
||||
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, "smapi", -1);
|
||||
child = BUS_ADD_CHILD(parent, 0, "smapi", -1);
|
||||
device_set_driver(child, driver);
|
||||
isa_set_logicalid(child, SMAPI_ID);
|
||||
isa_set_vendorid(child, SMAPI_ID);
|
||||
|
||||
while (chunk < SMAPI_END) {
|
||||
bus_set_resource(child, SYS_RES_MEMORY, rid, chunk,
|
||||
@ -101,14 +89,9 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
chunk += SMAPI_STEP;
|
||||
continue;
|
||||
}
|
||||
header = (struct smapi_bios_header *)rman_get_virtual(res);
|
||||
|
||||
if (SMAPI_SIGNATURE(header)) {
|
||||
if (smapi_header_cksum(header)) {
|
||||
device_printf(child, "SMAPI header checksum failed.\n");
|
||||
} else {
|
||||
if (SMAPI_SIGNATURE(RES2HEADER(res))) {
|
||||
goto found;
|
||||
}
|
||||
} else {
|
||||
bus_release_resource(child, SYS_RES_MEMORY, rid, res);
|
||||
bus_delete_resource(child, SYS_RES_MEMORY, rid);
|
||||
@ -121,6 +104,7 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
return;
|
||||
|
||||
found:
|
||||
bus_release_resource(child, SYS_RES_MEMORY, rid, res);
|
||||
device_set_desc(child, "SMAPI BIOS");
|
||||
return;
|
||||
}
|
||||
@ -128,7 +112,30 @@ smapi_isa_identify (driver_t *driver, device_t parent)
|
||||
static int
|
||||
smapi_isa_probe (device_t dev)
|
||||
{
|
||||
return (ISA_PNP_PROBE(device_get_parent(dev), dev, smapi_ids));
|
||||
struct resource *res;
|
||||
int rid;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
rid = 0;
|
||||
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
|
||||
0ul, ~0ul, 1, RF_ACTIVE);
|
||||
if (res == NULL) {
|
||||
device_printf(dev, "Unable to allocate memory resource.\n");
|
||||
error = ENOMEM;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (smapi_header_cksum(RES2HEADER(res))) {
|
||||
device_printf(dev, "SMAPI header checksum failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
bad:
|
||||
if (res)
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -154,21 +161,17 @@ smapi_isa_attach (device_t dev)
|
||||
sc->header->prot32_segment +
|
||||
sc->header->prot32_offset);
|
||||
|
||||
if (smapi_header_cksum(sc->header)) {
|
||||
device_printf(dev, "SMAPI header checksum failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (smapi_attach(sc)) {
|
||||
device_printf(dev, "SMAPI attach failed.\n");
|
||||
error = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
device_printf(dev, "Version %02d.%02d, Length %d, Checksum 0x%02x\n",
|
||||
sc->header->version_major, sc->header->version_minor,
|
||||
sc->header->length, sc->header->checksum);
|
||||
device_printf(dev, "Version %d.%02d, Length %d, Checksum 0x%02x\n",
|
||||
bcd2bin(sc->header->version_major),
|
||||
bcd2bin(sc->header->version_minor),
|
||||
sc->header->length,
|
||||
sc->header->checksum);
|
||||
device_printf(dev, "Information=0x%b\n",
|
||||
sc->header->information,
|
||||
"\020"
|
||||
@ -254,7 +257,7 @@ static driver_t smapi_driver = {
|
||||
sizeof(struct smapi_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(smapi, isa, smapi_driver, smapi_devclass, smapi_modevent, 0);
|
||||
DRIVER_MODULE(smapi, legacy, smapi_driver, smapi_devclass, smapi_modevent, 0);
|
||||
MODULE_VERSION(smapi, 1);
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user