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