mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
a80b4fe451
Remove some deprecated IDE functions. Delete Kernel/BlkDev/DiskATA.CC. Update colors on OSUpgrade.
353 lines
42 KiB
HTML
Executable file
353 lines
42 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.15">
|
|
<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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"PCI;Info;File/System;Devices"</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SATARep</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> bd_type=</span><span class=cF3>BDT_NULL</span><span class=cF0>)
|
|
<a name="l3"></a>{ </span><span class=cF2>// Report ATA and ATAPI drives implemented by SATA controller.</span><span class=cF0>
|
|
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> bdf, i, j, num = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l5"></a> </span><span class=cF9>CAHCIPort</span><span class=cF0> *port;
|
|
<a name="l6"></a> </span><span class=cF9>CPCIDev</span><span class=cF0> *pci;
|
|
<a name="l7"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *temp_blkdev;
|
|
<a name="l8"></a> </span><span class=cF9>U16</span><span class=cF0> *st, *model, *serial;
|
|
<a name="l9"></a> </span><span class=cF1>Bool</span><span class=cF0> show_atapi = </span><span class=cF3>FALSE</span><span class=cF0>, show_ata = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l10"></a>
|
|
<a name="l11"></a>
|
|
<a name="l12"></a> </span><span class=cF1>switch</span><span class=cF0> (bd_type)
|
|
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_NULL</span><span class=cF0>:
|
|
<a name="l15"></a> show_atapi = show_ata = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l16"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l17"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATAPI</span><span class=cF0>:
|
|
<a name="l18"></a> show_atapi = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l19"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>:
|
|
<a name="l21"></a> show_ata = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l22"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l24"></a>
|
|
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l26"></a> </span><span class=cF6>"\n$LTBLUE$AHCI version %X.%1X%1X$FG$\n\n"</span><span class=cF0>,
|
|
<a name="l27"></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>;
|
|
<a name="l28"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF6>"\nAHCI version %X.%1X%1X\n\n"</span><span class=cF0>,
|
|
<a name="l30"></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>;
|
|
<a name="l31"></a>
|
|
<a name="l32"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>dev</span><span class=cF0>.pci_head)
|
|
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l34"></a> pci = </span><span class=cF5>PCIDevFind</span><span class=cF0>(</span><span class=cF3>PCIC_STORAGE</span><span class=cF0>, </span><span class=cF3>PCISC_AHCI</span><span class=cF0>);
|
|
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l36"></a> {
|
|
<a name="l37"></a> </span><span class=cF6>"$RED$$HL,1$Bus: 0x%02X, Dev: 0x%02X, Fun: 0x%02X$HL,0$$FG$\n\n"</span><span class=cF0>, pci->bus, pci-></span><span class=cFB>dev</span><span class=cF0>, pci->fun;
|
|
<a name="l38"></a> </span><span class=cF6>"$RED$Vendor$FG$: $LTBLUE$%s$FG$\n"</span><span class=cF0>, pci->vendor_str;
|
|
<a name="l39"></a> </span><span class=cF6>"$RED$Device$FG$: $LTBLUE$%s$FG$\n"</span><span class=cF0>, pci->dev_id_str;
|
|
<a name="l40"></a> }
|
|
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l42"></a> {
|
|
<a name="l43"></a> </span><span class=cF6>"Bus: 0x%02X, Dev: 0x%02X, Fun: 0x%02X\n\n"</span><span class=cF0>, pci->bus, pci-></span><span class=cFB>dev</span><span class=cF0>, pci->fun;
|
|
<a name="l44"></a> </span><span class=cF6>"Vendor: %s\n"</span><span class=cF0>, pci->vendor_str;
|
|
<a name="l45"></a> </span><span class=cF6>"Device: %s\n"</span><span class=cF0>, pci->dev_id_str;
|
|
<a name="l46"></a> }
|
|
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> bdf = </span><span class=cF5>PCIClassFind</span><span class=cF0>(</span><span class=cF3>PCIC_STORAGE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> | </span><span class=cF3>PCISC_AHCI</span><span class=cF0> << </span><span class=cFE>8</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l51"></a> </span><span class=cF6>"Bus:%02X, Dev:%02X, Fun:%02X\n"</span><span class=cF0>, bdf.u8[</span><span class=cFE>2</span><span class=cF0>], bdf.u8[</span><span class=cFE>1</span><span class=cF0>], bdf.u8[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l52"></a> </span><span class=cF6>"HBA Base Address: 0x%X"</span><span class=cF0>, </span><span class=cF5>PCIReadU32</span><span class=cF0>(bdf.u8[</span><span class=cFE>2</span><span class=cF0>], bdf.u8[</span><span class=cFE>1</span><span class=cF0>], bdf.u8[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cF3>PCIR_BASE5</span><span class=cF0>) & ~</span><span class=cFE>0x1F</span><span class=cF0>;
|
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l54"></a>
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba)
|
|
<a name="l56"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l57"></a> </span><span class=cF6>"\nImplemented Ports:\n"</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF6>"(Show ATA: %Z)\n"</span><span class=cF0>, show_ata, </span><span class=cF6>"ST_FALSE_TRUE"</span><span class=cF0>;
|
|
<a name="l59"></a> </span><span class=cF6>"(Show ATAPI: %Z)\n\n"</span><span class=cF0>, show_atapi, </span><span class=cF6>"ST_FALSE_TRUE"</span><span class=cF0>;
|
|
<a name="l60"></a>
|
|
<a name="l61"></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="l62"></a> {
|
|
<a name="l63"></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="l64"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l65"></a> port = &</span><span class=cFB>blkdev</span><span class=cF0>.ahci_hba->ports[i];
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (port->signature == </span><span class=cF3>AHCI_PxSIG_ATAPI</span><span class=cF0> && show_atapi ||
|
|
<a name="l68"></a> port->signature == </span><span class=cF3>AHCI_PxSIG_ATA</span><span class=cF0> && show_ata)
|
|
<a name="l69"></a> {
|
|
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l71"></a> </span><span class=cF6>"$PURPLE$ $BT,\"%d\",LM=\"%d\n\"$$FG$"</span><span class=cF0>, i, i;
|
|
<a name="l72"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF6>"[%d]"</span><span class=cF0>, i;
|
|
<a name="l74"></a>
|
|
<a name="l75"></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="l76"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l78"></a> </span><span class=cF6>"$LM,4$$RED$Hard Drive $LTBLUE$ATA$FG$\n"</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF6>"\tHard Drive ATA\n"</span><span class=cF0>;
|
|
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l82"></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="l83"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l85"></a> </span><span class=cF6>"$LM,4$$RED$CD/DVD Drive $LTBLUE$ATAPI$FG$\n"</span><span class=cF0>;
|
|
<a name="l86"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l87"></a> </span><span class=cF6>"\tCD/DVD Drive ATAPI\n"</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l91"></a> </span><span class=cF6>"$LM,0$"</span><span class=cF0>;
|
|
<a name="l92"></a> </span><span class=cF6>'\n\t'</span><span class=cF0>;
|
|
<a name="l93"></a>
|
|
<a name="l94"></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="l95"></a> </span><span class=cF1>if</span><span class=cF0> (port->signature == </span><span class=cF3>AHCI_PxSIG_ATAPI</span><span class=cF0>)
|
|
<a name="l96"></a> temp_blkdev->first_drive_let = </span><span class=cF6>'T'</span><span class=cF0>;
|
|
<a name="l97"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF2>// ATA</span><span class=cF0>
|
|
<a name="l98"></a> temp_blkdev->first_drive_let = </span><span class=cF6>'C'</span><span class=cF0>;
|
|
<a name="l99"></a>
|
|
<a name="l100"></a> </span><span class=cF5>AHCIPortInit</span><span class=cF0>(temp_blkdev, port, i);
|
|
<a name="l101"></a> </span><span class=cF6>"\n\t"</span><span class=cF0>;
|
|
<a name="l102"></a>
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (temp_blkdev->dev_id_record)
|
|
<a name="l104"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l105"></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="l106"></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="l107"></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="l108"></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="l109"></a> </span><span class=cF6>"Model: %s\n\t"</span><span class=cF0>, model;
|
|
<a name="l110"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l111"></a> </span><span class=cF5>Free</span><span class=cF0>(model);
|
|
<a name="l112"></a>
|
|
<a name="l113"></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="l114"></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="l115"></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="l116"></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="l117"></a> </span><span class=cF6>"Serial: %s\n"</span><span class=cF0>, serial;
|
|
<a name="l118"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l119"></a> </span><span class=cF5>Free</span><span class=cF0>(serial);
|
|
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l121"></a>
|
|
<a name="l122"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
|
<a name="l123"></a>
|
|
<a name="l124"></a> </span><span class=cF5>BlkDevDel</span><span class=cF0>(temp_blkdev);
|
|
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(temp_blkdev);
|
|
<a name="l126"></a> }
|
|
<a name="l127"></a> num++;
|
|
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l129"></a> }
|
|
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF6>"blkdev.ahci_hba is NULL !\n\n"</span><span class=cF0>;
|
|
<a name="l133"></a>
|
|
<a name="l134"></a> </span><span class=cF1>return</span><span class=cF0> num;
|
|
<a name="l135"></a>}
|
|
<a name="l136"></a>
|
|
<a name="l137"></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="l138"></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="l139"></a>{</span><span class=cF2>//If _doc, called by </span><a href="https://zeal-operating-system.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://zeal-operating-system.github.io/ZealOS/System/BlkDev/Mount.CC.html#l301"><span class=cF4>Mount</span></a><span class=cF2>().</span><span class=cF0>
|
|
<a name="l140"></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, prt_num, port;
|
|
<a name="l141"></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="l142"></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="l143"></a> </span><span class=cF1>Bool</span><span class=cF0> whole_drive, make_free;
|
|
<a name="l144"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
|
<a name="l145"></a>
|
|
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (boot_drive_let)
|
|
<a name="l147"></a> boot_drive_let = </span><span class=cF5>Letter2Letter</span><span class=cF0>(boot_drive_let);
|
|
<a name="l148"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l149"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l150"></a> count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l151"></a> </span><span class=cF1>if</span><span class=cF0> (!_doc)
|
|
<a name="l152"></a> </span><span class=cF5>DriveRep</span><span class=cF0>;
|
|
<a name="l153"></a>
|
|
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l155"></a> </span><span class=cF6>"\n****** Mount Drives ******\n"</span><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF6>"$GREEN$A$FG$-$GREEN$B$FG$ are RAM drives.\n"</span><span class=cF0>
|
|
<a name="l157"></a> </span><span class=cF6>"$GREEN$C$FG$-$GREEN$L$FG$ are ATA hard drives.\n"</span><span class=cF0>
|
|
<a name="l158"></a> </span><span class=cF6>"$GREEN$M$FG$-$GREEN$P$FG$ are ISO file read drives.\n"</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF6>"$GREEN$Q$FG$-$GREEN$S$FG$ are ISO file write drives.\n"</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF6>"$GREEN$T$FG$-$GREEN$Z$FG$ are ATAPI CD/DVD drives.\n"</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF6>"\nDrive Letter ($PURPLE$<ENTER>$FG$ to exit):"</span><span class=cF0>;
|
|
<a name="l162"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF6>"\n****** Mount Drives ******\n"</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF6>"A-B are RAM drives.\n"</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF6>"C-L are ATA hard drives.\n"</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF6>"M-P are ISO file read drives.\n"</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF6>"Q-S are ISO file write drives.\n"</span><span class=cF0>
|
|
<a name="l168"></a> </span><span class=cF6>"T-Z are ATAPI CD/DVD drives.\n"</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF6>"\nDrive Letter (<ENTER> to exit):"</span><span class=cF0>;
|
|
<a name="l170"></a>
|
|
<a name="l171"></a> drv_let = </span><span class=cF5>Letter2Letter</span><span class=cF0>(</span><span class=cF5>CharGet</span><span class=cF0>);
|
|
<a name="l172"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l173"></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="l174"></a> {
|
|
<a name="l175"></a> whole_drive = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (_doc)
|
|
<a name="l177"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//Called by </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
|
|
<a name="l178"></a> doc = _doc;
|
|
<a name="l179"></a> make_free = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l182"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//Called by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/BlkDev/Mount.CC.html#l301"><span class=cF4>Mount</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l183"></a> doc = </span><span class=cF5>DocNew</span><span class=cF0>;
|
|
<a name="l184"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"CBlkDev *bd;\n"</span><span class=cF0>);
|
|
<a name="l185"></a> make_free = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l187"></a> prt_num = </span><span class=cF3>I64_MIN</span><span class=cF0>;
|
|
<a name="l188"></a> port = -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l189"></a> </span><span class=cF1>switch</span><span class=cF0> (type)
|
|
<a name="l190"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l191"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_RAM</span><span class=cF0>:
|
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsRaw</span><span class=cF0>)
|
|
<a name="l193"></a> </span><span class=cF6>"Addr of RAM disk ($PURPLE$<ENTER>$FG$ to MAlloc):"</span><span class=cF0>;
|
|
<a name="l194"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l195"></a> </span><span class=cF6>"Addr of RAM disk (<ENTER> to MAlloc):"</span><span class=cF0>;
|
|
<a name="l196"></a> </span><span class=cF5>StrNGet</span><span class=cF0>(addr_buf, </span><span class=cF3>STR_LEN</span><span class=cF0>);
|
|
<a name="l197"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>:
|
|
<a name="l198"></a> </span><span class=cF6>"Blks of 512 bytes:"</span><span class=cF0>;
|
|
<a name="l199"></a> </span><span class=cF5>StrNGet</span><span class=cF0>(blks_buf, </span><span class=cF3>STR_LEN</span><span class=cF0>);
|
|
<a name="l200"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l201"></a>
|
|
<a name="l202"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0>:
|
|
<a name="l203"></a> filename = </span><span class=cF5>StrGet</span><span class=cF0>(</span><span class=cF6>"File Name:"</span><span class=cF0>);
|
|
<a name="l204"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>:
|
|
<a name="l207"></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="l208"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATAPI</span><span class=cF0>:
|
|
<a name="l209"></a> num_hints = </span><span class=cF5>SATARep</span><span class=cF0>(type);
|
|
<a name="l210"></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="l211"></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://zeal-operating-system.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
|
|
<a name="l212"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l213"></a> {
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (num_hints)
|
|
<a name="l215"></a> </span><span class=cF6>"Enter port number: \n"</span><span class=cF0>;
|
|
<a name="l216"></a> </span><span class=cF5>StrNGet</span><span class=cF0>(port_str, </span><span class=cF3>STR_LEN</span><span class=cF0>);
|
|
<a name="l217"></a> }
|
|
<a name="l218"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0> type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0> && </span><span class=cF5>AHCIPortSignatureGet</span><span class=cF0>(</span><span class=cF5>Str2I64</span><span class=cF7>(</span><span class=cF0>port_str</span><span class=cF7>)</span><span class=cF0>) != </span><span class=cF3>AHCI_PxSIG_ATAPI</span><span class=cF0> ||
|
|
<a name="l219"></a> type == </span><span class=cF3>BDT_ATA</span><span class=cF0> && </span><span class=cF5>AHCIPortSignatureGet</span><span class=cF0>(</span><span class=cF5>Str2I64</span><span class=cF7>(</span><span class=cF0>port_str</span><span class=cF7>)</span><span class=cF0>) != </span><span class=cF3>AHCI_PxSIG_ATA</span><span class=cF0> ||
|
|
<a name="l220"></a> </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=cF0>
|
|
<a name="l221"></a> </span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l222"></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="l223"></a>
|
|
<a name="l224"></a> port = </span><span class=cF5>Str2I64</span><span class=cF0>(port_str);
|
|
<a name="l225"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l226"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l227"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"\"bd = BlkDevNextFreeSlot('%C', %d);\n\";\n"</span><span class=cF0>, drv_let, type);
|
|
<a name="l228"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"bd = BlkDevNextFreeSlot(\'%C\', %d);\n"</span><span class=cF0>, drv_let, type);
|
|
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (port != -</span><span class=cFE>1</span><span class=cF0> && *port_str)
|
|
<a name="l230"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l231"></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="l232"></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);
|
|
<a name="l233"></a>
|
|
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l235"></a>
|
|
<a name="l236"></a> </span><span class=cF1>switch</span><span class=cF0> (type)
|
|
<a name="l237"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l238"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_RAM</span><span class=cF0>:
|
|
<a name="l239"></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="l240"></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="l241"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>:
|
|
<a name="l242"></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="l243"></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="l244"></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="l245"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l246"></a>
|
|
<a name="l247"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ISO_FILE_READ</span><span class=cF0>:
|
|
<a name="l248"></a> filename2 = </span><span class=cF5>FileNameAbs</span><span class=cF0>(filename);
|
|
<a name="l249"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"bd->file_disk_name = SysStrNew(\"%s\");\n"</span><span class=cF0>, filename2);
|
|
<a name="l250"></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="l251"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l252"></a>
|
|
<a name="l253"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATAPI</span><span class=cF0>:
|
|
<a name="l254"></a> </span><span class=cF1>if</span><span class=cF0> (!*port_str && _doc)
|
|
<a name="l255"></a> {
|
|
<a name="l256"></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="l257"></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://zeal-operating-system.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
|
|
<a name="l258"></a>
|
|
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (drv_let == boot_drive_let)
|
|
<a name="l260"></a> make_free = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l261"></a> }
|
|
<a name="l262"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l263"></a>
|
|
<a name="l264"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>:
|
|
<a name="l265"></a> </span><span class=cF1>if</span><span class=cF0> (_caller_is_prtdisk)
|
|
<a name="l266"></a> {
|
|
<a name="l267"></a> </span><span class=cF6>"\nReformat WHOLE drive!"</span><span class=cF0>;
|
|
<a name="l268"></a> whole_drive = </span><span class=cF5>YorN</span><span class=cF0>;
|
|
<a name="l269"></a> }
|
|
<a name="l270"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l271"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l272"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"\"BlkDevAdd(bd, 0x%0X, %Z, %Z);\n\";\n"</span><span class=cF0>, prt_num, whole_drive, </span><span class=cF6>"ST_FALSE_TRUE"</span><span class=cF0>, make_free, </span><span class=cF6>"ST_FALSE_TRUE"</span><span class=cF0>);
|
|
<a name="l273"></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="l274"></a> </span><span class=cF1>if</span><span class=cF0> (_doc) </span><span class=cF2>//Called by </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
|
|
<a name="l275"></a> count++;
|
|
<a name="l276"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l277"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//Called by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/BlkDev/Mount.CC.html#l301"><span class=cF4>Mount</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l278"></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="l279"></a> {
|
|
<a name="l280"></a> </span><span class=cF1>if</span><span class=cF0> (_caller_is_prtdisk)
|
|
<a name="l281"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l282"></a> res = drv_let;
|
|
<a name="l283"></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="l284"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l285"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l286"></a> </span><span class=cF5>DiskPart</span><span class=cF0>(drv_let);
|
|
<a name="l287"></a> }
|
|
<a name="l288"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l289"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l290"></a> }
|
|
<a name="l291"></a> total += count;
|
|
<a name="l292"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l293"></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://zeal-operating-system.github.io/ZealOS/Kernel/KConfig.CC.html#l1"><span class=cF4>::/Kernel/KConfig.CC</span></a><span class=cF0>
|
|
<a name="l294"></a>
|
|
<a name="l295"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
|
|
<a name="l296"></a> </span><span class=cF5>Free</span><span class=cF0>(filename2);
|
|
<a name="l297"></a>
|
|
<a name="l298"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l299"></a>}
|
|
<a name="l300"></a>
|
|
<a name="l301"></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="l302"></a>{</span><span class=cF2>//Mount drives. Called from </span><a href="https://zeal-operating-system.github.io/ZealOS/System/BlkDev/DiskPart.CC.html#l43"><span class=cF4>DiskPart(Mount)</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l303"></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="l304"></a>}
|
|
<a name="l305"></a>
|
|
<a name="l306"></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="l307"></a>{</span><span class=cF2>//Unmount drive(s).</span><span class=cF0>
|
|
<a name="l308"></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="l309"></a>}
|
|
<a name="l310"></a>
|
|
<a name="l311"></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="l312"></a>{</span><span class=cF2>//Mount ISO.C file.</span><span class=cF0>
|
|
<a name="l313"></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="l314"></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://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3333"><span class=cF4>BDT_ISO_FILE_READ</span></a><span class=cF0>
|
|
<a name="l315"></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>);
|
|
<a name="l316"></a>
|
|
<a name="l317"></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="l318"></a> bd->file_disk_name = </span><span class=cF5>SysStrNew</span><span class=cF0>(filename3);
|
|
<a name="l319"></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="l320"></a> </span><span class=cF5>Free</span><span class=cF0>(filename3);
|
|
<a name="l321"></a> </span><span class=cF5>Free</span><span class=cF0>(filename2);
|
|
<a name="l322"></a>
|
|
<a name="l323"></a> </span><span class=cF1>return</span><span class=cF0> drive->drv_let;
|
|
<a name="l324"></a>}
|
|
</span></pre></body>
|
|
</html>
|