PS2SDK
PS2 Homebrew Libraries
hdd-ioctl.h
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #ifndef __HDD_IOCTL_H__
17 #define __HDD_IOCTL_H__
18 
19 #include <tamtypes.h>
20 
22 // DEV9.IRX
23 
24 #define DEV9_TYPE_PCMCIA 0
25 #define DEV9_TYPE_EXPBAY 1
26 
27 #define DDIOC_MODEL 0x4401
28 #define DDIOC_OFF 0x4402
29 #define DDIOC_SETPIO3 0x4403
30 #define DDIOC_LED2CTL 0x4404
31 
33 // HDD.IRX
34 
35 // Partition format/types (as returned via the mode field for getstat/dread)
36 #define APA_TYPE_FREE 0x0000
37 
38 #define APA_TYPE_MBR 0x0001
39 #define APA_TYPE_EXT2SWAP 0x0082
40 #define APA_TYPE_EXT2 0x0083
41 #define APA_TYPE_REISER 0x0088
42 #define APA_TYPE_PFS 0x0100
43 #define APA_TYPE_CFS 0x0101
44 #define APA_TYPE_HDL 0x1337
45 
46 #define APA_IDMAX 32
47 
48 #define APA_MAXSUB 64
49 #define APA_PASSMAX 8
50 
51 #define APA_FLAG_SUB 0x0001
52 
53 //
54 // IOCTL2 commands
55 //
56 #define HIOCADDSUB 0x6801
57 #define HIOCDELSUB 0x6802
58 #define HIOCNSUB 0x6803
59 #define HIOCFLUSH 0x6804
60 
61 // Arbitrarily-named commands
63 #define HIOCTRANSFER 0x6832
64 
65 #define HIOCGETSIZE 0x6833
66 
67 #define HIOCSETPARTERROR 0x6834
68 
69 #define HIOCGETPARTERROR 0x6835
70 
71 // HDLFS addition
72 #define HIOCGETPARTSTART 0x6836 // Get the sector number of the first sector of the partition.
73 
74 // I/O direction
75 #define APA_IO_MODE_READ 0x00
76 #define APA_IO_MODE_WRITE 0x01
77 
78 // structs for IOCTL2 commands
79 typedef struct
80 {
82  u32 sub;
83  u32 sector;
85  u32 size;
87  u32 mode;
88  void *buffer;
90 
91 //
92 // DEVCTL commands
93 //
94 // 'H' set
96 #define HDIOC_MAXSECTOR 0x4801
97 
98 #define HDIOC_TOTALSECTOR 0x4802
99 #define HDIOC_IDLE 0x4803
100 #define HDIOC_FLUSH 0x4804
101 #define HDIOC_SWAPTMP 0x4805
102 #define HDIOC_DEV9OFF 0x4806
103 #define HDIOC_STATUS 0x4807
104 #define HDIOC_FORMATVER 0x4808
105 #define HDIOC_SMARTSTAT 0x4809
106 
107 #define HDIOC_FREESECTOR 0x480A
108 #define HDIOC_IDLEIMM 0x480B
109 
110 // 'h' command set
111 // Arbitrarily-named commands
112 #define HDIOC_GETTIME 0x6832
113 
114 #define HDIOC_SETOSDMBR 0x6833
115 #define HDIOC_GETSECTORERROR 0x6834
116 
117 #define HDIOC_GETERRORPARTNAME 0x6835
118 
119 #define HDIOC_READSECTOR 0x6836
120 
121 #define HDIOC_WRITESECTOR 0x6837
122 
123 #define HDIOC_SCEIDENTIFY 0x6838
124 // Only available using dvr_hdd0:
125 #define HDIOC_INSTSEC 0x6839
126 
127 #define HDIOC_SETMAXLBA28 0x683A
128 #define HDIOC_GETMAXLBA48 0x683B
129 #define HDIOC_ISLBA48 0x683C
130 #define HDIOC_PRESETMAXLBA28 0x683D
131 #define HDIOC_POSTSETMAXLBA28 0x683E
132 #define HDIOC_ENABLEWRITECACHE 0x683F
133 #define HDIOC_DISABLEWRITECACHE 0x6840
134 
135 // structs for DEVCTL commands
136 
137 typedef struct
138 {
139  u32 lba;
140  u32 size;
141  u8 data[];
143 
144 typedef struct
145 {
146  u32 start;
147  u32 size;
149 
150 // For backward-compatibility
151 // ioctl2 commands for ps2hdd.irx
152 #define HDDIO_ADD_SUB HIOCADDSUB
153 #define HDDIO_DELETE_END_SUB HIOCDELSUB
154 #define HDDIO_NUMBER_OF_SUBS HIOCNSUB
155 #define HDDIO_FLUSH_CACHE HIOCFLUSH
156 #define HDDIO_GETSIZE HIOCGETSIZE
157 
158 #define APA_IOCTL2_ADD_SUB HIOCADDSUB
159 #define APA_IOCTL2_DELETE_LAST_SUB HIOCDELSUB
160 #define APA_IOCTL2_NUMBER_OF_SUBS HIOCNSUB
161 #define APA_IOCTL2_FLUSH_CACHE HIOCFLUSH
162 
163 #define APA_IOCTL2_TRANSFER_DATA HIOCTRANSFER
164 #define APA_IOCTL2_GETSIZE HIOCGETSIZE
165 #define APA_IOCTL2_SET_PART_ERROR HIOCSETPARTERROR
166 #define APA_IOCTL2_GET_PART_ERROR HIOCGETPARTERROR
167 
168 // devctl commands for ps2hdd.irx
169 #define HDDCTL_MAX_SECTORS HDIOC_MAXSECTOR
170 #define HDDCTL_TOTAL_SECTORS HDIOC_TOTALSECTOR
171 #define HDDCTL_IDLE HDIOC_IDLE
172 #define HDDCTL_FLUSH_CACHE HDIOC_FLUSH
173 #define HDDCTL_SWAP_TMP HDIOC_SWAPTMP
174 #define HDDCTL_DEV9_SHUTDOWN HDIOC_DEV9OFF
175 #define HDDCTL_STATUS HDIOC_STATUS
176 #define HDDCTL_FORMAT HDIOC_FORMATVER
177 #define HDDCTL_SMART_STAT HDIOC_SMARTSTAT
178 #define HDDCTL_FREE_SECTORS HDIOC_FREESECTOR
179 
180 #define APA_DEVCTL_MAX_SECTORS HDIOC_MAXSECTOR
181 #define APA_DEVCTL_TOTAL_SECTORS HDIOC_TOTALSECTOR
182 #define APA_DEVCTL_IDLE HDIOC_IDLE
183 #define APA_DEVCTL_FLUSH_CACHE HDIOC_FLUSH
184 #define APA_DEVCTL_SWAP_TMP HDIOC_SWAPTMP
185 #define APA_DEVCTL_DEV9_SHUTDOWN HDIOC_DEV9OFF
186 #define APA_DEVCTL_STATUS HDIOC_STATUS
187 #define APA_DEVCTL_FORMAT HDIOC_FORMATVER
188 #define APA_DEVCTL_SMART_STAT HDIOC_SMARTSTAT
189 #define APA_DEVCTL_FREE_SECTORS HDIOC_FREESECTOR
190 
191 #define APA_DEVCTL_GETTIME HDIOC_GETTIME
192 #define APA_DEVCTL_SET_OSDMBR HDIOC_SETOSDMBR
193 #define APA_DEVCTL_GET_SECTOR_ERROR HDIOC_GETSECTORERROR
194 #define APA_DEVCTL_GET_ERROR_PART_NAME HDIOC_GETERRORPARTNAME
195 #define APA_DEVCTL_ATA_READ HDIOC_READSECTOR
196 #define APA_DEVCTL_ATA_WRITE HDIOC_WRITESECTOR
197 #define APA_DEVCTL_SCE_IDENTIFY_DRIVE HDIOC_SCEIDENTIFY
198 
200 // PFS.IRX
201 
202 // IOCTL2 commands
203 // Command set 'p'
204 #define PIOCALLOC 0x7001
205 #define PIOCFREE 0x7002
206 #define PIOCATTRADD 0x7003
207 #define PIOCATTRDEL 0x7004
208 #define PIOCATTRLOOKUP 0x7005
209 #define PIOCATTRREAD 0x7006
210 #define PIOCINVINODE 0x7032 // Only available in OSD version. Arbitrarily named.
211 
212 // DEVCTL commands
213 // Command set 'P'
214 #define PDIOC_ZONESZ 0x5001
215 #define PDIOC_ZONEFREE 0x5002
216 #define PDIOC_CLOSEALL 0x5003
217 #define PDIOC_GETFSCKSTAT 0x5004
218 #define PDIOC_CLRFSCKSTAT 0x5005
219 
220 // Arbitrarily-named commands
221 #define PDIOC_SHOWBITMAP 0xFF
222 
223 // I/O direction
224 #define PFS_IO_MODE_READ 0x00
225 #define PFS_IO_MODE_WRITE 0x01
226 
227 // For backward-compatibility
228 // ioctl2 commands for ps2fs.irx
229 #define PFSIO_ALLOC PIOCALLOC
230 #define PFSIO_FREE PIOCFREE
231 #define PFSIO_ATTR_ADD PIOCATTRADD
232 #define PFSIO_ATTR_DEL PIOCATTRDEL
233 #define PFSIO_ATTR_LOOKUP PIOCATTRLOOKUP
234 #define PFSIO_ATTR_READ PIOCATTRREAD
235 
236 #define PFS_IOCTL2_ALLOC PIOCALLOC
237 #define PFS_IOCTL2_FREE PIOCFREE
238 #define PFS_IOCTL2_ATTR_ADD PIOCATTRADD
239 #define PFS_IOCTL2_ATTR_DEL PIOCATTRDEL
240 #define PFS_IOCTL2_ATTR_LOOKUP PIOCATTRLOOKUP
241 #define PFS_IOCTL2_ATTR_READ PIOCATTRREAD
242 
243 // devctl commands for ps2fs.irx
244 #define PFSCTL_GET_ZONE_SIZE PDIOC_ZONESZ
245 #define PFSCTL_GET_ZONE_FREE PDIOC_ZONEFREE
246 #define PFSCTL_CLOSE_ALL PDIOC_CLOSEALL
247 #define PFSCTL_GET_STAT PDIOC_GETFSCKSTAT
248 #define PFSCTL_CLEAR_STAT PDIOC_CLRFSCKSTAT
249 
250 #define PFS_DEVCTL_GET_ZONE_SIZE PDIOC_ZONESZ
251 #define PFS_DEVCTL_GET_ZONE_FREE PDIOC_ZONEFREE
252 #define PFS_DEVCTL_CLOSE_ALL PDIOC_CLOSEALL
253 #define PFS_DEVCTL_GET_STAT PDIOC_GETFSCKSTAT
254 #define PFS_DEVCTL_CLEAR_STAT PDIOC_CLRFSCKSTAT
255 
256 #define PFS_DEVCTL_SHOW_BITMAP PDIOC_SHOWBITMAP
257 
258 #endif /* __HDD_IOCTL_H__ */
hddIoctl2Transfer_t
Definition: hdd-ioctl.h:79
hddIoctl2Transfer_t::mode
u32 mode
Definition: hdd-ioctl.h:87
hddIoctl2Transfer_t::sub
u32 sub
Definition: hdd-ioctl.h:82
hddSetOsdMBR_t
Definition: hdd-ioctl.h:144
hddIoctl2Transfer_t::size
u32 size
Definition: hdd-ioctl.h:85
tamtypes.h
hddAtaTransfer_t
Definition: hdd-ioctl.h:137