diff mbox series

[056/120] MIPS: PS2: SIF: Respond to RPC bind end command

Message ID 07edaf69eae2bfa41daae262be2d6aac233a2a48.1567326213.git.noring@nocrew.org (mailing list archive)
State RFC
Headers show
Series Linux for the PlayStation 2 | expand

Commit Message

Fredrik Noring Sept. 1, 2019, 3:58 p.m. UTC
The IOP responds with a bind end to the main processor's corresponding
command, containing the IOP server memory address to store RPC data.

Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
 drivers/ps2/sif.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/drivers/ps2/sif.c b/drivers/ps2/sif.c
index 7d0b120398d1..095d11810499 100644
--- a/drivers/ps2/sif.c
+++ b/drivers/ps2/sif.c
@@ -298,6 +298,28 @@  static struct sif_cmd_handler *handler_from_cid(u32 cmd_id)
 	return id < CMD_HANDLER_MAX ? &cmd_handlers[id] : NULL;
 }
 
+static void cmd_rpc_end(const struct sif_cmd_header *header,
+	const void *data, void *arg)
+{
+	const struct sif_rpc_request_end_packet *packet = data;
+	struct sif_rpc_client *client = packet->client;
+
+	switch (packet->client_id) {
+	case SIF_CMD_RPC_CALL:
+		break;
+
+	case SIF_CMD_RPC_BIND:
+		client->server = packet->server;
+		client->server_buffer = packet->server_buffer;
+		break;
+
+	default:
+		BUG();
+	}
+
+	complete_all(&client->done);
+}
+
 static void cmd_rpc_bind(const struct sif_cmd_header *header,
 	const void *data, void *arg)
 {
@@ -406,6 +428,7 @@  static int sif_request_cmds(void)
 	} cmds[] = {
 		{ SIF_CMD_WRITE_SREG, cmd_write_sreg, NULL },
 
+		{ SIF_CMD_RPC_END,    cmd_rpc_end,    NULL },
 		{ SIF_CMD_RPC_BIND,   cmd_rpc_bind,   NULL },
 	};
 	int err = 0;