2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-08-09 07:04:03 +01:00
< meta name = "generator" content = "ZealOS V0.14" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-07-29 03:20:15 +01:00
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-08-04 03:35:43 +01:00
< a name = "l1" > < / a > < span class = cF2 > /* // TODO: use this for reference in SATARep when fixing AHCI's lack of blkdev.ins_unit, etc< / span > < span class = cF0 >
< a name = "l2" > < / a > < / span > < span class = cF2 > U0 ATARepEntry(I64 base0, I64 base1, I64 unit, U8 *message, CATARep **_head, I64 *num_hints)< / span > < span class = cF0 >
< a name = "l3" > < / a > < / span > < span class = cF2 > {< / span > < span class = cF0 >
< a name = "l4" > < / a > < / span > < span class = cF2 > I64< / span > < span class = cF0 > < / span > < span class = cF2 > type;< / span > < span class = cF0 >
< a name = "l5" > < / a > < / span > < span class = cF2 > base0 & = -8;< / span > < span class = cF0 >
< a name = "l6" > < / a > < / span > < span class = cF2 > base1 & = -4;< / span > < span class = cF0 >
< a name = "l7" > < / a > < / span > < span class = cF2 > CATARep< / span > < span class = cF0 > < / span > < span class = cF2 > *tmpha;< / span > < span class = cF0 >
< a name = "l8" > < / a >
< a name = "l9" > < / a > < / span > < span class = cF2 > if (type = IDEATAProbe(base0,base1,unit))< / span > < span class = cF0 >
< a name = "l10" > < / a > < / span > < span class = cF2 > {< / span > < span class = cF0 >
< a name = "l11" > < / a > < / span > < span class = cF2 > *num_hints += 1;< / span > < span class = cF0 >
< a name = "l12" > < / a > < / span > < span class = cF2 > " \n$PURPLE$ $BT+X,\" %d\" ,LM=\" %d\\n\" $$FG$$LM,4$" , *num_hints, *num_hints;< / span > < span class = cF0 >
< a name = "l13" > < / a > < / span > < span class = cF2 > if (type == BDT_ATA)< / span > < span class = cF0 >
< a name = "l14" > < / a > < / span > < span class = cF2 > " $RED$Hard Drive $LTBLUE$ATA " ;< / span > < span class = cF0 >
< a name = "l15" > < / a > < / span > < span class = cF2 > else< / span > < span class = cF0 >
< a name = "l16" > < / a > < / span > < span class = cF2 > " $RED$CD/DVD Drive $LTBLUE$ATAPI " ;< / span > < span class = cF0 >
< a name = "l17" > < / a > < / span > < span class = cF2 > " %s$FG$\n" , message;< / span > < span class = cF0 >
< a name = "l18" > < / a > < / span > < span class = cF2 > if (base0 == blkdev.ins_base0 & & unit == blkdev.ins_unit)< / span > < span class = cF0 >
< a name = "l19" > < / a > < / span > < span class = cF2 > " $PURPLE$(Drive originally installed from.)$FG$\n" ;< / span > < span class = cF0 >
< a name = "l20" > < / a > < / span > < span class = cF2 > " Base0:0x%04X Base1:0x%04X Unit:%d$LM,0$\n" , base0, base1, unit;< / span > < span class = cF0 >
< a name = "l21" > < / a > < / span > < span class = cF2 > if (_head)< / span > < span class = cF0 >
< a name = "l22" > < / a > < / span > < span class = cF2 > {< / span > < span class = cF0 >
< a name = "l23" > < / a > < / span > < span class = cF2 > tmpha = CAlloc(sizeof(CATARep));< / span > < span class = cF0 >
< a name = "l24" > < / a > < / span > < span class = cF2 > tmpha-> next = *_head;< / span > < span class = cF0 >
< a name = "l25" > < / a > < / span > < span class = cF2 > *_head = tmpha;< / span > < span class = cF0 >
< a name = "l26" > < / a > < / span > < span class = cF2 > tmpha-> num = *num_hints;< / span > < span class = cF0 >
< a name = "l27" > < / a > < / span > < span class = cF2 > tmpha-> type = type;< / span > < span class = cF0 >
< a name = "l28" > < / a > < / span > < span class = cF2 > tmpha-> base0 = base0;< / span > < span class = cF0 >
< a name = "l29" > < / a > < / span > < span class = cF2 > tmpha-> base1 = base1;< / span > < span class = cF0 >
< a name = "l30" > < / a > < / span > < span class = cF2 > tmpha-> unit = unit;< / span > < span class = cF0 >
< a name = "l31" > < / a > < / span > < span class = cF2 > }< / span > < span class = cF0 >
< a name = "l32" > < / a > < / span > < span class = cF2 > }< / span > < span class = cF0 >
< a name = "l33" > < / a > < / span > < span class = cF2 > }< / span > < span class = cF0 >
< a name = "l34" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
< a name = "l35" > < / a >
< a name = "l36" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *< / span > < span class = cF5 > ATAMount< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > first_drive_let, < / span > < span class = cF9 > I64< / span > < span class = cF0 > type, < / span > < span class = cF9 > I64< / span > < span class = cF0 > port_num)
< a name = "l37" > < / a > {
< a name = "l38" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *res;
< a name = "l39" > < / a >
< a name = "l40" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFE > 0< / span > < span class = cF0 > < = first_drive_let - < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > < < / span > < span class = cF3 > DRIVES_NUM< / span > < span class = cF0 > & & < / span > < span class = cF7 > (< / span > < span class = cF0 > type == < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > || type == < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF7 > )< / span > < span class = cF0 > & & < / span > < span class = cFE > 0< / span > < span class = cF0 > < = port_num < = < / span > < span class = cF3 > AHCI_MAX_PORTS< / span > < span class = cF0 > )
< a name = "l41" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l42" > < / a > res = < / span > < span class = cF5 > BlkDevNextFreeSlot< / span > < span class = cF0 > (first_drive_let, type);
< a name = "l43" > < / a > res-> port_num = port_num;
< a name = "l44" > < / a > res-> ahci_port = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports[port_num];
2021-08-13 03:27:41 +01:00
< a name = "l45" > < / a > res-> ahci_port-> cmd_list_base = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ; < / span > < span class = cF2 > // See < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskAHCI.CC.html#l1190" > < span class = cF4 > AHCIAtaInit< / span > < / a > < span class = cF2 > ...< / span > < span class = cF0 >
2021-08-04 03:35:43 +01:00
< a name = "l46" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > BlkDevAdd< / span > < span class = cF7 > (< / span > < span class = cF0 > res,, < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > , < / span > < span class = cF3 > FALSE< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l47" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
< a name = "l48" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l49" > < / a >
< a name = "l50" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l51" > < / a > }
2021-07-03 05:07:57 +01:00
< a name = "l52" > < / a >
2021-08-04 03:35:43 +01:00
< a name = "l53" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > MountAHCIAuto< / span > < span class = cF0 > ()
< a name = "l54" > < / a > {< / span > < span class = cF2 > //Try to mount hard drives and CD/DVD drives automatically. (Kernel.Config option).< / span > < span class = cF0 >
< a name = "l55" > < / a > < / span > < span class = cF2 > //It uses 'C' and 'T' as first drive letters or whatever you set< / span > < span class = cF0 >
< a name = "l56" > < / a > < / span > < span class = cF2 > //in config when compiling Kernel.BIN.< / span > < span class = cF0 >
< a name = "l57" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd = < / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (< / span > < span class = cF6 > ':'< / span > < span class = cF0 > , < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > );
< a name = "l58" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > res = < / span > < span class = cFE > 0< / span > < span class = cF0 > , i, ata_port = -< / span > < span class = cFE > 1< / span > < span class = cF0 > , atapi_port = -< / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l59" > < / a > < / span > < span class = cF9 > CAHCIPort< / span > < span class = cF0 > *port;
< a name = "l60" > < / a >
< a name = "l61" > < / a > < / span > < span class = cF6 > " MountAHCIAuto;\n" < / span > < span class = cF0 > ;
< a name = "l62" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd)
< a name = "l63" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l64" > < / a > < / span > < span class = cF2 > // if boot-drive blkdev exists, do a SATA port iteration to mount it first< / span > < span class = cF0 >
< a name = "l65" > < / a > < / span > < span class = cF6 > " ( ':' BlkDev at 0x%0X )\n" < / span > < span class = cF0 > , bd;
< a name = "l66" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cF3 > AHCI_MAX_PORTS< / span > < span class = cF0 > ; i++)
< a name = "l67" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports_implemented, i< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l68" > < / a > {
< a name = "l69" > < / a > port = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports[i];
< a name = "l70" > < / a >
< a name = "l71" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (bd-> port_num == i)
< a name = "l72" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l73" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (ata_port == -< / span > < span class = cFE > 1< / span > < span class = cF0 > & & bd-> type == < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > & & port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATA< / span > < span class = cF0 > )
< a name = "l74" > < / a > {
< a name = "l75" > < / a > < / span > < span class = cF6 > " ATAMount('%C', BDT_ATA, %d);\n" < / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_hd_drive_let, i;
< a name = "l76" > < / a > < / span > < span class = cF5 > ATAMount< / span > < span class = cF0 > (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_hd_drive_let, < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > , i);
< a name = "l77" > < / a > ata_port = i;
< a name = "l78" > < / a > res++;
< a name = "l79" > < / a > }
< a name = "l80" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (atapi_port == -< / span > < span class = cFE > 1< / span > < span class = cF0 > & & bd-> type == < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > & & port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATAPI< / span > < span class = cF0 > )
< a name = "l81" > < / a > {
< a name = "l82" > < / a > < / span > < span class = cF6 > " ATAMount('%C', BDT_ATAPI, %d);\n" < / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_dvd_drive_let, i;
< a name = "l83" > < / a > < / span > < span class = cF5 > ATAMount< / span > < span class = cF0 > (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_dvd_drive_let, < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > , i);
< a name = "l84" > < / a > atapi_port = i;
< a name = "l85" > < / a > res++;
< a name = "l86" > < / a > }
< a name = "l87" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l88" > < / a > }
< a name = "l89" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l90" > < / a > < / span > < span class = cF2 > // do a 2nd iteration to mount remaining drives< / span > < span class = cF0 >
< a name = "l91" > < / a > < / span > < span class = cF2 > // (we will end up trying to boot off whichever drive/partition ends up at chosen letter)< / span > < span class = cF0 >
< a name = "l92" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cF3 > AHCI_MAX_PORTS< / span > < span class = cF0 > ; i++)
< a name = "l93" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i != ata_port & & i != atapi_port & & < / span > < span class = cF5 > Bt< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports_implemented, i< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l94" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l95" > < / a > port = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports[i];
< a name = "l96" > < / a >
< a name = "l97" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATA< / span > < span class = cF0 > )
< a name = "l98" > < / a > {
< a name = "l99" > < / a > < / span > < span class = cF6 > " ATAMount('%C', BDT_ATA, %d);\n" < / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_hd_drive_let, i;
< a name = "l100" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > ATAMount< / span > < span class = cF7 > (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_hd_drive_let, < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > , i< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l101" > < / a > res++;
< a name = "l102" > < / a > }
< a name = "l103" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATAPI< / span > < span class = cF0 > )
< a name = "l104" > < / a > {
< a name = "l105" > < / a > < / span > < span class = cF6 > " ATAMount('%C', BDT_ATAPI, %d);\n" < / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_dvd_drive_let, i;
< a name = "l106" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > ATAMount< / span > < span class = cF7 > (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .first_dvd_drive_let, < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > , i< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l107" > < / a > res++;
< a name = "l108" > < / a > }
< a name = "l109" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l110" > < / a > < / span > < span class = cF6 > " \n" < / span > < span class = cF0 > ;
< a name = "l111" > < / a > < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .mount_ide_auto_count = res;
< a name = "l112" > < / a >
< a name = "l113" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
< a name = "l114" > < / a > }
2021-07-03 05:07:57 +01:00
< / span > < / pre > < / body >
< / html >