SDDEVINFO(4) — NEWS-OS Programmer’s Manual
名称
sddevinfo − ディスクデバイス情報テーブル
形式
struct sddevinfo {
int id_len; /∗ identify length ∗/
char ∗id_name; /∗ vendor & product ID ∗/
char ∗revs; /∗ revision ∗/
int capacity; /∗ drive capacity ∗/
char ∗call_name; /∗ device nickname ∗/
int type; /∗ device type code ∗/
int firm_flags; /∗ firmware spec ∗/
#ifdef FORMAT_PAGE
char ∗∗fmt_page; /∗ Format Parameters ∗/
int fmt_time; /∗ Format time (in seconds) ∗/
int fmt_resv; /∗ reserved ∗/
#else /∗ FORMAT_PAGE ∗/
int tr_period; /∗ synchronous transfer period ∗/
int tr_offset; /∗ synchronous transfer offset ∗/
struct sc_ureq ∗∗setup_cmds; /∗ device setup commands ∗/
#endif /∗ FORMAT_PAGE ∗/
struct sdst ∗sdstp; /∗ device specifications ∗/
char ∗ERP_page; /∗ normal Error Recovery Parameters ∗/
char ∗max_ERP_page; /∗ max Error Recovery Parameters ∗/
char ∗∗other_pages; /∗ Other Parameters ∗/
int fmt_opts; /∗ Format options ∗/
};
解説
sddevinfo は SCSI ディスクデバイスの情報テーブルです。
sd デバイスドライバがサポートしているディスクデバイスは、 デバイス情報ファイル "/sys/newsiodev/sddefs.c" の デバイス情報テーブル sddevinfo に記述してあります。 また、デバイス情報テーブル sddevinfo に記述を追加することにより、 新しいタイプのディスクデバイスを使用することも可能です。
さらに、 デバイス情報テーブル sddevinfo に記述されていない ディスクデバイスを接続することも可能です。
この場合、エラー訂正方法や、データ先読みキャッシュなどの機能は、 そのディスクデバイスのデフォルトの値が使われます。
id_lenデバイスが持つ vendor および product identification から、 どのデバイスが接続されているかを識別する際の比較する文字数を指定します。
id_nameデバイスが持つ vendor および product identification の 文字列を指定します。
revsデバイスが持つ revision level の文字列を指定します。 文字 ’?’ は、全ての文字と同じとみなします。
capacityデバイスの容量をブロック数で指定します。
call_nameデバイスの名前を指定します。 auto-configuration 時に、デバイス名としてこの名前が表示されます。
typeデバイスを区別する番号を指定します。 番号が重複しないように指定してください。
firm_flagsディスクデバイスのキャッシュ機能、同期転送機能、 読み/書き時欠陥セクタ自動交代処理機能の有無を指定します。 キャッシュ機能および、読み/書き時欠陥セクタ自動交代処理機能は、 ERP_page、max_ERP_page、other_pages のパラメータの 設定に従って設定してください。 同期転送機能をセットしておくと、tr_period と tr_offset を使って 同期転送のメッセージがデバイスとの間でやり取りされます。
fmt_pageSCSI コマンドの MODE SELECT(0x15) の FORMAT PAGE の パラメータを指定します。 デバイスのフォーマットプログラム "/usr/sony/bin/format" 以外は使いません。
fmt_timeフォーマットに要する時間を秒単位で指定します。 デバイスのフォーマットプログラム "/usr/sony/bin/format" 以外は使いません。
fmt_resv未使用。
tr_periodデバイスがサポートしている同期転送の最小転送周期を指定します。
tr_offsetデバイスがサポートしている同期転送の対応する ACK 信号を 受信するまでに送出できる REQ 信号の最大値を指定します。
setup_cmdsデバイスの auto-configuration 時に、デバイス固有の 設定を行いたい場合に、デバイスに送るコマンドとパラメータを記述するところです。 コマンドの記述方法は、汎用 SCSI デバイスドライバで使用している "/sys/newsiodev/scu.h" を参照してください。
sdstpデバイスの構成情報を指定します。 ns には、1 トラック当たりのセクタ数を指定します。 nt には、1 シリンダ当たりのトラック数を指定します。 nspc には、1 シリンダ当たりのセクタ数を指定します。 ncyl には、総シリンダ数を指定します。 rps には、1 秒間の回転数を指定します。 sizes には、パーティションの情報を指定します。 パーティション情報が指定されなければ、デバイスの容量から、 自動的にパーティション情報を計算して使用します。
ERP_pageSCSI コマンドの MODE SELECT(0x15) の ERROR RECOVERY PAGE のパラメータを指定します。 このパラメータの設定で、通常の読み書き動作が行われます。
max_ERP_page
SCSI コマンドの MODE SELECT(0x15) の ERROR RECOVERY PAGE のパラメータを指定します。 このパラメータの設定で、エラーが発生したときの回復動作が行われます。
other_pagesSCSI コマンドの MODE SELECT(0x15) の FORMAT/ERROR RECOVERY PAGE 以外のパラメータを指定します。
fmt_optsデバイスのフォーマットを行う際の、 ディフェクトリストのフォーマット様式を指定します。
ディスクデバイスの先頭セクタにパーティションサイズ等のディスク情報が 書かれている場合は、その情報が使われます。 パーティションサイズ等のディスク情報が書かれていない場合は、 デバイス情報テーブル sddevinfo に記述されたディスク情報が使われます。 パーティション情報が記述されていない場合、 ディスクデバイスの記憶容量から パーティションの情報を計算して使用します。
デバイス情報ファイルを追加変更することにより、 新しいタイプのデバイスを接続する事も可能ですが、 既存のデバイス情報テーブルに記述されたデータを変更することは避けてください。
デバイス情報テーブルの書式については、 ヘッダーファイル "/sys/newsiodev/sdreg.h" を参照してください。
記述例
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ size ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
struct size example_sizes[PNUM] = { /∗ EXAMPLE-1 ∗/
15884, 0, /∗ A = cyl 0 thru 51 ∗/
33440, 52∗34∗9, /∗ B = cyl 52 thru 161 ∗/
304470, 0, /∗ C = cyl 0 thru 994 ∗/
15884, 162∗34∗9, /∗ D = cyl 162 thru 213 ∗/
55936, 214∗34∗9, /∗ E = cyl 214 thru 396 ∗/
182988, 397∗34∗9, /∗ F = cyl 397 thru 994 ∗/
254898, 162∗34∗9, /∗ G = cyl 162 thru 994 ∗/
0, 0, /∗ H Not use ∗/
};
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ device specifications ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
struct sdst sdst_example =
/∗ ns, nt, nspc, ncyl, rps, xxx, sizes ∗/
{ 34, 9, 34∗ 9, 995, 60, 0, example_sizes }; /∗ EXAMPLE-1 ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ device setup commands ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
struct sc_extnd rsense_buf;
struct sc_ureq scu_rsense = {
0x00, /∗ scu_istatus ∗/
0x00, /∗ scu_tstatus ∗/
0xc0, /∗ scu_identify ∗/
0x00, /∗ scu_message ∗/
512, /∗ scu_bytesec ∗/
0x03, 0x00, 0x00, 0x00, sizeof(struct sc_extnd), 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/∗ scu_cdb[12] ∗/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/∗ scu_param[20] ∗/
(u_char ∗)&rsense_buf, /∗ scu_addr ∗/
sizeof(struct sc_extnd) /∗ scu_count ∗/
};
struct sc_ureq ∗setup_cmds_example[] = /∗ EXAMPLE-1 ∗/
{ &scu_rsense, NULL };
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ normal Error Recovery Parameters ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
char erp_example[] = /∗ EXAMPLE-1 ∗/
{ SDM_PG_ERR, 0x06, SDM_AWRE|SDM_DCR, 0x03, 0x08, 0, 0, 0xff };
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ max Error Recovery Parameters ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
char max_erp_example[] = /∗ EXAMPLE-1 ∗/
{ SDM_PG_ERR, 0x06, 0, 0x1b, 0x08, 0, 0, 0xff };
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ Other Parameters ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
char cache_on_example[] =
{ SDM_PG_CACHE1, 0x0a, 0, 0, 0x02, 0, 0, 0, 0, 0x60, 0, 0x60 };
char ∗other_example[] = /∗ EXAMPLE-1 ∗/
{ cache_on_example, NULL };
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ Format page ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
#ifdef FORMAT_PAGE
char fmt_example[] = {
SDM_PG_FMT1,
0x16,
0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x24, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x12, 0x40, 0x00, 0x00, 0x00
};
char ∗fmtp_example[] = /∗ EXAMPLE-1 ∗/
{ fmt_example, NULL };
#endif FORMAT_PAGE
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
/∗ ∗/
/∗ SD device information ∗/
/∗ ∗/
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/
Struct SDDEVINFo example = { /∗ EXAMPLE-1 ∗/
20, /∗ identify length ∗/
"SONY EXAMPLE_DISK", /∗ vendor & product ID ∗/
"1990", /∗ revision ∗/
0x04a556, /∗ drive capacity ∗/
"sd_example1", /∗ device nickname ∗/
EXAMPLE-1, /∗ device type code ∗/
FIRM_CACHE_ON|FIRM_SYNCTR|FIRM_AWRE, /∗ firmware spec ∗/
#ifdef FORMAT_PAGE
fmtp_example, /∗ Format Parameters ∗/
9 ∗ 60 + 22, /∗ Format time (in seconds) ∗/
0, /∗ reserved ∗/
#else /∗ FORMAT_PAGE ∗/
0x35, /∗ MIN synchronous transfer period ∗/
15, /∗ MAX synchronous transfer offset ∗/
setup_cmds_example, /∗ device setup commands ∗/
#endif /∗ FORMAT_PAGE ∗/
&sdst_example, /∗ device specifications ∗/
erp_example, /∗ normal Error Recovery Parameters ∗/
max_erp_example, /∗ max Error Recovery Parameters ∗/
other_example, /∗ Other Parameters ∗/
FMT_DLF_PHYS, /∗ Format options ∗/
};
関連ファイル
/dev/sd[0-1][0-6][a-h]ブロックデバイス
/dev/rsd[0-1][0-6][a-h]RAW デバイス
/sys/newsiodev/sdreg.hioctl コマンドと構造体の定義
/sys/newsiodev/scu.hioctl コマンドと構造体の定義
関連事項
NEWS-OSRelease 4.2.1R