mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
1b75d91002
Add arg to SATARep to specify drive types to show. Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
266 lines
29 KiB
HTML
Executable file
266 lines
29 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.13">
|
|
<style type="text/css">
|
|
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;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ATARepEntry</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> base0, </span><span class=cF9>I64</span><span class=cF0> base1, </span><span class=cF9>I64</span><span class=cF0> unit, </span><span class=cF1>U8</span><span class=cF0> *message, </span><span class=cF9>CATARep</span><span class=cF0> **_head, </span><span class=cF9>I64</span><span class=cF0> *num_hints)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> type;
|
|
<a name="l4"></a> base0 &= -</span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l5"></a> base1 &= -</span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l6"></a> </span><span class=cF9>CATARep</span><span class=cF0> *tmpha;
|
|
<a name="l7"></a>
|
|
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (type = </span><span class=cF5>IDEATAProbe</span><span class=cF7>(</span><span class=cF0>base0,base1,unit</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l9"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l10"></a> *num_hints += </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l11"></a> </span><span class=cF6>"\n$PURPLE$ $BT+X,\"%d\",LM=\"%d\\n\"$$FG$$LM,4$"</span><span class=cF0>, *num_hints, *num_hints;
|
|
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (type == </span><span class=cF3>BDT_ATA</span><span class=cF0>)
|
|
<a name="l13"></a> </span><span class=cF6>"$RED$Hard Drive $LTBLUE$ATA "</span><span class=cF0>;
|
|
<a name="l14"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF6>"$RED$CD/DVD Drive $LTBLUE$ATAPI "</span><span class=cF0>;
|
|
<a name="l16"></a> </span><span class=cF6>"%s$FG$\n"</span><span class=cF0>, message;
|
|
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (base0 == </span><span class=cFB>blkdev</span><span class=cF0>.ins_base0 && unit == </span><span class=cFB>blkdev</span><span class=cF0>.ins_unit)
|
|
<a name="l18"></a> </span><span class=cF6>"$PURPLE$(Drive originally installed from.)$FG$\n"</span><span class=cF0>;
|
|
<a name="l19"></a> </span><span class=cF6>"Base0:0x%04X Base1:0x%04X Unit:%d$LM,0$\n"</span><span class=cF0>, base0, base1, unit;
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (_head)
|
|
<a name="l21"></a> {
|
|
<a name="l22"></a> tmpha = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CATARep</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l23"></a> tmpha->next = *_head;
|
|
<a name="l24"></a> *_head = tmpha;
|
|
<a name="l25"></a> tmpha->num = *num_hints;
|
|
<a name="l26"></a> tmpha->type = type;
|
|
<a name="l27"></a> tmpha->base0 = base0;
|
|
<a name="l28"></a> tmpha->base1 = base1;
|
|
<a name="l29"></a> tmpha->unit = unit;
|
|
<a name="l30"></a> }
|
|
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l32"></a>}
|
|
<a name="l33"></a>
|
|
<a name="l34"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>ATARepExitAllApplications</span><span class=cF0>()
|
|
<a name="l35"></a>{
|
|
<a name="l36"></a> </span><span class=cF6>"\nWe're going to probe hardware.\n"</span><span class=cF0>
|
|
<a name="l37"></a> </span><span class=cF6>"$RED$Exit all other applications.$FG$\n"</span><span class=cF0>
|
|
<a name="l38"></a> </span><span class=cF6>"Press '$PURPLE$p$FG$' to probe or '$PURPLE$s$FG$' to skip.\n"</span><span class=cF0>;
|
|
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ToUpper</span><span class=cF7>(</span><span class=cF5>CharGet</span><span class=cF0>(, </span><span class=cF3>FALSE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'S'</span><span class=cF0>)
|
|
<a name="l40"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l43"></a>}
|
|
<a name="l44"></a>
|
|
<a name="l45"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ATARep</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> prompt=</span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> just_ide=</span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF9>CATARep</span><span class=cF0> **_head=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l46"></a>{</span><span class=cF2>//Report possible ATA devices by probing.</span><span class=cF0> </span><span class=cF2>Hard disks and CD/DVDs.</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF9>I64</span><span class=cF0> d1, d2, i, j, k, count = </span><span class=cFE>0</span><span class=cF0>, unlock_flags = </span><span class=cFE>0</span><span class=cF0>, num_hints = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l48"></a>
|
|
<a name="l49"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF3>BLKDEVS_NUM</span><span class=cF0> <= </span><span class=cFE>64</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (_head)
|
|
<a name="l51"></a> *_head = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (prompt && </span><span class=cFD>ATARepExitAllApplications</span><span class=cF0>)
|
|
<a name="l54"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l55"></a>
|
|
<a name="l56"></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>BLKDEVS_NUM</span><span class=cF0>; i++)
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>blkdev</span><span class=cF0>.blkdevs[i].bd_signature == </span><span class=cF3>BD_SIGNATURE_VAL</span><span class=cF0>)
|
|
<a name="l58"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&unlock_flags, i, </span><span class=cF5>BlkDevLock</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>blkdev</span><span class=cF0>.blkdevs[i]</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l59"></a>
|
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (!just_ide)
|
|
<a name="l61"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k < </span><span class=cFE>256</span><span class=cF0>; k++)
|
|
<a name="l62"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l63"></a> i = -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l64"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l65"></a> {
|
|
<a name="l66"></a> j = </span><span class=cF5>PCIClassFind</span><span class=cF0>(</span><span class=cFE>0x010100</span><span class=cF0> + k, ++i);
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (j < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l68"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l69"></a>
|
|
<a name="l70"></a> </span><span class=cF6>"\nSubcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n"</span><span class=cF0>, k, j.u8[</span><span class=cFE>2</span><span class=cF0>], j.u8[</span><span class=cFE>1</span><span class=cF0>], j.u8[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l71"></a> count++;
|
|
<a name="l72"></a>
|
|
<a name="l73"></a> d1 = </span><span class=cF5>PCIReadU32</span><span class=cF0>(j.u8[</span><span class=cFE>2</span><span class=cF0>], j.u8[</span><span class=cFE>1</span><span class=cF0>], j.u8[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFE>0x10</span><span class=cF0>);
|
|
<a name="l74"></a> d2 = </span><span class=cF5>PCIReadU32</span><span class=cF0>(j.u8[</span><span class=cFE>2</span><span class=cF0>], j.u8[</span><span class=cFE>1</span><span class=cF0>], j.u8[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFE>0x14</span><span class=cF0>);
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (d1 & </span><span class=cFE>1</span><span class=cF0> && d2 & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l77"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l78"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l81"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l82"></a> d1=</span><span class=cFE>0x1F0</span><span class=cF0>; d2=</span><span class=cFE>0x3F6</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l84"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l86"></a> d1 = </span><span class=cF5>PCIReadU32</span><span class=cF0>(j.u8[</span><span class=cFE>2</span><span class=cF0>], j.u8[</span><span class=cFE>1</span><span class=cF0>], j.u8[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFE>0x18</span><span class=cF0>);
|
|
<a name="l87"></a> d2 = </span><span class=cF5>PCIReadU32</span><span class=cF0>(j.u8[</span><span class=cFE>2</span><span class=cF0>], j.u8[</span><span class=cFE>1</span><span class=cF0>], j.u8[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFE>0x1C</span><span class=cF0>);
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (d1&</span><span class=cFE>1</span><span class=cF0> && d2&</span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l89"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l90"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l91"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l92"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l93"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l94"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l95"></a> d1 = </span><span class=cFE>0x170</span><span class=cF0>;
|
|
<a name="l96"></a> d2 = </span><span class=cFE>0x376</span><span class=cF0>;
|
|
<a name="l97"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l98"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l99"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l100"></a> }
|
|
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (!count)
|
|
<a name="l103"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l104"></a> d1 = </span><span class=cFE>0x1F0</span><span class=cF0>;
|
|
<a name="l105"></a> d2 = </span><span class=cFE>0x3F6</span><span class=cF0>;
|
|
<a name="l106"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l107"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Primary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l108"></a>
|
|
<a name="l109"></a> d1 = </span><span class=cFE>0x170</span><span class=cF0>;
|
|
<a name="l110"></a> d2 = </span><span class=cFE>0x376</span><span class=cF0>;
|
|
<a name="l111"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l112"></a> </span><span class=cFD>ATARepEntry</span><span class=cF0>(d1, d2, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>"Secondary IDE"</span><span class=cF0>, _head, &num_hints);
|
|
<a name="l113"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l114"></a> </span><span class=cF6>'\n\n'</span><span class=cF0>;
|
|
<a name="l115"></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>BLKDEVS_NUM</span><span class=cF0>; i++)
|
|
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&unlock_flags, i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l117"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(&</span><span class=cFB>blkdev</span><span class=cF0>.blkdevs[i]);
|
|
<a name="l118"></a> </span><span class=cF1>return</span><span class=cF0> num_hints;
|
|
<a name="l119"></a>}
|
|
<a name="l120"></a>
|
|
<a name="l121"></a></span><span class=cF9>CATARep</span><span class=cF0> *</span><span class=cF5>ATARepFind</span><span class=cF0>(</span><span class=cF9>CATARep</span><span class=cF0> *haystack_head, </span><span class=cF9>I64</span><span class=cF0> needle_num)
|
|
<a name="l122"></a>{
|
|
<a name="l123"></a> </span><span class=cF1>while</span><span class=cF0> (haystack_head)
|
|
<a name="l124"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (haystack_head->num == needle_num)
|
|
<a name="l126"></a> </span><span class=cF1>return</span><span class=cF0> haystack_head;
|
|
<a name="l127"></a> haystack_head = haystack_head->next;
|
|
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l130"></a>}
|
|
<a name="l131"></a>
|
|
<a name="l132"></a></span><span class=cF9>CATARep</span><span class=cF0> *</span><span class=cF5>ATAIDDrives</span><span class=cF0>(</span><span class=cF9>CATARep</span><span class=cF0> *head, </span><span class=cF9>CATARep</span><span class=cF0> **_ata_drive, </span><span class=cF9>CATARep</span><span class=cF0> **_atapi_drive)
|
|
<a name="l133"></a>{</span><span class=cF2>//This is for when trying to sort-out main hard drives and CD/DVD drives.</span><span class=cF0>
|
|
<a name="l134"></a> </span><span class=cF9>CATARep</span><span class=cF0> *res = </span><span class=cF3>NULL</span><span class=cF0>, *tmpha = head, *ata_drive = </span><span class=cF3>NULL</span><span class=cF0>, *atapi_drive = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l135"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l136"></a> </span><span class=cF1>Bool</span><span class=cF0> was_silent = </span><span class=cF5>Silent</span><span class=cF0>, ins_found = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l137"></a>
|
|
<a name="l138"></a> 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="l139"></a> </span><span class=cF5>Silent</span><span class=cF0>(was_silent);
|
|
<a name="l140"></a> </span><span class=cF1>while</span><span class=cF0> (tmpha)
|
|
<a name="l141"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (!res && bd && bd->type == tmpha->type)
|
|
<a name="l143"></a> {
|
|
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (bd->type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && bd->base0 == tmpha->base0 && bd->unit == tmpha->unit)
|
|
<a name="l145"></a> res = atapi_drive = tmpha;
|
|
<a name="l146"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (bd->type == </span><span class=cF3>BDT_ATA</span><span class=cF0> &&
|
|
<a name="l147"></a> bd->base0 == tmpha->base0 &&
|
|
<a name="l148"></a> bd->base1 == tmpha->base1 &&
|
|
<a name="l149"></a> bd->unit == tmpha->unit)
|
|
<a name="l150"></a> res = ata_drive=tmpha;
|
|
<a name="l151"></a> }
|
|
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (!res || res->type != tmpha->type)
|
|
<a name="l153"></a> {
|
|
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (tmpha->type == </span><span class=cF3>BDT_ATA</span><span class=cF0>)
|
|
<a name="l155"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (!ata_drive || tmpha->unit<ata_drive->unit ||
|
|
<a name="l157"></a> tmpha->unit == ata_drive->unit &&
|
|
<a name="l158"></a> tmpha->num < ata_drive->num)
|
|
<a name="l159"></a> ata_drive = tmpha;
|
|
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpha->type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0>)
|
|
<a name="l162"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (!atapi_drive || !ins_found &&
|
|
<a name="l164"></a> </span><span class=cF7>(</span><span class=cF0>tmpha->unit < atapi_drive->unit ||
|
|
<a name="l165"></a> tmpha->unit == atapi_drive->unit && tmpha->num < atapi_drive->num</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l166"></a> atapi_drive = tmpha;
|
|
<a name="l167"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l168"></a> }
|
|
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (tmpha->type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && bd && bd->type == </span><span class=cF3>BDT_ATA</span><span class=cF0> &&
|
|
<a name="l170"></a> tmpha->base0 == </span><span class=cFB>blkdev</span><span class=cF0>.ins_base0 && tmpha->unit == </span><span class=cFB>blkdev</span><span class=cF0>.ins_unit)
|
|
<a name="l171"></a> {
|
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (!ins_found)
|
|
<a name="l173"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l174"></a> atapi_drive = tmpha;
|
|
<a name="l175"></a> ins_found = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l177"></a> }
|
|
<a name="l178"></a> tmpha = tmpha->next;
|
|
<a name="l179"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l180"></a> </span><span class=cF1>if</span><span class=cF0> (_ata_drive)
|
|
<a name="l181"></a> *_ata_drive = ata_drive;
|
|
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (_atapi_drive)
|
|
<a name="l183"></a> *_atapi_drive = atapi_drive;
|
|
<a name="l184"></a>
|
|
<a name="l185"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l186"></a>}
|
|
<a name="l187"></a>
|
|
<a name="l188"></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> base0, </span><span class=cF9>I64</span><span class=cF0> base1, </span><span class=cF9>I64</span><span class=cF0> unit)
|
|
<a name="l189"></a>{
|
|
<a name="l190"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *res;
|
|
<a name="l191"></a>
|
|
<a name="l192"></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> <= unit <= </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l193"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l194"></a> res = </span><span class=cF5>BlkDevNextFreeSlot</span><span class=cF0>(first_drive_let, type);
|
|
<a name="l195"></a> res->unit = unit;
|
|
<a name="l196"></a> res->base0 = base0;
|
|
<a name="l197"></a> res->base1 = base1;
|
|
<a name="l198"></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="l199"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l201"></a>
|
|
<a name="l202"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l203"></a>}
|
|
<a name="l204"></a>
|
|
<a name="l205"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>MountIDEAuto</span><span class=cF0>()
|
|
<a name="l206"></a>{</span><span class=cF2>//Try to mount hard drive and CD/DVD, automatically. (Kernel.Config option).</span><span class=cF0>
|
|
<a name="l207"></a></span><span class=cF2>//It uses 'C' and 'T' as first drive letters or whatever you set</span><span class=cF0>
|
|
<a name="l208"></a></span><span class=cF2>//in config when compiling Kernel.BIN.</span><span class=cF0>
|
|
<a name="l209"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l210"></a> </span><span class=cF9>CATARep</span><span class=cF0> *head = </span><span class=cF3>NULL</span><span class=cF0>, *ata_drive = </span><span class=cF3>NULL</span><span class=cF0>, *atapi_drive = </span><span class=cF3>NULL</span><span class=cF0>, *tmpha;
|
|
<a name="l211"></a>
|
|
<a name="l212"></a> </span><span class=cF5>ATARep</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>, &head);
|
|
<a name="l213"></a> </span><span class=cF5>ATAIDDrives</span><span class=cF0>(head, &ata_drive, &atapi_drive);
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (ata_drive && </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>, ata_drive->base0, ata_drive->base1, ata_drive->unit</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l215"></a> res++;
|
|
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (atapi_drive && </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>,
|
|
<a name="l217"></a> atapi_drive->base0, atapi_drive->base1, atapi_drive->unit</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l218"></a> res++;
|
|
<a name="l219"></a> tmpha = head;
|
|
<a name="l220"></a> </span><span class=cF1>while</span><span class=cF0> (tmpha)
|
|
<a name="l221"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (tmpha != ata_drive && tmpha != atapi_drive)
|
|
<a name="l223"></a> {
|
|
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (tmpha->type == </span><span class=cF3>BDT_ATA</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>,
|
|
<a name="l225"></a> tmpha->base0, tmpha->base1, tmpha->unit</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l226"></a> res++;
|
|
<a name="l227"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpha->type == </span><span class=cF3>BDT_ATAPI</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>,
|
|
<a name="l228"></a> tmpha->base0, tmpha->base1, tmpha->unit</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l229"></a> res++;
|
|
<a name="l230"></a> }
|
|
<a name="l231"></a> tmpha = tmpha->next;
|
|
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l233"></a> </span><span class=cF5>LinkedListDel</span><span class=cF0>(head);
|
|
<a name="l234"></a> </span><span class=cFB>blkdev</span><span class=cF0>.mount_ide_auto_count = res;
|
|
<a name="l235"></a>
|
|
<a name="l236"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l237"></a>}
|
|
</span></pre></body>
|
|
</html>
|