%{
    #define UCSI_CONTROL			8
    #define UCSI_MESSAGE_IN			16
    struct ucsi_acpi {
        struct device *dev;
        struct ucsi *ucsi;
        void *base;
        struct completion complete;
        unsigned long flags;
    #define UCSI_ACPI_COMMAND_PENDING	1
    #define UCSI_ACPI_ACK_PENDING		2
    #define UCSI_ACPI_CHECK_BOGUS_EVENT	3
        guid_t guid;
        u64 cmd;
    };
%}

probe module("typec_ucsi").function("schedule_work") {
    printf("scheduling connector change\n");
}

function acpi_read(val, offset) %{
    switch (STAP_ARG_offset) {
	case UCSI_MESSAGE_IN:
		uint64_t *msg_in = (uint64_t *)STAP_ARG_val;
        STAP_PRINTF("MESSAGE_IN: %llx %llx\n", msg_in[1], msg_in[0]);
		break;      
	}
%}

probe module("ucsi_acpi").statement("ucsi_acpi_read@drivers/usb/typec/ucsi/ucsi_acpi.c:59") {
    acpi_read($val, $offset);
}

function acpi_async_write(ua, offset) %{
    switch (STAP_ARG_offset) {
	case UCSI_CONTROL:
		STAP_PRINTF("COMMAND: %llx\n", ((struct ucsi_acpi *)STAP_ARG_ua)->cmd);
		break;
	}
%}

probe module("ucsi_acpi").statement("ucsi_acpi_async_write@drivers/usb/typec/ucsi/ucsi_acpi.c:72") {
    acpi_async_write($ua, $offset);
}

function acpi_notify(cci) %{
    STAP_PRINTF("CCI: %x\n", (u32)STAP_ARG_cci);
%}

probe module("ucsi_acpi").statement("ucsi_acpi_notify@drivers/usb/typec/ucsi/ucsi_acpi.c:213") {
    acpi_notify($cci);
}