diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 076660605d0..3545f02eaff 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -3,7 +3,6 @@ name: CI on: push: pull_request: - workflow_dispatch: repository_dispatch: types: [run_build] diff --git a/ee/kernel/src/fileio.c b/ee/kernel/src/fileio.c index 8e74bf7001c..056673b89bd 100644 --- a/ee/kernel/src/fileio.c +++ b/ee/kernel/src/fileio.c @@ -22,6 +22,7 @@ #include #include #include +#include #define D(fmt, args...) printf("(%s:%s:%i):" #fmt, __FILE__, __FUNCTION__, __LINE__, ##args) @@ -50,6 +51,7 @@ int _fio_completion_sema = -1; #ifdef F_fio_init int fioInit(void) { + int bind_retry = 100; int res; ee_sema_t sema; static int _rb_count = 0; @@ -66,8 +68,10 @@ int fioInit(void) SifInitRpc(0); while (((res = SifBindRpc(&_fio_cd, 0x80000001, 0)) >= 0) && - (_fio_cd.server == NULL)) - nopdelay(); + (_fio_cd.server == NULL)) { + nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; + } if (res < 0) return res; diff --git a/ee/kernel/src/iopheap.c b/ee/kernel/src/iopheap.c index 8f2b4df770a..ab0276bca6c 100644 --- a/ee/kernel/src/iopheap.c +++ b/ee/kernel/src/iopheap.c @@ -9,6 +9,7 @@ # Review ps2sdk README & LICENSE files for further details. */ +#include #include "tamtypes.h" #include "ps2lib_err.h" #include "kernel.h" @@ -31,7 +32,7 @@ int _ih_caps = 0; int SifInitIopHeap() { - int res; + int res, bind_retry = 100; static int _rb_count = 0; if (_rb_count != _iop_reboot_count) { @@ -46,9 +47,10 @@ int SifInitIopHeap() SifInitRpc(0); - while ((res = SifBindRpc(&_ih_cd, 0x80000003, 0)) >= 0 && !_ih_cd.server) + while ((res = SifBindRpc(&_ih_cd, 0x80000003, 0)) >= 0 && !_ih_cd.server) { nopdelay(); - + if (--bind_retry < 1) return -SCE_EBINDMISS; + } if (res < 0) return -E_SIF_RPC_BIND; diff --git a/ee/kernel/src/loadfile.c b/ee/kernel/src/loadfile.c index 4ff6964a38f..37a8bf33f0f 100644 --- a/ee/kernel/src/loadfile.c +++ b/ee/kernel/src/loadfile.c @@ -39,7 +39,7 @@ int _lf_init = 0; int SifLoadFileInit() { - int res; + int res, bind_retry = 100;; static int _rb_count = 0; if (_rb_count != _iop_reboot_count) { _rb_count = _iop_reboot_count; @@ -52,9 +52,10 @@ int SifLoadFileInit() SifInitRpc(0); - while ((res = SifBindRpc(&_lf_cd, 0x80000006, 0)) >= 0 && !_lf_cd.server) + while ((res = SifBindRpc(&_lf_cd, 0x80000006, 0)) >= 0 && !_lf_cd.server) { nopdelay(); - + if (--bind_retry < 1) return -SCE_EBINDMISS; + } if (res < 0) return -E_SIF_RPC_BIND; diff --git a/ee/network/netman/src/rpc_client.c b/ee/network/netman/src/rpc_client.c index 6733b8379ed..5408d43163e 100644 --- a/ee/network/netman/src/rpc_client.c +++ b/ee/network/netman/src/rpc_client.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "rpc_client.h" @@ -56,7 +57,7 @@ static void NETMAN_TxThread(void *arg); int NetManInitRPCClient(void){ static const char NetManID[]="NetMan"; - int result; + int result, bind_retry = 100; ee_sema_t SemaData; ee_thread_t thread; @@ -88,8 +89,10 @@ int NetManInitRPCClient(void){ return NETMAN_Tx_threadID; } - while((SifBindRpc(&NETMAN_rpc_cd, NETMAN_RPC_NUMBER, 0)<0)||(NETMAN_rpc_cd.server==NULL)) + while((SifBindRpc(&NETMAN_rpc_cd, NETMAN_RPC_NUMBER, 0)<0)||(NETMAN_rpc_cd.server==NULL)) { + if (--bind_retry < 1) return -SCE_EBINDMISS; nopdelay(); + } if((result=SifCallRpc(&NETMAN_rpc_cd, NETMAN_IOP_RPC_FUNC_INIT, 0, NULL, 0, &ReceiveBuffer, sizeof(s32), NULL, NULL))>=0) { diff --git a/ee/rpc/ahx/src/ahx_rpc.c b/ee/rpc/ahx/src/ahx_rpc.c index 68b26de16d7..4e97c84dbc1 100644 --- a/ee/rpc/ahx/src/ahx_rpc.c +++ b/ee/rpc/ahx/src/ahx_rpc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "ahx_rpc.h" static unsigned sbuff[64] __attribute__((aligned (64))); @@ -51,7 +52,7 @@ int AHX_Init() // if already init'd, exit if (ahx_init_done) return 0; - + int bind_retry = 100; // bind rpc while(1){ int i; @@ -60,6 +61,7 @@ int AHX_Init() if (cd0.server != 0) break; i = 0x10000; while(i--); + if (--bind_retry < 1) return -SCE_EBINDMISS; } SifCallRpc(&cd0,AHX_INIT,0,(void*)(&sbuff[0]),64,(void*)(&sbuff[0]),64,NULL,NULL); diff --git a/ee/rpc/audsrv/src/audsrv_rpc.c b/ee/rpc/audsrv/src/audsrv_rpc.c index 6f2b0f59c6e..122c4ef5e9d 100755 --- a/ee/rpc/audsrv/src/audsrv_rpc.c +++ b/ee/rpc/audsrv/src/audsrv_rpc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -353,6 +354,11 @@ int audsrv_init() } nopdelay(); + + if (--bind_retry < 1) { + set_error(AUDSRV_ERR_RPC_FAILED); + return -SCE_EBINDMISS; + } } compSema.init_count = 1; diff --git a/ee/rpc/camera/src/ps2cam_rpc.c b/ee/rpc/camera/src/ps2cam_rpc.c index 34bbef62a90..57fd2ecefdb 100644 --- a/ee/rpc/camera/src/ps2cam_rpc.c +++ b/ee/rpc/camera/src/ps2cam_rpc.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -36,8 +37,9 @@ int sem; int PS2CamInit(int mode) { - int ret=0; - int *buf; + int ret = 0; + int *buf; + int bind_retry = 100; // unsigned int i; // int timeout = 100000; @@ -45,9 +47,10 @@ int PS2CamInit(int mode) SifInitRpc(0); - while (((ret = SifBindRpc(&cdata, PS2_CAM_RPC_ID, 0)) >= 0) && (cdata.server == NULL)) + while (((ret = SifBindRpc(&cdata, PS2_CAM_RPC_ID, 0)) >= 0) && (cdata.server == NULL)) { + if (--bind_retry < 1) return -SCE_EBINDMISS; nopdelay(); - + } nopdelay(); diff --git a/ee/rpc/cdvd/src/libcdvd.c b/ee/rpc/cdvd/src/libcdvd.c index 39e1ed2ef80..ad348801a99 100644 --- a/ee/rpc/cdvd/src/libcdvd.c +++ b/ee/rpc/cdvd/src/libcdvd.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "internal.h" @@ -121,6 +122,7 @@ extern u32 searchFileRecvBuff; #ifdef F_sceCdInit s32 sceCdInit(s32 mode) { + int bind_retry = 100; if (_CdSyncS(1)) return 0; SifInitRpc(0); @@ -139,6 +141,7 @@ s32 sceCdInit(s32 mode) break; nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; } bindInit = 0; diff --git a/ee/rpc/filexio/src/fileXio_rpc.c b/ee/rpc/filexio/src/fileXio_rpc.c index ecb68369379..724ea566bea 100644 --- a/ee/rpc/filexio/src/fileXio_rpc.c +++ b/ee/rpc/filexio/src/fileXio_rpc.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,7 @@ static inline int _unlock(void) #ifdef F_fileXioInit int fileXioInit(void) { - int res; + int res, bind_retry = 100; ee_sema_t sp; static int _rb_count = 0; @@ -114,8 +115,10 @@ int fileXioInit(void) sp.option = 0; __lock_sema_id = CreateSema(&sp); - while(((res = SifBindRpc(&__cd0, FILEXIO_IRX, 0)) >= 0) && (__cd0.server == NULL)) + while(((res = SifBindRpc(&__cd0, FILEXIO_IRX, 0)) >= 0) && (__cd0.server == NULL)) { + if (--bind_retry < 1) return -SCE_EBINDMISS; nopdelay(); + } if(res < 0) return res; diff --git a/ee/rpc/memorycard/src/libmc.c b/ee/rpc/memorycard/src/libmc.c index 3b29962e17f..77177c8c1d0 100644 --- a/ee/rpc/memorycard/src/libmc.c +++ b/ee/rpc/memorycard/src/libmc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "libmc.h" @@ -229,7 +230,7 @@ static void mcStoreDir(void* arg) int mcInit(int type) { - int ret=0; + int ret = 0, bind_retry = 100; mcRpcStat_t *rpcStat = (mcRpcStat_t*)UNCACHED_SEG(&g_rdata.rpcStat); static int _rb_count = 0; @@ -260,6 +261,7 @@ int mcInit(int type) } if(g_cdata.server == NULL) nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; } while (g_cdata.server == NULL); diff --git a/ee/rpc/mouse/src/libmouse.c b/ee/rpc/mouse/src/libmouse.c index 05aab41d604..445b6346234 100644 --- a/ee/rpc/mouse/src/libmouse.c +++ b/ee/rpc/mouse/src/libmouse.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include "libmouse.h" @@ -39,13 +40,13 @@ static union { static int mouse_init = 0; int PS2MouseInit(void) - { - if(mouse_init) - { + int bind_retry = 100; + if (mouse_init) + { printf("PS2Mouse Library already initialised\n"); return 0; - } + } mouseif.server = NULL; @@ -54,6 +55,7 @@ int PS2MouseInit(void) return -1; } nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; } while(!mouseif.server); mouse_init = 1; diff --git a/ee/rpc/multitap/src/libmtap.c b/ee/rpc/multitap/src/libmtap.c index 1cfbf7d2647..a7d2e10a0df 100644 --- a/ee/rpc/multitap/src/libmtap.c +++ b/ee/rpc/multitap/src/libmtap.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -33,30 +34,36 @@ static int mtapInited = 0; int mtapInit(void) { + int bind_retry = 100; if(mtapInited) return -1; while(1) { if (SifBindRpc(&clientPortOpen, MTAPSERV_PORT_OPEN, 0) < 0) return -1; if (clientPortOpen.server != 0) break; + if (--bind_retry < 1) return -SCE_EBINDMISS; - nopdelay(); + nopdelay(); } + bind_retry = 100; while(1) { if (SifBindRpc(&clientPortClose, MTAPSERV_PORT_CLOSE, 0) < 0) return -1; if (clientPortClose.server != 0) break; + if (--bind_retry < 1) return -SCE_EBINDMISS; - nopdelay(); + nopdelay(); } + bind_retry = 100; while(1) { if (SifBindRpc(&clientGetConnection, MTAPSERV_GET_CONNECTION, 0) < 0) return -1; if (clientGetConnection.server != 0) break; + if (--bind_retry < 1) return -SCE_EBINDMISS; - nopdelay(); + nopdelay(); } mtapInited = 1; diff --git a/ee/rpc/pad/src/libpad.c b/ee/rpc/pad/src/libpad.c index 9d6e769c9a2..e39682e324c 100644 --- a/ee/rpc/pad/src/libpad.c +++ b/ee/rpc/pad/src/libpad.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "libpad.h" @@ -299,6 +300,7 @@ padInit(int mode) // Version check isn't used by default // int ver; static int _rb_count = 0; + int bind_retry = 100; if (_rb_count != _iop_reboot_count) { @@ -319,13 +321,16 @@ padInit(int mode) return -1; } nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; } while(!padsif[0].server); + bind_retry = 100; do { if (SifBindRpc(&padsif[1], PAD_BIND_RPC_ID2, 0) < 0) { return -3; } nopdelay(); + if (--bind_retry < 1) return -SCE_EBINDMISS; } while(!padsif[1].server); // If you require a special version of the padman, check for that here (uncomment) diff --git a/ee/rpc/poweroff/src/poweroff.c b/ee/rpc/poweroff/src/poweroff.c index 8f9a4dbc5b8..5ecd7b7d41c 100644 --- a/ee/rpc/poweroff/src/poweroff.c +++ b/ee/rpc/poweroff/src/poweroff.c @@ -16,6 +16,7 @@ #include #include #include +#include #include extern void *_gp; @@ -64,16 +65,17 @@ static void PowerOffThread(void *dat) int poweroffInit(void) { ee_thread_t thread; - int res; + int res, int bind_retry = 100; static int _init_count = -1; if (_init_count == _iop_reboot_count) return 0; _init_count = _iop_reboot_count; - while (((res = SifBindRpc(&cd0, PWROFF_IRX, 0)) < 0) || (cd0.server == NULL)) + while (((res = SifBindRpc(&cd0, PWROFF_IRX, 0)) < 0) || (cd0.server == NULL)) { nopdelay(); - + if (--bind_retry < 1) return -SCE_EBINDMISS; + } // Terminate and delete any previously created threads if (powerOffThreadId >= 0) { diff --git a/ee/rpc/ps2snd/src/ps2snd.c b/ee/rpc/ps2snd/src/ps2snd.c index c5b6d3ebf42..3b76b5631b1 100644 --- a/ee/rpc/ps2snd/src/ps2snd.c +++ b/ee/rpc/ps2snd/src/ps2snd.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -20,6 +21,7 @@ static SifRpcClientData_t sd_client ALIGNED(64); int sceSdInit(int flag) { s32 buf[1] ALIGNED(64); + int bind_retry = 100; { @@ -34,6 +36,7 @@ int sceSdInit(int flag) if (sd_client.server != NULL) break; + if (--bind_retry < 1) return -SCE_EBINDMISS; nopdelay(); } diff --git a/ee/rpc/secr/src/libsecr.c b/ee/rpc/secr/src/libsecr.c index 8e3923c6dcb..6c45e45708d 100644 --- a/ee/rpc/secr/src/libsecr.c +++ b/ee/rpc/secr/src/libsecr.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "libsecr.h" @@ -20,41 +21,55 @@ static unsigned char RpcBuffer[0x1000] ALIGNED(64); int SecrInit(void) { + int bind_retry = 100; SifInitRpc(0); nopdelay(); while (SifBindRpc(&SifRpcClient01, 0x80000A01, 0) < 0 || SifRpcClient01.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient02, 0x80000A02, 0) < 0 || SifRpcClient02.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient03, 0x80000A03, 0) < 0 || SifRpcClient03.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient04, 0x80000A04, 0) < 0 || SifRpcClient04.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient05, 0x80000A05, 0) < 0 || SifRpcClient05.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient06, 0x80000A06, 0) < 0 || SifRpcClient06.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } nopdelay(); + bind_retry = 100; while (SifBindRpc(&SifRpcClient07, 0x80000A07, 0) < 0 || SifRpcClient07.server == NULL) { _printf("libsecr: bind failed\n"); + if (--bind_retry < 1) return -SCE_EBINDMISS; } return 1; diff --git a/ee/rpc/tcpips/src/ps2ipc.c b/ee/rpc/tcpips/src/ps2ipc.c index 3c983b1ba0e..c0ed46ffd13 100644 --- a/ee/rpc/tcpips/src/ps2ipc.c +++ b/ee/rpc/tcpips/src/ps2ipc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,7 @@ extern void _ps2sdk_ps2ipc_deinit(void); int ps2ip_init(void) { + int bind_retry = 100; ee_sema_t sema; while(1) @@ -72,6 +74,7 @@ int ps2ip_init(void) if(_ps2ip.server != NULL) break; + if (--bind_retry < 1) return -SCE_EBINDMISS; nopdelay(); }