Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions common/include/fileXio.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <tamtypes.h>
#include <iox_stat.h>
#include <sifrpc.h>

#ifdef _EE
#ifndef NEWLIB_PORT_AWARE
Expand Down Expand Up @@ -101,7 +102,7 @@ struct fileXioDirEntry
u32 fileSize;
u8 fileProperties;
char filename[128 + 1];
} __attribute__((aligned(64)));
} ALIGNED_FOR_SIFDMA;

struct fileXioDevice
{
Expand All @@ -110,7 +111,7 @@ struct fileXioDevice
/** Not so sure about this one. */
unsigned int version;
char desc[128];
} __attribute__((aligned(64)));
} ALIGNED_FOR_SIFDMA;

struct fxio_devlist_packet
{
Expand Down
17 changes: 9 additions & 8 deletions common/include/fileio-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <tamtypes.h>
#include <io_common.h>
#include <sifrpc.h>

// fileio common definitions

Expand Down Expand Up @@ -51,23 +52,23 @@ struct _fio_read_data
void *dest2;
u8 buf1[16];
u8 buf2[16];
};
} ALIGNED_FOR_SIFDMA;

#define FIO_PATH_MAX 256

struct _fio_open_arg
{
int mode;
char name[FIO_PATH_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_read_arg
{
int fd;
void *ptr;
int size;
struct _fio_read_data *read_data;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_write_arg
{
Expand All @@ -76,7 +77,7 @@ struct _fio_write_arg
u32 size;
u32 mis;
u8 aligned[16];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_lseek_arg
{
Expand All @@ -87,7 +88,7 @@ struct _fio_lseek_arg
} p;
int offset;
int whence;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_ioctl_arg
{
Expand All @@ -98,7 +99,7 @@ struct _fio_ioctl_arg
} p;
int request;
u8 data[1024]; // Will this be ok ?
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_dread_arg
{
Expand All @@ -108,7 +109,7 @@ struct _fio_dread_arg
int result;
} p;
io_dirent_t *buf;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_getstat_arg
{
Expand All @@ -118,7 +119,7 @@ struct _fio_getstat_arg
int result;
} p;
char name[FIO_PATH_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _fio_chstat_arg
{
Expand Down
3 changes: 2 additions & 1 deletion common/include/librm-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define __LIBRM_COMMON_H__

#include <tamtypes.h>
#include <sifrpc.h>

struct rmRpcPacket
{
Expand All @@ -42,7 +43,7 @@ struct rmRpcPacket
} cmd;
u8 buffer[128];
};
};
} ALIGNED_FOR_SIFDMA;

struct rmEEData
{
Expand Down
17 changes: 9 additions & 8 deletions common/include/loadfile-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define __LOADFILE_COMMON_H__

#include <tamtypes.h>
#include <sifrpc.h>

// loadfile common definitions

Expand Down Expand Up @@ -72,7 +73,7 @@ struct _lf_iop_val_arg
u16 s;
u32 l;
} val;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_module_load_arg
{
Expand All @@ -84,7 +85,7 @@ struct _lf_module_load_arg
int modres;
char path[LF_PATH_MAX];
char args[LF_ARG_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_module_stop_arg
{
Expand All @@ -100,21 +101,21 @@ struct _lf_module_stop_arg
} q;
char dummy[LF_PATH_MAX];
char args[LF_ARG_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

union _lf_module_unload_arg
{
int id;
int result;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_search_module_by_name_arg
{
int id;
int dummy1;
char name[LF_PATH_MAX];
char dummy2[LF_ARG_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_search_module_by_address_arg
{
Expand All @@ -123,15 +124,15 @@ struct _lf_search_module_by_address_arg
const void *ptr;
int id;
} p;
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_elf_load_arg
{
u32 epc;
u32 gp;
char path[LF_PATH_MAX];
char secname[LF_ARG_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

struct _lf_module_buffer_load_arg
{
Expand All @@ -147,6 +148,6 @@ struct _lf_module_buffer_load_arg
} q;
char unused[LF_PATH_MAX];
char args[LF_ARG_MAX];
} __attribute__((aligned(16)));
} ALIGNED_FOR_SIFDMA;

#endif
14 changes: 12 additions & 2 deletions common/include/sifcmd-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

#include <tamtypes.h>

#ifdef _IOP
/* 16 byte alignment (4 byte if accessing through uncached segment), 16 byte size multiple */
#define ALIGNED_FOR_SIFDMA __attribute__((__aligned__((16))))
#define ALIGNED_FOR_SIFDMA_UNCACHED __attribute__((__aligned__((4))))
#else
/* 64 byte alignment (16 byte if accessing through uncached segment), 16 byte size multiple */
#define ALIGNED_FOR_SIFDMA __attribute__((__aligned__((64))))
#define ALIGNED_FOR_SIFDMA_UNCACHED __attribute__((__aligned__((16))))
#endif

/** SIF command. */
typedef struct t_SifCmdHeader
{
Expand All @@ -31,7 +41,7 @@ typedef struct t_SifCmdHeader
int cid;
/** Can be freely used. */
u32 opt;
} SifCmdHeader_t;
} ALIGNED_FOR_SIFDMA SifCmdHeader_t;

/** System functions */
#define SIF_CMD_ID_SYSTEM 0x80000000
Expand Down Expand Up @@ -81,7 +91,7 @@ typedef struct t_SifCmdSysHandlerData

typedef struct _iop_reset_pkt
{
struct t_SifCmdHeader header;
SifCmdHeader_t header;
int arglen;
int mode;
char arg[RESET_ARG_MAX + 1];
Expand Down
20 changes: 10 additions & 10 deletions common/include/sifrpc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ typedef void (*SifRpcEndFunc_t)(void *end_param);

typedef struct t_SifRpcPktHeader
{
struct t_SifCmdHeader sifcmd;
SifCmdHeader_t sifcmd;
int rec_id;
void *pkt_addr;
int rpc_id;
} SifRpcPktHeader_t;

typedef struct t_SifRpcRendPkt
{
struct t_SifCmdHeader sifcmd;
SifCmdHeader_t sifcmd;
int rec_id; /* 04 */
void *pkt_addr; /* 05 */
int rpc_id; /* 06 */
Expand All @@ -59,7 +59,7 @@ typedef struct t_SifRpcRendPkt

typedef struct t_SifRpcOtherDataPkt
{
struct t_SifCmdHeader sifcmd;
SifCmdHeader_t sifcmd;
int rec_id; /* 04 */
void *pkt_addr; /* 05 */
int rpc_id; /* 06 */
Expand All @@ -72,7 +72,7 @@ typedef struct t_SifRpcOtherDataPkt

typedef struct t_SifRpcBindPkt
{
struct t_SifCmdHeader sifcmd;
SifCmdHeader_t sifcmd;
int rec_id; /* 04 */
void *pkt_addr; /* 05 */
int rpc_id; /* 06 */
Expand All @@ -82,7 +82,7 @@ typedef struct t_SifRpcBindPkt

typedef struct t_SifRpcCallPkt
{
struct t_SifCmdHeader sifcmd;
SifCmdHeader_t sifcmd;
int rec_id; /* 04 */
void *pkt_addr; /* 05 */
int rpc_id; /* 06 */
Expand Down Expand Up @@ -119,7 +119,7 @@ typedef struct t_SifRpcServerData
struct t_SifRpcServerData *link; /* 18 14 */
struct t_SifRpcServerData *next; /* 19 15 */
struct t_SifRpcDataQueue *base; /* 20 16 */
} SifRpcServerData_t;
} ALIGNED_FOR_SIFDMA SifRpcServerData_t;


typedef struct t_SifRpcHeader
Expand All @@ -128,12 +128,12 @@ typedef struct t_SifRpcHeader
u32 rpc_id; /* 05 01 */
int sema_id; /* 06 02 */
u32 mode; /* 07 03 */
} SifRpcHeader_t;
} ALIGNED_FOR_SIFDMA SifRpcHeader_t;


typedef struct t_SifRpcClientData
{
struct t_SifRpcHeader hdr;
SifRpcHeader_t hdr;
u32 command; /* 04 08 */
void *buf, /* 05 09 */
*cbuf; /* 06 10 */
Expand All @@ -144,7 +144,7 @@ typedef struct t_SifRpcClientData

typedef struct t_SifRpcReceiveData
{
struct t_SifRpcHeader hdr;
SifRpcHeader_t hdr;
void *src, /* 04 */
*dest; /* 05 */
int size; /* 06 */
Expand All @@ -158,7 +158,7 @@ typedef struct t_SifRpcDataQueue
*start, /* 03 */
*end; /* 04 */
struct t_SifRpcDataQueue *next; /* 05 */
} SifRpcDataQueue_t;
} ALIGNED_FOR_SIFDMA SifRpcDataQueue_t;

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion ee/iopreboot/src/SifIopRebootBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern int imgdrv_offset_ioprpsiz;
extern void init_imgdrv_offsets(void);

#ifdef F__iopcontrol_special_internals
u8 iopbtconf_img[IOPBTCONF_IOP_MAX_SIZE] __attribute__((aligned(64)));
u8 iopbtconf_img[IOPBTCONF_IOP_MAX_SIZE] ALIGNED_FOR_SIFDMA;
int imgdrv_offset_ioprpimg = 0;
int imgdrv_offset_ioprpsiz = 0;

Expand Down
4 changes: 2 additions & 2 deletions ee/kernel/src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void _fio_intr();

#ifdef F___fio_internals
SifRpcClientData_t _fio_cd;
int _fio_recv_data[512] __attribute__((aligned(64)));
int _fio_intr_data[32] __attribute__((aligned(64)));
int _fio_recv_data[512] ALIGNED_FOR_SIFDMA;
int _fio_intr_data[32] ALIGNED_FOR_SIFDMA;
int _fio_block_mode;
int _fio_io_sema;
int _fio_completion_sema;
Expand Down
4 changes: 2 additions & 2 deletions ee/kernel/src/iopcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ extern int _iop_reboot_count;

int SifIopReset(const char *arg, int mode)
{
static SifCmdResetData_t reset_pkt __attribute__((aligned(64)));
struct t_SifDmaTransfer dmat;
static SifCmdResetData_t reset_pkt;
SifDmaTransfer_t dmat;
int arglen;

_iop_reboot_count++; // increment reboot counter to allow RPC clients to detect unbinding!
Expand Down
2 changes: 1 addition & 1 deletion ee/kernel/src/rom0_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void SetupRomInfo(void)
{
void *iop_addr;
SifRpcReceiveData_t rdata;
u8 buf[64] __attribute__((__aligned__(64)));
u8 buf[64] ALIGNED_FOR_SIFDMA;

/* ROMVER needs to be read from the IOP due to PPCIOP region patching. */
/* only read in the romname the first time */
Expand Down
8 changes: 4 additions & 4 deletions ee/kernel/src/sifcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct cmd_data
SifCmdHandlerData_t *usr_cmd_handlers;
u32 nr_usr_handlers;
int *sregs;
} __attribute__((aligned(64)));
} ALIGNED_FOR_SIFDMA;

extern struct cmd_data _sif_cmd_data;
extern unsigned int _SifSendCmd(int cid, int mode, void *pkt, int pktsize, void *src,
Expand Down Expand Up @@ -173,10 +173,10 @@ int _SifCmdIntHandler(int channel)
#endif

#ifdef F_sif_cmd_main
static u8 pktbuf[CMD_PACKET_MAX] __attribute__((aligned(64)));
static u8 pktbuf[CMD_PACKET_MAX] ALIGNED_FOR_SIFDMA;
/* Define this so that in the unlikely case another SIF implementation decides
to use it, it won't crash. Otherwise unused. */
static u8 sif_unused[64] __attribute__((aligned(64)));
static u8 sif_unused[64] ALIGNED_FOR_SIFDMA;

static SifCmdSysHandlerData_t sys_cmd_handlers[SYS_CMD_HANDLER_MAX];
static int sregs[32];
Expand Down Expand Up @@ -215,7 +215,7 @@ static void set_sreg(void *packet, void *harg)

void sceSifInitCmd(void)
{
static struct ca_pkt packet __attribute((aligned(64)));
static struct ca_pkt packet;
int i;
if (HasIopRebootedSinceLastCall())
sceSifExitCmd();
Expand Down
Loading
Loading