2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
< meta name = "generator" content = "ZealOS V0.05" >
< style type = "text/css" >
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
< / style >
< / head >
< body >
< pre style = "font-family:courier;font-size:10pt" >
< a name = "l1" > < / a > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > SATARep< / span > < span class = cF0 > ()
< a name = "l2" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l3" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF2 > /*bdf, */< / span > < span class = cF0 > i, j, num = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l4" > < / a > < / span > < span class = cF9 > CAHCIPort< / span > < span class = cF0 > *port;
< a name = "l5" > < / a > < / span > < span class = cF2 > //< / span > < span class = cF0 > < / span > < span class = cF2 > CPCIDev< / span > < span class = cF0 > < / span > < span class = cF2 > *pci;< / span > < span class = cF0 >
< a name = "l6" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *temp_blkdev;
< a name = "l7" > < / a > < / span > < span class = cF9 > U16< / span > < span class = cF0 > *st, *model, *serial;
2021-07-03 05:07:57 +01:00
< a name = "l8" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l9" > < / a > < / span > < span class = cF6 > " \nAHCI version %X.%1X%1X\n" < / span > < span class = cF0 > ,
< a name = "l10" > < / a > < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> version > > < / span > < span class = cFE > 16< / span > < span class = cF0 > , (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> version & < / span > < span class = cFE > 0xFF00< / span > < span class = cF0 > ) > > < / span > < span class = cFE > 8< / span > < span class = cF0 > , < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> version & < / span > < span class = cFE > 0xFF< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l11" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l12" > < / a > < / span > < span class = cF2 > /*< / span > < span class = cF0 > < / span > < span class = cF2 > if (dev.pci_head)< / span > < span class = cF0 >
< a name = "l13" > < / a > < / span > < span class = cF2 > {< / span > < span class = cF0 >
< a name = "l14" > < / a > < / span > < span class = cF2 > pci = PCIDevFind(PCIC_STORAGE, PCISC_AHCI);< / span > < span class = cF0 >
< a name = "l15" > < / a > < / span > < span class = cF2 > //< / span > < span class = cF0 > < / span > < span class = cF2 > ClassRep(pci);< / span > < span class = cF0 >
< a name = "l16" > < / a > < / span > < span class = cF2 > " $PURPLE$$HL,1$Bus: 0x%02X, Dev: 0x%02X, Fun: 0x%02X$HL,0$$FG$\n\n" , pci-> bus, pci-> dev, pci-> fun;< / span > < span class = cF0 >
< a name = "l17" > < / a > < / span > < span class = cF2 > " $PURPLE$Vendor$FG$: $BLACK$%s$FG$\n" , pci-> vendor_str;< / span > < span class = cF0 >
< a name = "l18" > < / a > < / span > < span class = cF2 > " $PURPLE$Device$FG$: $BLACK$%s$FG$\n" , pci-> dev_id_str;< / span > < span class = cF0 >
< a name = "l19" > < / a > < / span > < span class = cF2 > }< / span > < span class = cF0 >
< a name = "l20" > < / a > < / span > < span class = cF2 > else< / span > < span class = cF0 >
< a name = "l21" > < / a > < / span > < span class = cF2 > {< / span > < span class = cF0 >
< a name = "l22" > < / a > < / span > < span class = cF2 > bdf = PCIClassFind(PCIC_STORAGE < < 16 | PCISC_AHCI < < 8 + 1, 0);< / span > < span class = cF0 >
< a name = "l23" > < / a > < / span > < span class = cF2 > " Bus:%02X, Dev:%02X, Fun:%02X" , bdf.u8[2], bdf.u8[1], bdf.u8[0];< / span > < span class = cF0 >
< a name = "l24" > < / a > < / span > < span class = cF2 > " HBA Base Address: 0x%X" , PCIReadU32(bdf.u8[2], bdf.u8[1], bdf.u8[0], PCIR_BASE5) & ~0x1F;< / span > < span class = cF0 >
< a name = "l25" > < / a > < / span > < span class = cF2 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l26" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
< a name = "l27" > < / a >
< a name = "l28" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l29" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba)
< a name = "l30" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l31" > < / a > < / span > < span class = cF6 > " \nImplemented Ports:\n\n" < / span > < span class = cF0 > ;
< a name = "l32" > < / 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 = "l33" > < / a > {
< a name = "l34" > < / 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 = "l35" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l36" > < / a > port = & < / span > < span class = cFB > blkdev< / span > < span class = cF0 > .ahci_hba-> ports[i];
2021-07-03 05:07:57 +01:00
< a name = "l37" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l38" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATAPI< / span > < span class = cF0 > || port-> signature == < / span > < span class = cF3 > AHCI_PxSIG_ATA< / span > < span class = cF0 > )
< a name = "l39" > < / a > {
< a name = "l40" > < / a > < / span > < span class = cF6 > " $PURPLE$ $BT,\" %d\" ,LM=\" %d\n\" $$FG$" < / span > < span class = cF0 > , i, i;
2021-07-03 05:07:57 +01:00
< a name = "l41" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l42" > < / 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 = "l43" > < / a > < / span > < span class = cF6 > " $LM,4$$RED$Hard Drive $LTBLUE$ATA$FG$\n" < / span > < span class = cF0 > ;
< a name = "l44" > < / 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 = "l45" > < / a > < / span > < span class = cF6 > " $LM,4$$RED$CD/DVD Drive $LTBLUE$ATAPI$FG$\n" < / span > < span class = cF0 > ;
< a name = "l46" > < / a > < / span > < span class = cF2 > //< / span > < span class = cF0 > < / span > < span class = cF2 > else< / span > < span class = cF0 >
< a name = "l47" > < / a > < / span > < span class = cF2 > //< / span > < span class = cF0 > < / span > < span class = cF2 > " $LM,4$$RED$Unknown $LTBLUE$0x%0X$FG$\n" , port-> signature;< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l48" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l49" > < / a > < / span > < span class = cF6 > " $LM,0$\n\t" < / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l50" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l51" > < / a > temp_blkdev = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CBlkDev< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l52" > < / a > < / span > < span class = cF5 > AHCIPortInit< / span > < span class = cF0 > (temp_blkdev, port, i);
< a name = "l53" > < / a > < / span > < span class = cF6 > " \n\t" < / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l54" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l55" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (temp_blkdev-> dev_id_record)
< a name = "l56" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l57" > < / a > st = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cFE > 40< / span > < span class = cF0 > + < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l58" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (j = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; j < < / span > < span class = cFE > 20< / span > < span class = cF0 > ; j++)
< a name = "l59" > < / a > st[j] = < / span > < span class = cF5 > EndianU16< / span > < span class = cF0 > (temp_blkdev-> dev_id_record[< / span > < span class = cFE > 27< / span > < span class = cF0 > + j]);
< a name = "l60" > < / a > model = < / span > < span class = cF5 > MStrUtil< / span > < span class = cF0 > (st, < / span > < span class = cF3 > SUF_REM_LEADING< / span > < span class = cF0 > | < / span > < span class = cF3 > SUF_REM_TRAILING< / span > < span class = cF0 > );
< a name = "l61" > < / a > < / span > < span class = cF6 > " Model: %s\n\t" < / span > < span class = cF0 > , model;
< a name = "l62" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (st);
< a name = "l63" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (model);
2021-07-03 05:07:57 +01:00
< a name = "l64" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l65" > < / a > st = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cFE > 20< / span > < span class = cF0 > + < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l66" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (j = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; j < < / span > < span class = cFE > 10< / span > < span class = cF0 > ; j++)
< a name = "l67" > < / a > st[j] = < / span > < span class = cF5 > EndianU16< / span > < span class = cF0 > (temp_blkdev-> dev_id_record[< / span > < span class = cFE > 10< / span > < span class = cF0 > + j]);
< a name = "l68" > < / a > serial = < / span > < span class = cF5 > MStrUtil< / span > < span class = cF0 > (st, < / span > < span class = cF3 > SUF_REM_LEADING< / span > < span class = cF0 > | < / span > < span class = cF3 > SUF_REM_TRAILING< / span > < span class = cF0 > );
< a name = "l69" > < / a > < / span > < span class = cF6 > " Serial: %s\n" < / span > < span class = cF0 > , serial;
< a name = "l70" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (st);
< a name = "l71" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (serial);
< a name = "l72" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l73" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l74" > < / a > < / span > < span class = cF6 > " \n" < / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l75" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l76" > < / a > < / span > < span class = cF5 > BlkDevDel< / span > < span class = cF0 > (temp_blkdev);
< a name = "l77" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (temp_blkdev);
< a name = "l78" > < / a > }
< a name = "l79" > < / a > num++;
< a name = "l80" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l81" > < / a > }
< a name = "l82" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l83" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l84" > < / a > < / span > < span class = cF6 > " $HL,1$blkdev.ahci_hba$HL,0$ is NULL !\n\n" < / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l85" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l86" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > num;
2021-07-03 05:07:57 +01:00
< a name = "l87" > < / a > }
< a name = "l88" > < / a >
< a name = "l89" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Install;File/Cmd Line (Typically);Cmd Line (Typically);" < / span > < span class = cF0 >
< a name = "l90" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > < / span > < span class = cF5 > Mount2< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > boot_drive_let, < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *_doc, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > _caller_is_prtdisk)
2021-07-03 07:51:43 +01:00
< a name = "l91" > < / a > {< / span > < span class = cF2 > //If _doc, called by < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF2 > else called by < / span > < a href = "https://tomawezome.github.io/ZealOS/System/BlkDev/Mount.html#l235" > < span class = cF4 > Mount< / span > < / a > < span class = cF2 > ().< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l92" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > count, total = < / span > < span class = cFE > 0< / span > < span class = cF0 > , num_hints, drv_let, type, unit, prt_num, port = -< / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l93" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > blks_buf[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ], addr_buf[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ], port_str[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ],
< a name = "l94" > < / a > *filename = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > , *filename2 = < / span > < span class = cF3 > NULL< / span > < span class = cF0 > , res = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l95" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > whole_drive, make_free;
< a name = "l96" > < / a > < / span > < span class = cF9 > CDoc< / span > < span class = cF0 > *doc;
2021-07-03 05:07:57 +01:00
< a name = "l97" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l98" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (boot_drive_let)
< a name = "l99" > < / a > boot_drive_let = < / span > < span class = cF5 > Letter2Letter< / span > < span class = cF0 > (boot_drive_let);
< a name = "l100" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l101" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l102" > < / a > count = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l103" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!_doc)
< a name = "l104" > < / a > < / span > < span class = cF5 > DriveRep< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l105" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l106" > < / a > < / span > < span class = cF6 > " \n****** Mount Drives ******\n" < / span > < span class = cF0 >
< a name = "l107" > < / a > < / span > < span class = cF6 > " $GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\n" < / span > < span class = cF0 >
< a name = "l108" > < / a > < / span > < span class = cF6 > " $GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\n" < / span > < span class = cF0 >
< a name = "l109" > < / a > < / span > < span class = cF6 > " $GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\n" < / span > < span class = cF0 >
< a name = "l110" > < / a > < / span > < span class = cF6 > " $GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\n" < / span > < span class = cF0 >
< a name = "l111" > < / a > < / span > < span class = cF6 > " $GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\n" < / span > < span class = cF0 >
< a name = "l112" > < / a > < / span > < span class = cF6 > " \nDrive Letter ($PURPLE$< ENTER> $FG$ to exit):" < / span > < span class = cF0 > ;
< a name = "l113" > < / a > drv_let = < / span > < span class = cF5 > Letter2Letter< / span > < span class = cF0 > (< / span > < span class = cF5 > CharGet< / span > < span class = cF0 > );
< a name = "l114" > < / a > < / span > < span class = cF6 > '\n'< / span > < span class = cF0 > ;
< a name = "l115" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (type = < / span > < span class = cF5 > Letter2BlkDevType< / span > < span class = cF7 > (< / span > < span class = cF0 > drv_let< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l116" > < / a > {
< a name = "l117" > < / a > whole_drive = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l118" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (_doc)
< a name = "l119" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 > < / span > < span class = cF2 > //Called by < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF0 >
< a name = "l120" > < / a > doc = _doc;
< a name = "l121" > < / a > make_free = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l122" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l123" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l124" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 > < / span > < span class = cF2 > //Called by < / span > < a href = "https://tomawezome.github.io/ZealOS/System/BlkDev/Mount.html#l235" > < span class = cF4 > Mount< / span > < / a > < span class = cF2 > ()< / span > < span class = cF0 >
< a name = "l125" > < / a > doc = < / span > < span class = cF5 > DocNew< / span > < span class = cF0 > ;
< a name = "l126" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " CBlkDev *bd;\n" < / span > < span class = cF0 > );
< a name = "l127" > < / a > make_free = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l128" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l129" > < / a > unit = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l130" > < / a > prt_num = < / span > < span class = cF3 > I64_MIN< / span > < span class = cF0 > ;
< a name = "l131" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (type)
< a name = "l132" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l133" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_RAM< / span > < span class = cF0 > :
< a name = "l134" > < / a > < / span > < span class = cF6 > " Addr of RAM disk ($PURPLE$< ENTER> $FG$ to MAlloc):" < / span > < span class = cF0 > ;
< a name = "l135" > < / a > < / span > < span class = cF5 > StrNGet< / span > < span class = cF0 > (addr_buf, < / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > );
< a name = "l136" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_WRITE< / span > < span class = cF0 > :
< a name = "l137" > < / a > < / span > < span class = cF6 > " Blks of 512 bytes:" < / span > < span class = cF0 > ;
< a name = "l138" > < / a > < / span > < span class = cF5 > StrNGet< / span > < span class = cF0 > (blks_buf, < / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > );
< a name = "l139" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l140" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l141" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_READ< / span > < span class = cF0 > :
< a name = "l142" > < / a > filename = < / span > < span class = cF5 > StrGet< / span > < span class = cF0 > (< / span > < span class = cF6 > " File Name:" < / span > < span class = cF0 > );
< a name = "l143" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l144" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l145" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > :
< a name = "l146" > < / a > prt_num = < / span > < span class = cF5 > I64Get< / span > < span class = cF0 > (< / span > < span class = cF6 > " Partition Num (Default=All):" < / span > < span class = cF0 > , prt_num);
< a name = "l147" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > :
< a name = "l148" > < / a > num_hints = < / span > < span class = cF5 > SATARep< / span > < span class = cF0 > ;
< a name = "l149" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (type == < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > & & boot_drive_let)
< a name = "l150" > < / a > < / span > < span class = cF6 > " < ENTER> to use booted CD/DVD\n" < / span > < span class = cF0 > ; < / span > < span class = cF2 > //Only < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF0 >
< a name = "l151" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l152" > < / a > {
< a name = "l153" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (num_hints)
< a name = "l154" > < / a > < / span > < span class = cF6 > " Enter port number: \n" < / span > < span class = cF0 > ;
< a name = "l155" > < / a > < / span > < span class = cF5 > StrNGet< / span > < span class = cF0 > (port_str, < / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > );
< a name = "l156" > < / a > }
< a name = "l157" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF7 > (< / span > < span class = cFE > 0< / span > < span class = cF0 > > < / span > < span class = cF5 > Str2I64< / span > < span class = cF0 > (port_str) || < / span > < span class = cF5 > Str2I64< / span > < span class = cF0 > (port_str) > num_hints - < / span > < span class = cFE > 1< / span > < span class = cF7 > )< / span > < span class = cF0 > & &
< a name = "l158" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > type != < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > || !boot_drive_let< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l159" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l160" > < / a > port = < / span > < span class = cF5 > Str2I64< / span > < span class = cF0 > (port_str);
< a name = "l161" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l162" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l163" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " \" bd = BlkDevNextFreeSlot('%C', %d); bd-> unit = %d;\n\" ;\n" < / span > < span class = cF0 > , drv_let, type, unit);
< a name = "l164" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd = BlkDevNextFreeSlot(\'%C\', %d); bd-> unit = %d;\n" < / span > < span class = cF0 > , drv_let, type, unit);
< a name = "l165" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (port != -< / span > < span class = cFE > 1< / span > < span class = cF0 > & & *port_str)
< a name = "l166" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l167" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " \" AHCIPortInit(bd, & blkdev.ahci_hba-> ports[%d], %d);\n\" ;\n" < / span > < span class = cF0 > , port, port);
< a name = "l168" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " AHCIPortInit(bd, & blkdev.ahci_hba-> ports[%d], %d);\n" < / span > < span class = cF0 > , port, port);
2021-07-03 05:07:57 +01:00
< a name = "l169" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l170" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l171" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l172" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (type)
< a name = "l173" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l174" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_RAM< / span > < span class = cF0 > :
< a name = "l175" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!*addr_buf) < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (addr_buf, < / span > < span class = cF6 > " 0" < / span > < span class = cF0 > );
< a name = "l176" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd-> RAM_disk = %s;\n" < / span > < span class = cF0 > , addr_buf);
< a name = "l177" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_WRITE< / span > < span class = cF0 > :
< a name = "l178" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!*blks_buf) < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (blks_buf, < / span > < span class = cF6 > " 0" < / span > < span class = cF0 > );
< a name = "l179" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd-> max_blk = (%s) - 1;\n" < / span > < span class = cF0 > , blks_buf);
< a name = "l180" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd-> drv_offset = 19 < < 2 + (DVD_BLK_SIZE * 2 + DVD_BOOT_LOADER_SIZE) / BLK_SIZE;\n" < / span > < span class = cF0 > );
< a name = "l181" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l182" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l183" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ISO_FILE_READ< / span > < span class = cF0 > :
< a name = "l184" > < / a > filename2 = < / span > < span class = cF5 > FileNameAbs< / span > < span class = cF0 > (filename);
< a name = "l185" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd-> file_disk_name = ZStrNew(\" %s\" );\n" < / span > < span class = cF0 > , filename2);
< a name = "l186" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " bd-> drv_offset = 19 < < 2 + (DVD_BLK_SIZE * 2 + DVD_BOOT_LOADER_SIZE) / BLK_SIZE;\n" < / span > < span class = cF0 > );
< a name = "l187" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l188" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l189" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > :
< a name = "l190" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > :
< a name = "l191" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (type == < / span > < span class = cF3 > BDT_ATAPI< / span > < span class = cF0 > & & !*port_str & & _doc)
< a name = "l192" > < / a > {
< a name = "l193" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " \" AHCIBootDVDProbeAll(bd);\n\" ;\n" < / span > < span class = cF0 > );
< a name = "l194" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " AHCIBootDVDProbeAll(bd);\n" < / span > < span class = cF0 > ); < / span > < span class = cF2 > //Only < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l195" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l196" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drv_let == boot_drive_let)
< a name = "l197" > < / a > make_free = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l198" > < / a > }
< a name = "l199" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (type == < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > & & _caller_is_prtdisk)
< a name = "l200" > < / a > {
< a name = "l201" > < / a > < / span > < span class = cF6 > " \nReformat WHOLE drive!" < / span > < span class = cF0 > ;
< a name = "l202" > < / a > whole_drive = < / span > < span class = cF5 > YorN< / span > < span class = cF0 > ;
< a name = "l203" > < / a > }
< a name = "l204" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l205" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l206" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " \" BlkDevAdd(bd, 0x%0X, %d, %d);\n\" ;\n" < / span > < span class = cF0 > , prt_num, whole_drive, make_free);
< a name = "l207" > < / a > < / span > < span class = cF5 > DocPrint< / span > < span class = cF0 > (doc, < / span > < span class = cF6 > " BlkDevAdd(bd, 0x%0X, %d, %d);\n" < / span > < span class = cF0 > , prt_num, whole_drive, make_free);
< a name = "l208" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (_doc) < / span > < span class = cF2 > //Called by < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF0 >
< a name = "l209" > < / a > count++;
< a name = "l210" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l211" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 > < / span > < span class = cF2 > //Called by < / span > < a href = "https://tomawezome.github.io/ZealOS/System/BlkDev/Mount.html#l235" > < span class = cF4 > Mount< / span > < / a > < span class = cF2 > ()< / span > < span class = cF0 >
< a name = "l212" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF7 > (< / span > < span class = cF0 > count = < / span > < span class = cF5 > ExeDoc< / span > < span class = cF0 > (doc)< / span > < span class = cF7 > )< / span > < span class = cF0 > & & whole_drive)
< a name = "l213" > < / a > {
< a name = "l214" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (_caller_is_prtdisk)
< a name = "l215" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l216" > < / a > res = drv_let;
< a name = "l217" > < / a > < / span > < span class = cF5 > DiskPart< / span > < span class = cF0 > (drv_let, < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ); < / span > < span class = cF2 > //First mount whole drive.< / span > < span class = cF0 >
< a name = "l218" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l219" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l220" > < / a > < / span > < span class = cF5 > DiskPart< / span > < span class = cF0 > (drv_let);
< a name = "l221" > < / a > }
< a name = "l222" > < / a > < / span > < span class = cF5 > DocDel< / span > < span class = cF0 > (doc);
< a name = "l223" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l224" > < / a > }
< a name = "l225" > < / a > total += count;
< a name = "l226" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l227" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (count & & !_caller_is_prtdisk || !total & & _doc); < / span > < span class = cF2 > //At least 1 if Called by < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KConfig.html#l1" > < span class = cF4 > ::/Kernel/KConfig.CC< / span > < / a > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l228" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l229" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (filename);
< a name = "l230" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (filename2);
2021-07-03 05:07:57 +01:00
< a name = "l231" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l232" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l233" > < / a > }
< a name = "l234" > < / a >
< a name = "l235" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U8< / span > < span class = cF0 > < / span > < span class = cF5 > Mount< / span > < span class = cF0 > (< / span > < span class = cF1 > Bool< / span > < span class = cF0 > caller_is_prtdisk=< / span > < span class = cF3 > FALSE< / span > < span class = cF0 > )
< a name = "l236" > < / a > {< / span > < span class = cF2 > //Mount drives. Called from < / span > < span class = cF4 > < u > DiskPart(Mount)< / u > < / span > < span class = cF2 > .< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l237" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF5 > Mount2< / span > < span class = cF0 > (< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF3 > NULL< / span > < span class = cF0 > , caller_is_prtdisk);
2021-07-03 05:07:57 +01:00
< a name = "l238" > < / a > }
< a name = "l239" > < / a >
< a name = "l240" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > Unmount< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > drv_let=< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l241" > < / a > {< / span > < span class = cF2 > //Unmount drive(s).< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l242" > < / a > < / span > < span class = cF5 > BlkDevDel< / span > < span class = cF0 > (< / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF7 > (< / span > < span class = cF0 > drv_let< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l243" > < / a > }
< a name = "l244" > < / a >
< a name = "l245" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U8< / span > < span class = cF0 > < / span > < span class = cF5 > MountFile< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *filename)
< a name = "l246" > < / a > {< / span > < span class = cF2 > //Mount ISO.C file.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l247" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *filename2 = < / span > < span class = cF5 > ExtDefault< / span > < span class = cF0 > (filename, < / span > < span class = cF6 > " ISO.C" < / span > < span class = cF0 > ), *filename3 = < / span > < span class = cF5 > FileNameAbs< / span > < span class = cF0 > (filename2);
< a name = "l248" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive = < / span > < span class = cF5 > DriveMakeFreeSlot< / span > < span class = cF0 > (< / span > < span class = cF5 > DriveNextFreeLet< / span > < span class = cF7 > (< / span > < span class = cF6 > 'M'< / span > < span class = cF7 > )< / span > < span class = cF0 > ); < / span > < span class = cF2 > //First < / span > < a href = "https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3243" > < span class = cF4 > BDT_ISO_FILE_READ< / span > < / a > < span class = cF0 >
< a name = "l249" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd = < / span > < span class = cF5 > BlkDevNextFreeSlot< / span > < span class = cF0 > (drive-> drv_let, < / span > < span class = cF3 > BDT_ISO_FILE_READ< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l250" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l251" > < / a > bd-> drv_offset = < / span > < span class = cFE > 19< / span > < span class = cF0 > < < < / span > < span class = cFE > 2< / span > < span class = cF0 > + (< / span > < span class = cF3 > DVD_BLK_SIZE< / span > < span class = cF0 > * < / span > < span class = cFE > 2< / span > < span class = cF0 > + < / span > < span class = cF3 > DVD_BOOT_LOADER_SIZE< / span > < span class = cF0 > ) / < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > ;
< a name = "l252" > < / a > bd-> file_disk_name = < / span > < span class = cF5 > ZStrNew< / span > < span class = cF0 > (filename3);
< a name = "l253" > < / a > < / span > < span class = cF5 > BlkDevAdd< / span > < span class = cF0 > (bd,, < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > , < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > );
< a name = "l254" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (filename3);
< a name = "l255" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (filename2);
2021-07-03 05:07:57 +01:00
< a name = "l256" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l257" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > drive-> drv_let;
2021-07-03 05:07:57 +01:00
< a name = "l258" > < / a > }
< / span > < / pre > < / body >
< / html >