mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16: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.
206 lines
18 KiB
HTML
Executable file
206 lines
18 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=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusNumNext</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> count=</span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l2"></a>{</span><span class=cF2>//Return next count'th clus in chain.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l4"></a>
|
|
<a name="l5"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(drive);
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (count <= </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l7"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l9"></a> unlock = </span><span class=cF5>DriveLock</span><span class=cF0>(drive);
|
|
<a name="l10"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l11"></a> {
|
|
<a name="l12"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l13"></a> c += count;
|
|
<a name="l14"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l15"></a>
|
|
<a name="l16"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l17"></a> </span><span class=cF1>while</span><span class=cF0> (count-- > </span><span class=cFE>0</span><span class=cF0> && </span><span class=cFE>0</span><span class=cF0> < c < </span><span class=cFE>0x0FFFFFF8</span><span class=cF0>)
|
|
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cFD>DriveFATBlkSet</span><span class=cF0>(drive, c);
|
|
<a name="l20"></a> c = drive->cur_fat_blk[c & (</span><span class=cF3>BLK_SIZE</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>)];
|
|
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < c < </span><span class=cFE>0x0FFFFFF8</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l23"></a> c = </span><span class=cF3>INVALID_CLUS</span><span class=cF0>;
|
|
<a name="l24"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l25"></a>
|
|
<a name="l26"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l27"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l28"></a> }
|
|
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l30"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l34"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l37"></a>}
|
|
<a name="l38"></a>
|
|
<a name="l39"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Clus2Blk</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF9>I64</span><span class=cF0> c)
|
|
<a name="l40"></a>{</span><span class=cF2>//Drive clus num to blk num.</span><span class=cF0>
|
|
<a name="l41"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(drive);
|
|
<a name="l42"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l44"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l45"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l46"></a>
|
|
<a name="l47"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> drive->data_area + c * drive->spc;
|
|
<a name="l49"></a>
|
|
<a name="l50"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l51"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l53"></a>}
|
|
<a name="l54"></a>
|
|
<a name="l55"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusBlkRead</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> blks)
|
|
<a name="l56"></a>{</span><span class=cF2>//Accepts blk count, so padding on last clus is not read.</span><span class=cF0>
|
|
<a name="l57"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l58"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l59"></a>
|
|
<a name="l60"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(drive);
|
|
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (blks <= </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l62"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l63"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l64"></a> unlock = </span><span class=cF5>DriveLock</span><span class=cF0>(drive);
|
|
<a name="l65"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l66"></a> {
|
|
<a name="l67"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l68"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(drive, buf, c, blks);
|
|
<a name="l69"></a> c += blks;
|
|
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l71"></a>
|
|
<a name="l72"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l73"></a> </span><span class=cF1>while</span><span class=cF0> (blks && </span><span class=cFE>0</span><span class=cF0> < c < </span><span class=cFE>0x0FFFFFF8</span><span class=cF0>)
|
|
<a name="l74"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l75"></a> i = blks;
|
|
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (i > drive->spc)
|
|
<a name="l77"></a> i = drive->spc;
|
|
<a name="l78"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(drive, buf, drive->data_area + c * drive->spc, i);
|
|
<a name="l79"></a> buf+=i << </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
|
<a name="l80"></a> c = </span><span class=cF5>ClusNumNext</span><span class=cF0>(drive, c, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l81"></a> blks -= i;
|
|
<a name="l82"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (blks)
|
|
<a name="l84"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l85"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l86"></a>
|
|
<a name="l87"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l88"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l89"></a> }
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l91"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l92"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l93"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l95"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l96"></a>
|
|
<a name="l97"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l98"></a>}
|
|
<a name="l99"></a>
|
|
<a name="l100"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusRead</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> count)
|
|
<a name="l101"></a>{</span><span class=cF2>//Read clus count from drv to buf.</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ClusBlkRead</span><span class=cF0>(drive, buf, c, count*drive->spc);
|
|
<a name="l103"></a>}
|
|
<a name="l104"></a>
|
|
<a name="l105"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusBlkWrite</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> blks)
|
|
<a name="l106"></a>{</span><span class=cF2>//Accepts blk count, so padding on last clus is not written.</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l108"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
|
<a name="l109"></a>
|
|
<a name="l110"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(drive);
|
|
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (blks <= </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l112"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l114"></a> unlock = </span><span class=cF5>DriveLock</span><span class=cF0>(drive);
|
|
<a name="l115"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l116"></a> {
|
|
<a name="l117"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l118"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(drive, buf, c, blks);
|
|
<a name="l119"></a> c = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l121"></a>
|
|
<a name="l122"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l123"></a> </span><span class=cF1>while</span><span class=cF0> (blks)
|
|
<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> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < c < </span><span class=cFE>0x0FFFFFF8</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l126"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l127"></a> i = blks;
|
|
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (i > drive->spc)
|
|
<a name="l129"></a> i = drive->spc;
|
|
<a name="l130"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(drive, buf, drive->data_area + c * drive->spc, i);
|
|
<a name="l131"></a> buf += i << </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
|
<a name="l132"></a> c = </span><span class=cF5>ClusNumNext</span><span class=cF0>(drive, c);
|
|
<a name="l133"></a> blks -= i;
|
|
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l135"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l136"></a>
|
|
<a name="l137"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l138"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l139"></a> }
|
|
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l141"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
|
<a name="l145"></a> </span><span class=cF5>DriveUnlock</span><span class=cF0>(drive);
|
|
<a name="l146"></a>
|
|
<a name="l147"></a> </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l148"></a>}
|
|
<a name="l149"></a>
|
|
<a name="l150"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusWrite</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> c, </span><span class=cF9>I64</span><span class=cF0> count)
|
|
<a name="l151"></a>{</span><span class=cF2>//Write clus count from buf to drv.</span><span class=cF0>
|
|
<a name="l152"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ClusBlkWrite</span><span class=cF0>(drive, buf, c, count*drive->spc);
|
|
<a name="l153"></a>}
|
|
<a name="l154"></a>
|
|
<a name="l155"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ClusAlloc</span><span class=cF0>(</span><span class=cF9>CDrive</span><span class=cF0> *drive, </span><span class=cF9>I64</span><span class=cF0> c=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> count=</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> contiguous=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
<a name="l156"></a>{</span><span class=cF2>//Alloc clus count into chain.</span><span class=cF0>
|
|
<a name="l157"></a></span><span class=cF2>//c=0 means first clus in chain</span><span class=cF0>
|
|
<a name="l158"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(drive);
|
|
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (count <= </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF1>return</span><span class=cF0> c;
|
|
<a name="l160"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l161"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l162"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l163"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>RedSeaAllocClus</span><span class=cF0>(drive, count);
|
|
<a name="l164"></a>
|
|
<a name="l165"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (contiguous)
|
|
<a name="l167"></a> {
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (c) </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'File'</span><span class=cF0>);
|
|
<a name="l169"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>FAT32AllocContiguousClus</span><span class=cF0>(drive, count);
|
|
<a name="l170"></a> }
|
|
<a name="l171"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l172"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>FAT32AllocClus</span><span class=cF0>(drive, c, count);
|
|
<a name="l173"></a>
|
|
<a name="l174"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l175"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Drive'</span><span class=cF0>);
|
|
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l177"></a>}
|
|
</span></pre></body>
|
|
</html>
|