From nobody Tue May 7 00:49:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) client-ip=209.85.128.44; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f44.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632120056; cv=none; d=zohomail.com; s=zohoarc; b=WdY18O2FtLOEtCVdBImYNd55K0cNK96sln/opbd0SdXPw+vleLyvV4X1Qf/3tNTrSkMFWVzvimBMbo8ZOTwCft1GwZpxsC2MedqWEsxUgXhyudCedzIHFutVp6SFVFq9nv+RZ/JLWPiN46UeiBCx+rciPXGKoZIDG8HdHdeL/0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632120056; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=THd7jeuPtRUebml8cZHFdTMlOfIa5gz3RTHrt9j0Rw8=; b=Yqb2+RiaNO5FLzOCcThZRqfeQWCY9Go+G8XPMOlTr8dHoyKiydOFPstrW/jEThDS+vi24N7cdAGge6HwvX9KhP9ESkz0wAtu6Iyj2jr2wLnG2kr1v7cST1IOPJy1/oDATyXqGg21ywLaIgyWh9rctHQDH1bz3xiU2TZn58T57f8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.zohomail.com with SMTPS id 1632120056444182.203099162047; Sun, 19 Sep 2021 23:40:56 -0700 (PDT) Received: by mail-wm1-f44.google.com with SMTP id f62-20020a1c1f41000000b0030b42643f72so6274527wmf.3 for ; Sun, 19 Sep 2021 23:40:55 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (14.red-83-35-25.dynamicip.rima-tde.net. [83.35.25.14]) by smtp.gmail.com with ESMTPSA id m18sm14695169wrn.85.2021.09.19.23.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 23:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=THd7jeuPtRUebml8cZHFdTMlOfIa5gz3RTHrt9j0Rw8=; b=cVUzwVwFkWTXu91F9FLMg/QX1A5dJQZ0nsojpOwsMynWpvvqBTNPupgzrl5gzSwamI oAA0xcIUXIWb0UNO2Bou3fY35E1+rgDnki/wXP7XJiLJs0L+JzWm+Ezti76CGxFIAO6y wEC43Mwop7ldvP7+AIueUg02y2K9/kzgEhJ1d5XCJ/NK5wPABX14IuLXDUfn8LrSW3ry Q5A/GhSZp+ilt2FScbG0v7XAGhrngIs3wb5iaRQpPrEQbVN5jfT7MsV7R7X8hkTZnKd5 xR93vRrwtt+x+ci2ucrBs1tE0dhCos8/No0lwBe+P7kJJFRG7Zmg0vJOgr/H1KxtLSJd JB5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=THd7jeuPtRUebml8cZHFdTMlOfIa5gz3RTHrt9j0Rw8=; b=My7tN7ZLcRw2qCCk85wmQ5i3HkO4+s9sAKR22oDHF9uMPb8JlfRZtQSu3twXsbcVJH Zhpxs7qVwR8DQGH+7oM7L9IE4I8sgLlwgtHDiiXXeJGTucjrNJxDMJzf7Sa1LWLsqChk J4A9T9f8eK12zfW7tKpenGxZmeWhSRz83nVhkAy6/KfzhckJZLPY+CSwflugTbLDEFX1 h5vo6Z/VgnGHuZwuotY64XLffLakvrVRDOBULv0NWZRJwSfHLEr2MyfPIfNnBFl3sTT8 nycg247gffRcNqhddKXqthGqfmSk3P3kobIt2Ltci62PydXYLayae88Vh9cAzMFL9xW4 DZlA== X-Gm-Message-State: AOAM530e9Dih/TSg4VIpAe9GuYegmYIyzf1M2r+2+Ja4B3YpZxQimhok vTCOURkegT8Qb/IRsmpDE/Y= X-Google-Smtp-Source: ABdhPJyZl1UOlGxwlWvuE4u+O7s8gBPyNn+ss5cy+XJ0UZaJiJPgv0lTv7sG1zlHduPdK9305+IGeg== X-Received: by 2002:a05:600c:5109:: with SMTP id o9mr18256587wms.90.1632120054550; Sun, 19 Sep 2021 23:40:54 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Sven Schnelle , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/3] hw/input/lasips2: Fix typos in function names Date: Mon, 20 Sep 2021 08:40:46 +0200 Message-Id: <20210920064048.2729397-2-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210920064048.2729397-1-f4bug@amsat.org> References: <20210920064048.2729397-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632120057539100001 Artist is another device, this one is the Lasi PS/2. Rename the functions accordingly. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Damien Hedde --- hw/input/lasips2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index e7faf24058b..68d741d3421 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -96,7 +96,7 @@ typedef enum { LASIPS2_STATUS_CLKSHD =3D 0x80, } lasips2_status_reg_t; =20 -static const char *artist_read_reg_name(uint64_t addr) +static const char *lasips2_read_reg_name(uint64_t addr) { switch (addr & 0xc) { case REG_PS2_ID: @@ -116,7 +116,7 @@ static const char *artist_read_reg_name(uint64_t addr) } } =20 -static const char *artist_write_reg_name(uint64_t addr) +static const char *lasips2_write_reg_name(uint64_t addr) { switch (addr & 0x0c) { case REG_PS2_RESET: @@ -145,7 +145,7 @@ static void lasips2_reg_write(void *opaque, hwaddr addr= , uint64_t val, LASIPS2Port *port =3D opaque; =20 trace_lasips2_reg_write(size, port->id, addr, - artist_write_reg_name(addr), val); + lasips2_write_reg_name(addr), val); =20 switch (addr & 0xc) { case REG_PS2_CONTROL: @@ -239,7 +239,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr a= ddr, unsigned size) break; } trace_lasips2_reg_read(size, port->id, addr, - artist_read_reg_name(addr), ret); + lasips2_read_reg_name(addr), ret); =20 return ret; } --=20 2.31.1 From nobody Tue May 7 00:49:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) client-ip=209.85.221.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632120061; cv=none; d=zohomail.com; s=zohoarc; b=e3TLSjP7iadz7fA16Ld90R5KVs1619qJ/4UfGsJY/hd02K0MxrJLfoZjwzBH3WWtYmiJEJFZDVPvONHRsiBtDQWig5hMSaaIrLDYC4XRmRwwxgqq4gXsDVS3yt1BOFyJHQvPogZ7RbVOyu+Y0eY+H/rbrskNQLrobWrse/PEZHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632120061; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EcOr1QmO1S16fr4fOEvRxqFLTXjTaCedzwKUta20dVg=; b=I3AaL3oGDe//rTmEgjK7kGfvgNN78OoeZC2fH+IBxXgtsdPYL/ls4L7K+sq3a+sEmU6uvnf4kn7OKPCMpwnTS1WVTu+M818IOh4N1KpBY+oIwvuZMJLiSMFQga9mgEr6SJhEaeG2j5RicyyC8H7jLlLW145rkq0UiBiqxE8SM4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.zohomail.com with SMTPS id 1632120061573208.97605167044162; Sun, 19 Sep 2021 23:41:01 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id t18so26952535wrb.0 for ; Sun, 19 Sep 2021 23:41:01 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (14.red-83-35-25.dynamicip.rima-tde.net. [83.35.25.14]) by smtp.gmail.com with ESMTPSA id g205sm11057803wmg.18.2021.09.19.23.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 23:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EcOr1QmO1S16fr4fOEvRxqFLTXjTaCedzwKUta20dVg=; b=M645RUxHr+fjF2Oxsz/54Ni4G92bdFpLctuYWDoWcga4O5B76pSfRxpvYbCDSLhMlJ tTjJKAbAmWsCTUy58U+ONZwZoAt1/N82LgH7HDaz27mzxS3vWER63NLHakbdfPwjs3vn fWc0S5pHC7EjoUBiR/zgUw9D/VWpEl3/419xfMnNBFylWseSx/nlRM7j1Feq+9XzLsGJ F6R26pBOlrqpHHG8EBrK9XKoU/vhE2jiF2nD7xacBHMNGxRMe0J/nEW7JsD72c7QkCer FBHDMrTmzSqHRMXFocdvQPdxOo7MHVPs4/3vs8AxaVa8r1g/eE95FwPKbHvYg7rNGY1Q nyvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EcOr1QmO1S16fr4fOEvRxqFLTXjTaCedzwKUta20dVg=; b=dTFIQNUMvtOiCSKCIUQzLasoCrKw8ClHeaotZVgigcfDhHl6yEWoWxSsQMiNesHQgw rCvsP6gjEdFxaG7RBZU+9GxtaW0YlPpiKgnkPFFeMeDCf9AZaiM7L91ZvhNNEn6pnGa5 9pR02olYlLFEKp6tWD5mxqnWQ7awjV1ns0uMP+KOlsy/I6vPtMicApKry3OyBFbBJjPH bakG+d7bHKtC0gtJatGtQnFDIzgM/oBWoPohJ4CVJ2Dk6RAGrK1czCoYXxFVNlB9rsM+ N2uLtpevzQQmiRybyhxUwLk+19QO59ivJLYlazsK4e9idrawJvgp8Cvjd8lB5wRU1Jpl JfYQ== X-Gm-Message-State: AOAM532e3cgCc+/PTJlt3uSi5QChivSp0AJ7Zv3ThJ1FOCQ++cu0mjF+ n57+Zt70GFV0CqhVtdVhOWLE1gX8FhY= X-Google-Smtp-Source: ABdhPJyD5RuJN634Qj2x9308noTh5esQTBBXGuRJCttvftLoiBuTZJJx1XXeaofD8AGOY4KgTugYQw== X-Received: by 2002:adf:d1c5:: with SMTP id b5mr9563327wrd.252.1632120059828; Sun, 19 Sep 2021 23:40:59 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Sven Schnelle , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] hw/input/lasips2: Move LASIPS2State declaration to 'hw/input/lasips2.h' Date: Mon, 20 Sep 2021 08:40:47 +0200 Message-Id: <20210920064048.2729397-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210920064048.2729397-1-f4bug@amsat.org> References: <20210920064048.2729397-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632120063116100001 We want to use the OBJECT_DECLARE_SIMPLE_TYPE() macro to QOM'ify this device in the next commit. To make its review simpler, as a first step move the LASIPS2State and LASIPS2Port declarations to 'hw/input/lasips2.h' Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Damien Hedde --- include/hw/input/lasips2.h | 18 ++++++++++++++++++ hw/input/lasips2.c | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index 0cd7b59064a..c88f1700162 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -11,6 +11,24 @@ =20 #define TYPE_LASIPS2 "lasips2" =20 +struct LASIPS2State; +typedef struct LASIPS2Port { + struct LASIPS2State *parent; + MemoryRegion reg; + void *dev; + uint8_t id; + uint8_t control; + uint8_t buf; + bool loopback_rbne; + bool irq; +} LASIPS2Port; + +typedef struct LASIPS2State { + LASIPS2Port kbd; + LASIPS2Port mouse; + qemu_irq irq; +} LASIPS2State; + void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); =20 #endif /* HW_INPUT_LASIPS2_H */ diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 68d741d3421..0f8362f17bc 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -33,24 +33,6 @@ #include "hw/irq.h" =20 =20 -struct LASIPS2State; -typedef struct LASIPS2Port { - struct LASIPS2State *parent; - MemoryRegion reg; - void *dev; - uint8_t id; - uint8_t control; - uint8_t buf; - bool loopback_rbne; - bool irq; -} LASIPS2Port; - -typedef struct LASIPS2State { - LASIPS2Port kbd; - LASIPS2Port mouse; - qemu_irq irq; -} LASIPS2State; - static const VMStateDescription vmstate_lasips2 =3D { .name =3D "lasips2", .version_id =3D 0, --=20 2.31.1 From nobody Tue May 7 00:49:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) client-ip=209.85.128.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632120066; cv=none; d=zohomail.com; s=zohoarc; b=Y5bnDjItL0+/oETMPnbexE0Zy58T6Ozq0XKfddmbAp/JELlEVm96W9Tyq4Q3Lru8ZFnglPkIPNEhNhkWMBPAo4Vw+eArwxjDZnp5XVjfd+hor+z6FIrkdfep8YSaYBFgGbn5Y1w4ZXGLXKL7Xw3dwrQUGk2Py4lq6bjVZw7TTGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632120066; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a+jhWDFKdh/csNwM2kZoLEHXPRdPcvqhfnrisZ5O72k=; b=U7cN2TkLyBDDDUQ6vrkk6CUohVpSW8OEBHfcOuApvcDownWGK+cy8TNgnXR7YI7FLHp2x4ov+nrkLUEXp4ZGE4yXAdKfGI85WWb4SYo97XFQe8xvJj6U99OrB82Jhfq/BkOF2SsHwrItPJs4m/r+ybGGhEicywJRi/Vy/Jx/tKE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.zohomail.com with SMTPS id 1632120066738597.2714781500121; Sun, 19 Sep 2021 23:41:06 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id d207-20020a1c1dd8000000b00307e2d1ec1aso11256833wmd.5 for ; Sun, 19 Sep 2021 23:41:06 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (14.red-83-35-25.dynamicip.rima-tde.net. [83.35.25.14]) by smtp.gmail.com with ESMTPSA id r25sm15138771wra.76.2021.09.19.23.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 23:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a+jhWDFKdh/csNwM2kZoLEHXPRdPcvqhfnrisZ5O72k=; b=jjAqyE1bnqavT8fGY43/AqqOp1oe3hgE6Wi8cu8Q7mwXhouLbhHNdrkXk0FiQrDT8h uxrdY3hlqrx2GGFGlHSMCrWDcBe2VRXgbt0q4u59p+sTFY+BFTbdoAhId9BGJWikd54s 1qE1CfObEx4mn+W2dwwtAIiUGmpn2RFV/D1YleE+P085xOzHgiQq0HlTY/zvTTrmBsbb QgngEkj/FRUX2pabWtgqbIxHH8SmJHFICGNdE7P2ovyVJtLgthQh9lLJ0tmJnFPUelNb UVyNKR+dIvlsChG4s5HBhDl4Pn4Hsi18/kg+25GJnNkB9kx6lS4r+tn9mYUnbFfmEMIq YUow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=a+jhWDFKdh/csNwM2kZoLEHXPRdPcvqhfnrisZ5O72k=; b=75VDlRmeeUDOpEuLMwUhCcNkRmNL5N85uPh6XpbkCVF/6+2BR3S9HB+dRiYIoipokZ QiQvImKpt484Kldz2Nahn4G2f/vVJfwEFMt9DzzTX2KkZN92uWsi6U5Xb4ETzk3H0b37 qhuFuRoRJFZ+TMcZpCLycnVg9uG/RYTexsl41Ur/gwxu9RHmUiSIMAHuoPos2bbl32Ca UHPgyH/AC2bJANz9P62NCEGJPAYCWx2Ik7f8crnmfzo4HRGaiT/oGBY2Zsa84D4Fx6HD EaGN1UCB8QfBf0qTW9luasBfMIke/LJPKTaFCmFpk0RWIchKW7BPqT2s2ryTlgaqZj0K kfvg== X-Gm-Message-State: AOAM532TD5DEbWSn9EWOKIMi2Cnep8KKqHQ51AHeqz9g80EDsdu4eVBd XNgcbW5oJq4+QLeZ9sAD1n0= X-Google-Smtp-Source: ABdhPJwKFR2Csp5IdXpN4GXoD70PVvCjn7pX4zzJE6EuL/y4hzH1PDO3Dcyqp9QBKvCdE7kO2i9fQg== X-Received: by 2002:a7b:cb0c:: with SMTP id u12mr22431646wmj.70.1632120064949; Sun, 19 Sep 2021 23:41:04 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Sven Schnelle , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/3] hw/input/lasips2: QOM'ify the Lasi PS/2 Date: Mon, 20 Sep 2021 08:40:48 +0200 Message-Id: <20210920064048.2729397-4-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210920064048.2729397-1-f4bug@amsat.org> References: <20210920064048.2729397-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632120067589100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Damien Hedde --- include/hw/input/lasips2.h | 17 +++++++++++++---- hw/hppa/lasi.c | 10 +++++++++- hw/input/lasips2.c | 38 ++++++++++++++++++++++++++++---------- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h index c88f1700162..834b6d867d9 100644 --- a/include/hw/input/lasips2.h +++ b/include/hw/input/lasips2.h @@ -7,11 +7,11 @@ #ifndef HW_INPUT_LASIPS2_H #define HW_INPUT_LASIPS2_H =20 -#include "exec/hwaddr.h" +#include "hw/sysbus.h" =20 #define TYPE_LASIPS2 "lasips2" +OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2) =20 -struct LASIPS2State; typedef struct LASIPS2Port { struct LASIPS2State *parent; MemoryRegion reg; @@ -23,12 +23,21 @@ typedef struct LASIPS2Port { bool irq; } LASIPS2Port; =20 +/* + * QEMU interface: + * + sysbus MMIO region 0 is the keyboard port interface + * + sysbus MMIO region 1 is the mouse port interface + * + sysbus IRQ 0 is the interrupt line shared between + * keyboard and mouse ports + */ typedef struct LASIPS2State { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ LASIPS2Port kbd; LASIPS2Port mouse; qemu_irq irq; } LASIPS2State; =20 -void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq); - #endif /* HW_INPUT_LASIPS2_H */ diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c index 88c3791eb68..91414748b70 100644 --- a/hw/hppa/lasi.c +++ b/hw/hppa/lasi.c @@ -297,6 +297,7 @@ static int lasi_get_irq(unsigned long hpa) DeviceState *lasi_init(MemoryRegion *address_space) { DeviceState *dev; + SysBusDevice *sbd; LasiState *s; =20 dev =3D qdev_new(TYPE_LASI_CHIP); @@ -340,7 +341,14 @@ DeviceState *lasi_init(MemoryRegion *address_space) /* PS/2 Keyboard/Mouse */ qemu_irq ps2kbd_irq =3D qemu_allocate_irq(lasi_set_irq, s, lasi_get_irq(LASI_PS2KBD_HPA)); - lasips2_init(address_space, LASI_PS2KBD_HPA, ps2kbd_irq); + + sbd =3D SYS_BUS_DEVICE(qdev_new(TYPE_LASIPS2)); + sysbus_realize_and_unref(sbd, &error_fatal); + memory_region_add_subregion(address_space, LASI_PS2KBD_HPA, + sysbus_mmio_get_region(sbd, 0)); + memory_region_add_subregion(address_space, LASI_PS2MOU_HPA, + sysbus_mmio_get_region(sbd, 1)); + sysbus_connect_irq(sbd, 0, ps2kbd_irq); =20 return dev; } diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 0f8362f17bc..46cd32316da 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -243,28 +243,46 @@ static void ps2dev_update_irq(void *opaque, int level) lasips2_update_irq(port->parent); } =20 -void lasips2_init(MemoryRegion *address_space, - hwaddr base, qemu_irq irq) +static void lasips2_init(Object *obj) { - LASIPS2State *s; + LASIPS2State *s =3D LASIPS2(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - s =3D g_malloc0(sizeof(LASIPS2State)); - - s->irq =3D irq; + sysbus_init_irq(sbd, &s->irq); s->mouse.id =3D 1; s->kbd.parent =3D s; s->mouse.parent =3D s; =20 - vmstate_register(NULL, base, &vmstate_lasips2, s); - s->kbd.dev =3D ps2_kbd_init(ps2dev_update_irq, &s->kbd); s->mouse.dev =3D ps2_mouse_init(ps2dev_update_irq, &s->mouse); =20 memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd, "lasips2-kbd", 0x100); - memory_region_add_subregion(address_space, base, &s->kbd.reg); + sysbus_init_mmio(sbd, &s->kbd.reg); =20 memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse, "lasips2-mouse", 0x100); - memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg= ); + sysbus_init_mmio(sbd, &s->mouse.reg); } + +static void lasips2_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->vmsd =3D &vmstate_lasips2; +} + +static const TypeInfo lasips2_info =3D { + .name =3D TYPE_LASIPS2, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(LASIPS2State), + .instance_init =3D lasips2_init, + .class_init =3D lasips2_class_init, +}; + +static void lasips2_register_types(void) +{ + type_register_static(&lasips2_info); +} + +type_init(lasips2_register_types) --=20 2.31.1