ZealOS/docs/System/BlkDev/Mount.CC.html
TomAwezome 2ea6956433 Implement IntEntryAlloc, IntEntryFree for dynamic user IRQ acquisition.
Restructure network stack to use new Interrupt methods instead of hard-coded IRQ numbers.
Add line count update into build process.
Add progress bars to HTML generation and DoDistro.
Clear Network Log border_doc.
Fix font chars.
Clean up some lingering unconverted variable and directory names.
Remove word-wrap DolDoc tag from Clementine bible because of CPU spikes.
2021-07-11 17:47:19 -04:00

287 lines
33 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.07">
<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:monospace;font-size:12pt">
<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>{
<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;
<a name="l8"></a>
<a name="l9"></a> </span><span class=cF6>&quot;\nAHCI version %X.%1X%1X\n&quot;</span><span class=cF0>,
<a name="l10"></a> </span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba-&gt;version &gt;&gt; </span><span class=cFE>16</span><span class=cF0>, (</span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba-&gt;version &amp; </span><span class=cFE>0xFF00</span><span class=cF0>) &gt;&gt; </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba-&gt;version &amp; </span><span class=cFE>0xFF</span><span class=cF0>;
<a name="l11"></a>
<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>&quot;$PURPLE$$HL,1$Bus: 0x%02X, Dev: 0x%02X, Fun: 0x%02X$HL,0$$FG$\n\n&quot;, pci-&gt;bus, pci-&gt;dev, pci-&gt;fun;</span><span class=cF0>
<a name="l17"></a> </span><span class=cF2>&quot;$PURPLE$Vendor$FG$: $BLACK$%s$FG$\n&quot;, pci-&gt;vendor_str;</span><span class=cF0>
<a name="l18"></a> </span><span class=cF2>&quot;$PURPLE$Device$FG$: $BLACK$%s$FG$\n&quot;, pci-&gt;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 &lt;&lt; 16 | PCISC_AHCI &lt;&lt; 8 + 1, 0);</span><span class=cF0>
<a name="l23"></a> </span><span class=cF2>&quot;Bus:%02X, Dev:%02X, Fun:%02X&quot;, bdf.u8[2], bdf.u8[1], bdf.u8[0];</span><span class=cF0>
<a name="l24"></a> </span><span class=cF2>&quot;HBA Base Address: 0x%X&quot;, PCIReadU32(bdf.u8[2], bdf.u8[1], bdf.u8[0], PCIR_BASE5) &amp; ~0x1F;</span><span class=cF0>
<a name="l25"></a> </span><span class=cF2>}</span><span class=cF0>
<a name="l26"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l27"></a>
<a name="l28"></a>
<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>&quot;\nImplemented Ports:\n\n&quot;</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 &lt; </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>&amp;</span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba-&gt;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 = &amp;</span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba-&gt;ports[i];
<a name="l37"></a>
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (port-&gt;signature == </span><span class=cF3>AHCI_PxSIG_ATAPI</span><span class=cF0> || port-&gt;signature == </span><span class=cF3>AHCI_PxSIG_ATA</span><span class=cF0>)
<a name="l39"></a> {
<a name="l40"></a> </span><span class=cF6>&quot;$PURPLE$ $BT,\&quot;%d\&quot;,LM=\&quot;%d\n\&quot;$$FG$&quot;</span><span class=cF0>, i, i;
<a name="l41"></a>
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (port-&gt;signature == </span><span class=cF3>AHCI_PxSIG_ATA</span><span class=cF0>)
<a name="l43"></a> </span><span class=cF6>&quot;$LM,4$$RED$Hard Drive $LTBLUE$ATA$FG$\n&quot;</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-&gt;signature == </span><span class=cF3>AHCI_PxSIG_ATAPI</span><span class=cF0>)
<a name="l45"></a> </span><span class=cF6>&quot;$LM,4$$RED$CD/DVD Drive $LTBLUE$ATAPI$FG$\n&quot;</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>&quot;$LM,4$$RED$Unknown $LTBLUE$0x%0X$FG$\n&quot;, port-&gt;signature;</span><span class=cF0>
<a name="l48"></a>
<a name="l49"></a> </span><span class=cF6>&quot;$LM,0$\n\t&quot;</span><span class=cF0>;
<a name="l50"></a>
<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>&quot;\n\t&quot;</span><span class=cF0>;
<a name="l54"></a>
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (temp_blkdev-&gt;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 &lt; </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-&gt;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>&quot;Model: %s\n\t&quot;</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);
<a name="l64"></a>
<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 &lt; </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-&gt;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>&quot;Serial: %s\n&quot;</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>
<a name="l73"></a>
<a name="l74"></a> </span><span class=cF6>&quot;\n&quot;</span><span class=cF0>;
<a name="l75"></a>
<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>&quot;$HL,1$blkdev.ahci_hba$HL,0$ is NULL !\n\n&quot;</span><span class=cF0>;
<a name="l85"></a>
<a name="l86"></a> </span><span class=cF1>return</span><span class=cF0> num;
<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>&quot;Install;File/Cmd Line (Typically);Cmd Line (Typically);&quot;</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)
<a name="l91"></a>{</span><span class=cF2>//If _doc, called by </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KConfig.CC.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.CC.html#l235"><span class=cF4>Mount</span></a><span class=cF2>().</span><span class=cF0>
<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;
<a name="l97"></a>
<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>;
<a name="l105"></a>
<a name="l106"></a> </span><span class=cF6>&quot;\n****** Mount Drives ******\n&quot;</span><span class=cF0>
<a name="l107"></a> </span><span class=cF6>&quot;$GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\n&quot;</span><span class=cF0>
<a name="l108"></a> </span><span class=cF6>&quot;$GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\n&quot;</span><span class=cF0>
<a name="l109"></a> </span><span class=cF6>&quot;$GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\n&quot;</span><span class=cF0>
<a name="l110"></a> </span><span class=cF6>&quot;$GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\n&quot;</span><span class=cF0>
<a name="l111"></a> </span><span class=cF6>&quot;$GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\n&quot;</span><span class=cF0>
<a name="l112"></a> </span><span class=cF6>&quot;\nDrive Letter ($PURPLE$&lt;ENTER&gt;$FG$ to exit):&quot;</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.CC.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.CC.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>&quot;CBlkDev *bd;\n&quot;</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>&quot;Addr of RAM disk ($PURPLE$&lt;ENTER&gt;$FG$ to MAlloc):&quot;</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>&quot;Blks of 512 bytes:&quot;</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>;
<a name="l140"></a>
<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>&quot;File Name:&quot;</span><span class=cF0>);
<a name="l143"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l144"></a>
<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>&quot;Partition Num (Default=All):&quot;</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> &amp;&amp; boot_drive_let)
<a name="l150"></a> </span><span class=cF6>&quot;&lt;ENTER&gt; to use booted CD/DVD\n&quot;</span><span class=cF0>; </span><span class=cF2>//Only </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KConfig.CC.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>&quot;Enter port number: \n&quot;</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> &gt; </span><span class=cF5>Str2I64</span><span class=cF0>(port_str) || </span><span class=cF5>Str2I64</span><span class=cF0>(port_str) &gt; num_hints - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<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>);
<a name="l159"></a>
<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>&quot;\&quot;bd = BlkDevNextFreeSlot('%C', %d); bd-&gt;unit = %d;\n\&quot;;\n&quot;</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>&quot;bd = BlkDevNextFreeSlot(\'%C\', %d); bd-&gt;unit = %d;\n&quot;</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> &amp;&amp; *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>&quot;\&quot;AHCIPortInit(bd, &amp;blkdev.ahci_hba-&gt;ports[%d], %d);\n\&quot;;\n&quot;</span><span class=cF0>, port, port);
<a name="l168"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;AHCIPortInit(bd, &amp;blkdev.ahci_hba-&gt;ports[%d], %d);\n&quot;</span><span class=cF0>, port, port);
<a name="l169"></a>
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l171"></a>
<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>&quot;0&quot;</span><span class=cF0>);
<a name="l176"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;bd-&gt;RAM_disk = %s;\n&quot;</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>&quot;0&quot;</span><span class=cF0>);
<a name="l179"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;bd-&gt;max_blk = (%s) - 1;\n&quot;</span><span class=cF0>, blks_buf);
<a name="l180"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;bd-&gt;drv_offset = 19 &lt;&lt; 2 + (DVD_BLK_SIZE * 2 + DVD_BOOT_LOADER_SIZE) / BLK_SIZE;\n&quot;</span><span class=cF0>);
<a name="l181"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l182"></a>
<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>&quot;bd-&gt;file_disk_name = SysStrNew(\&quot;%s\&quot;);\n&quot;</span><span class=cF0>, filename2);
<a name="l186"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;bd-&gt;drv_offset = 19 &lt;&lt; 2 + (DVD_BLK_SIZE * 2 + DVD_BOOT_LOADER_SIZE) / BLK_SIZE;\n&quot;</span><span class=cF0>);
<a name="l187"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l188"></a>
<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> &amp;&amp; !*port_str &amp;&amp; _doc)
<a name="l192"></a> {
<a name="l193"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\&quot;AHCIBootDVDProbeAll(bd);\n\&quot;;\n&quot;</span><span class=cF0>);
<a name="l194"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;AHCIBootDVDProbeAll(bd);\n&quot;</span><span class=cF0>); </span><span class=cF2>//Only </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
<a name="l195"></a>
<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> &amp;&amp; _caller_is_prtdisk)
<a name="l200"></a> {
<a name="l201"></a> </span><span class=cF6>&quot;\nReformat WHOLE drive!&quot;</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>&quot;\&quot;BlkDevAdd(bd, 0x%0X, %d, %d);\n\&quot;;\n&quot;</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>&quot;BlkDevAdd(bd, 0x%0X, %d, %d);\n&quot;</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.CC.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.CC.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> &amp;&amp; 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 &amp;&amp; !_caller_is_prtdisk || !total &amp;&amp; _doc); </span><span class=cF2>//At least 1 if Called by </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
<a name="l228"></a>
<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);
<a name="l231"></a>
<a name="l232"></a> </span><span class=cF1>return</span><span class=cF0> res;
<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>
<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);
<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>
<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>);
<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>
<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>&quot;ISO.C&quot;</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.HH.html#l3244"><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-&gt;drv_let, </span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0>);
<a name="l250"></a>
<a name="l251"></a> bd-&gt;drv_offset = </span><span class=cFE>19</span><span class=cF0> &lt;&lt; </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-&gt;file_disk_name = </span><span class=cF5>SysStrNew</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);
<a name="l256"></a>
<a name="l257"></a> </span><span class=cF1>return</span><span class=cF0> drive-&gt;drv_let;
<a name="l258"></a>}
</span></pre></body>
</html>