spacing, formatting improvements to a couple functions

This commit is contained in:
TomAwezome 2020-04-28 03:01:59 -04:00
parent fca85b80c8
commit 540818a34c
4 changed files with 85 additions and 64 deletions

View file

@ -1,5 +1,8 @@
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
$IV,1$----04/27/20 15:34:42----$IV,0$
$IV,1$----04/28/20 02:54:41----$IV,0$
* Improved spacing somewhat in $LK+PU,"BlkDevsInitAll",A="FF:::/Kernel/BlkDev/DiskAddDev.CC,BlkDevsInitAll"$, $LK+PU,"GetBaseUnit",A="FF:::/Kernel/BlkDev/DiskAddDev.CC,GetBaseUnit"$, $LK+PU,"BootDVDProbeAll",A="FF:::/Kernel/BlkDev/DiskATAId.CC,BootDVDProbeAll"$, and $LK+PU,"BootDVDProbe",A="FF:::/Kernel/BlkDev/DiskATAId.CC,BootDVDProbe"$.$IV,1$
----04/27/20 15:34:42----$IV,0$
* Changed $LK+PU,"GrBitMap",A="FI:::/Zenith/Gr/GrBitMap.CC"$ to use non-timer rand for drawing speed improvement on multicore.$IV,1$
----04/22/20 03:09:47----$IV,0$

View file

@ -1,22 +1,27 @@
Bool BootDVDProbe(CBlkDev *bd)
{
U8 *img=CAlloc(DVD_BLK_SIZE);
U8 *img = CAlloc(DVD_BLK_SIZE);
I64 i;
Bool res=FALSE;
"Port: %04X,%04X Unit: %02X ",bd->base0,bd->base1,bd->unit;
if (ATAProbe(bd->base0,bd->base1,bd->unit)==BDT_ATAPI) {
Bool res = FALSE;
"Port: %04X,%04X Unit: %02X ", bd->base0, bd->base1, bd->unit;
if (ATAProbe(bd->base0, bd->base1, bd->unit) == BDT_ATAPI)
{
" ATAPI";
if (ATAPIStartStop(bd,tS+5.0,TRUE)) {
if (ATAPIStartStop(bd, tS + 5.0, TRUE))
{
" Started";
for (i=0;i<2;i++) {//Retry
if (ATAPIReadBlks2(bd,tS+7.0,img,sys_boot_blk,1,FALSE)) {
if ((img+sys_boot_src.u16[1]<<BLK_SIZE_BITS)(CKernel *)
->compile_time==sys_compile_time) {
for (i = 0; i < 2; i++)
{//Retry
if (ATAPIReadBlks2(bd, tS + 7.0, img, sys_boot_blk, 1, FALSE))
{
if ((img + sys_boot_src.u16[1] << BLK_SIZE_BITS)(CKernel *)->compile_time == sys_compile_time)
{
" Found\n";
return TRUE;
} else
" Read";
} else
}
else
" NoRead";
}
}
@ -28,36 +33,42 @@ Bool BootDVDProbe(CBlkDev *bd)
Bool BootDVDProbeAll(CBlkDev *bd)
{
I64 d1,d2,i,j,k;
I64 d1, d2, i, j, k;
bd->base1=0;
for (k=0;k<256;k++) {
i=-1;
while (TRUE) {
j=PCIClassFind(0x010100+k,++i);
if (j<0)
bd->base1 = 0;
for (k = 0; k < 256; k++)
{
i = -1;
while (TRUE)
{
j = PCIClassFind(0x010100 + k, ++i);
if (j < 0)
break;
"Subcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
if (d1&1 && d2&1) {
if (bd->base0=d1&~7) {
bd->unit=0;
"Subcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n", k, j.u8[2], j.u8[1], j.u8[0];
d1=PCIReadU32(j.u8[2], j.u8[1], j.u8[0], 0x10);
d2=PCIReadU32(j.u8[2], j.u8[1], j.u8[0], 0x14);
if (d1&1 && d2&1)
{
if (bd->base0 = d1 & ~7)
{
bd->unit = 0;
if (BootDVDProbe(bd))
return TRUE;
bd->unit=1;
bd->unit = 1;
if (BootDVDProbe(bd))
return TRUE;
}
}
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x18);
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x1C);
if (d1&1 && d2&1) {
if (bd->base0=d1&~7) {
bd->unit=0;
d1 = PCIReadU32(j.u8[2], j.u8[1], j.u8[0], 0x18);
d2 = PCIReadU32(j.u8[2], j.u8[1], j.u8[0], 0x1C);
if (d1&1 && d2&1)
{
if (bd->base0 = d1 & ~7)
{
bd->unit = 0;
if (BootDVDProbe(bd))
return TRUE;
bd->unit=1;
bd->unit = 1;
if (BootDVDProbe(bd))
return TRUE;
}
@ -65,24 +76,26 @@ Bool BootDVDProbeAll(CBlkDev *bd)
}
}
d1=0x1F0;
d2=0x3F6;
if (bd->base0=d1&~7) {
bd->unit=0;
d1 = 0x1F0;
d2 = 0x3F6;
if (bd->base0 = d1 & ~7)
{
bd->unit = 0;
if (BootDVDProbe(bd))
return TRUE;
bd->unit=1;
bd->unit = 1;
if (BootDVDProbe(bd))
return TRUE;
}
d1=0x170;
d2=0x376;
if (bd->base0=d1&~7) {
bd->unit=0;
d1 = 0x170;
d2 = 0x376;
if (bd->base0 = d1 & ~7)
{
bd->unit = 0;
if (BootDVDProbe(bd))
return TRUE;
bd->unit=1;
bd->unit = 1;
if (BootDVDProbe(bd))
return TRUE;
}

View file

@ -193,29 +193,34 @@ Bool GetBaseUnit(CBlkDev *bd)
else
StreamPrint("probe=TRUE;");
};
if (!probe || !BootDVDProbeAll(bd)) {
if (!probe || !BootDVDProbeAll(bd))
{
"\nDon't worry. This is not a product\n"
"registration. ZenithOS just needs the\n"
"I/O port numbers for the CD/DVD.\n"
"\nRetry the ports above or check Windows\n"
"system information under I/O ports for\n"
"'IDE', 'ATA' or 'SATA'.\n"
"In Linux, use 'lspci -v' for ports.\n"
"\n\nEnter 4-digit hex I/O Port number.\n"
"CD/DVD I/O Port Base0: 0x";
bd->base0=SysI64Get;
bd->base1=0;
bd->unit =0;
if (bd->base0) {
"registration. ZenithOS just needs the\n"
"I/O port numbers for the CD/DVD.\n"
"\nRetry the ports above or check Windows\n"
"system information under I/O ports for\n"
"'IDE', 'ATA' or 'SATA'.\n"
"In Linux, use 'lspci -v' for ports.\n"
"\n\nEnter 4-digit hex I/O Port number.\n"
"CD/DVD I/O Port Base0: 0x";
bd->base0 = SysI64Get;
bd->base1 = 0;
bd->unit = 0;
if (bd->base0)
{
"\nUnit (0 or 1): ";
do ch=CharGet(,FALSE);
while (!('0'<=ch<='1'));
do ch = CharGet(, FALSE);
while (!('0' <= ch <= '1'));
'' ch;
bd->unit=ch-'0';
blkdev.dvd_boot_is_good=BootDVDProbe(bd);
bd->unit = ch - '0';
blkdev.dvd_boot_is_good = BootDVDProbe(bd);
return TRUE;
} else {
blkdev.dvd_boot_is_good=FALSE;
}
else
{
blkdev.dvd_boot_is_good = FALSE;
return FALSE;
}
}
@ -226,10 +231,10 @@ U0 BlkDevsInitAll()
{
CBlkDev *bd;
I64 i;
blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);
blkdev.drvs=CAlloc(sizeof(CDrive)*DRIVES_NUM);
for (i=0;i<DRIVES_NUM;i++)
blkdev.let_to_drive[i]=&blkdev.drvs[i];
blkdev.blkdevs = CAlloc(sizeof(CBlkDev) * BLKDEVS_NUM);
blkdev.drvs = CAlloc(sizeof(CDrive) * DRIVES_NUM);
for (i = 0; i < DRIVES_NUM; i++)
blkdev.let_to_drive[i] = &blkdev.drvs[i];
#exe {
if (kernel_config->opts[CONFIG_MOUNT_IDE_AUTO])
StreamPrint("MountIDEAuto;");