1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Roto-till the ioctl code. Remove all the groping around in the x86 BIOS

segment, remove the groping around in the Option ROM segments, remove the
bogus tests for bcopy vs. copyout.  There really is no reason for a
management app to know these things other than to create l33t info tables
for the user.
This commit is contained in:
Scott Long 2004-05-05 05:29:19 +00:00
parent 60c3d7b627
commit 1e5532d487
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128945

View File

@ -235,14 +235,12 @@ debug_asr_dump_ccb(union ccb *ccb)
#define debug_usr_cmd_dump_message(message)
#endif /* DEBUG_ASR_USR_CMD */
#define dsDescription_size 46 /* Snug as a bug in a rug */
#include "dev/asr/dptsig.h"
static dpt_sig_S ASR_sig = {
{ 'd', 'P', 't', 'S', 'i', 'G'}, SIG_VERSION, PROC_INTEL,
PROC_386 | PROC_486 | PROC_PENTIUM | PROC_SEXIUM, FT_HBADRVR, 0,
OEM_DPT, OS_FREE_BSD, CAP_ABOVE16MB, DEV_ALL,
ADF_ALL_SC5,
OEM_DPT, OS_FREE_BSD, CAP_ABOVE16MB, DEV_ALL, ADF_ALL_SC5,
0, 0, ASR_VERSION, ASR_REVISION, ASR_SUBREVISION,
ASR_MONTH, ASR_DAY, ASR_YEAR,
/* 01234567890123456789012345678901234567890123456789 < 50 chars */
@ -3494,24 +3492,14 @@ static int
asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
Asr_softc_t *sc = dev->si_drv1;
int i, j;
int error = 0;
int i, error = 0;
if (sc != NULL)
switch(cmd) {
case DPT_SIGNATURE:
#if (dsDescription_size != 50)
case DPT_SIGNATURE + ((50 - dsDescription_size) << 16):
#endif
if (cmd & 0xFFFF0000) {
bcopy(&ASR_sig, data, sizeof(dpt_sig_S));
return (0);
}
/* Traditional version of the ioctl interface */
case DPT_SIGNATURE & 0x0000FFFF:
return (copyout ((caddr_t)(&ASR_sig), *((caddr_t *)data),
sizeof(dpt_sig_S)));
return (copyout((caddr_t)(&ASR_sig), *((caddr_t *)data),
sizeof(dpt_sig_S)));
/* Traditional version of the ioctl interface */
case DPT_CTRLINFO & 0x0000FFFF:
@ -3535,9 +3523,9 @@ asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
CtlrInfo.drvrHBAnum = asr_unit(dev);
CtlrInfo.baseAddr = sc->ha_Base;
i = ASR_getBlinkLedCode (sc);
if (i == -1) {
if (i == -1)
i = 0;
}
CtlrInfo.blinkState = i;
CtlrInfo.pciBusNum = sc->ha_pciBusNum;
CtlrInfo.pciDeviceNum = sc->ha_pciDeviceNum;
@ -3546,42 +3534,16 @@ asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
#define FLG_OSD_I2O 0x0004
CtlrInfo.hbaFlags = FLG_OSD_PCI_VALID|FLG_OSD_DMA|FLG_OSD_I2O;
CtlrInfo.Interrupt = sc->ha_irq;
if (cmd & 0xFFFF0000) {
bcopy(&CtlrInfo, data, sizeof(CtlrInfo));
} else {
error = copyout(&CtlrInfo, *(caddr_t *)data, sizeof(CtlrInfo));
}
error = copyout(&CtlrInfo, *(caddr_t *)data, sizeof(CtlrInfo));
} return (error);
/* Traditional version of the ioctl interface */
case DPT_SYSINFO & 0x0000FFFF:
case DPT_SYSINFO: {
sysInfo_S Info;
char * cp;
/* Kernel Specific ptok `hack' */
#define ptok(a) ((char *)(uintptr_t)(a) + KERNBASE)
bzero(&Info, sizeof(Info));
/* Appears I am the only person in the Kernel doing this */
outb (0x70, 0x12);
i = inb(0x71);
j = i >> 4;
if (i == 0x0f) {
outb (0x70, 0x19);
j = inb (0x71);
}
Info.drive0CMOS = j;
j = i & 0x0f;
if (i == 0x0f) {
outb (0x70, 0x1a);
j = inb (0x71);
}
Info.drive1CMOS = j;
Info.numDrives = *((char *)ptok(0x475));
Info.processorFamily = ASR_sig.dsProcessorFamily;
#if defined(__i386__)
switch (cpu) {
@ -3604,66 +3566,9 @@ asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
/* Info.osRevision = 0; */
/* Info.osSubRevision = 0; */
Info.busType = SI_PCI_BUS;
Info.flags = SI_CMOS_Valid | SI_NumDrivesValid
| SI_OSversionValid | SI_BusTypeValid | SI_NO_SmartROM;
Info.flags = SI_OSversionValid|SI_BusTypeValid|SI_NO_SmartROM;
/* Go Out And Look For I2O SmartROM */
for(j = 0xC8000; j < 0xE0000; j += 2048) {
int k;
cp = ptok(j);
if (*((unsigned short *)cp) != 0xAA55) {
continue;
}
j += (cp[2] * 512) - 2048;
if ((*((u_long *)(cp + 6))
!= ('S' + (' ' * 256) + (' ' * 65536L)))
|| (*((u_long *)(cp + 10))
!= ('I' + ('2' * 256) + ('0' * 65536L)))) {
continue;
}
cp += 0x24;
for (k = 0; k < 64; ++k) {
if (*((unsigned short *)cp)
== (' ' + ('v' * 256))) {
break;
}
}
if (k < 64) {
Info.smartROMMajorVersion
= *((unsigned char *)(cp += 4)) - '0';
Info.smartROMMinorVersion
= *((unsigned char *)(cp += 2));
Info.smartROMRevision
= *((unsigned char *)(++cp));
Info.flags |= SI_SmartROMverValid;
Info.flags &= ~SI_NO_SmartROM;
break;
}
}
/* Get The Conventional Memory Size From CMOS */
outb (0x70, 0x16);
j = inb (0x71);
j <<= 8;
outb (0x70, 0x15);
j |= inb(0x71);
Info.conventionalMemSize = j;
/* Get The Extended Memory Found At Power On From CMOS */
outb (0x70, 0x31);
j = inb (0x71);
j <<= 8;
outb (0x70, 0x30);
j |= inb(0x71);
Info.extendedMemSize = j;
Info.flags |= SI_MemorySizeValid;
/* Copy Out The Info Structure To The User */
if (cmd & 0xFFFF0000) {
bcopy(&Info, data, sizeof(Info));
} else {
error = copyout(&Info, *(caddr_t *)data, sizeof(Info));
}
error = copyout(&Info, *(caddr_t *)data, sizeof(Info));
return (error); }
/* Get The BlinkLED State */
@ -3672,11 +3577,7 @@ asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if (i == -1) {
i = 0;
}
if (cmd & 0xFFFF0000) {
bcopy(&i, data, sizeof(i));
} else {
error = copyout(&i, *(caddr_t *)data, sizeof(i));
}
error = copyout(&i, *(caddr_t *)data, sizeof(i));
break;
/* Send an I2O command */