[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 11/11] tests/qtest: Adding PCS Module test to GMAC Qtest
From: |
Peter Maydell |
Subject: |
Re: [PATCH v8 11/11] tests/qtest: Adding PCS Module test to GMAC Qtest |
Date: |
Mon, 18 Dec 2023 14:43:01 +0000 |
On Thu, 14 Dec 2023 at 21:15, Nabih Estefan <nabihestefan@google.com> wrote:
>
> From: Nabih Estefan Diaz <nabihestefan@google.com>
>
> - Add PCS Register check to npcm_gmac-test
>
> Signed-off-by: Nabih Estefan <nabihestefan@google.com>
> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> ---
> @@ -129,7 +198,12 @@ static void test_init(gconstpointer test_data)
> #define CHECK_REG32(regno, value) \
> do { \
> g_assert_cmphex(gmac_read(qts, mod, (regno)), ==, (value)); \
> - } while (0)
> + } while (0) ;
> +
> +#define CHECK_REG_PCS(regno, value) \
> + do { \
> + g_assert_cmphex(pcs_read(qts, mod, (regno)), ==, (value)); \
> + } while (0) ;
The standard way to write this kind of do {...} while (0)
macro does not have a ';' at the end of the definition.
That's the whole point of the idiom -- it means the macro
expands to a single C statement, so it does the right thing
if you write
if CHECK_REG_PCS(x,y)
goto foo;
without braces. You got this right with CHECK_REG32(), but
then this patch (a) incorrectly adds the extra ';' to it
and (b) has a ';' after the new macro.
> CHECK_REG32(NPCM_DMA_BUS_MODE, 0x00020100);
> CHECK_REG32(NPCM_DMA_XMT_POLL_DEMAND, 0);
> @@ -180,6 +254,64 @@ static void test_init(gconstpointer test_data)
> CHECK_REG32(NPCM_GMAC_PTP_TAR, 0);
> CHECK_REG32(NPCM_GMAC_PTP_TTSR, 0);
>
> + /* TODO Add registers PCS */
> + if (mod->base_addr == 0xf0802000) {
> + CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID1, 0x699e)
> + CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID2, 0)
These should all have a trailing ';' like the CHECK_REG32()
invocations. This makes them look like function calls
syntax-wise, which is nice for things like editor code
indentation.
thanks
-- PMM
- [PATCH v8 00/11] Implementation of NPI Mailbox and GMAC Networking Module, Nabih Estefan, 2023/12/14
- [PATCH v8 03/11] hw/misc: Add qtest for NPCM7xx PCI Mailbox, Nabih Estefan, 2023/12/14
- [PATCH v8 05/11] hw/arm: Add GMAC devices to NPCM7XX SoC, Nabih Estefan, 2023/12/14
- [PATCH v8 02/11] hw/arm: Add PCI mailbox module to Nuvoton SoC, Nabih Estefan, 2023/12/14
- [PATCH v8 01/11] hw/misc: Add Nuvoton's PCI Mailbox Module, Nabih Estefan, 2023/12/14
- [PATCH v8 09/11] hw/net: GMAC Rx Implementation, Nabih Estefan, 2023/12/14
- [PATCH v8 10/11] hw/net: GMAC Tx Implementation, Nabih Estefan, 2023/12/14
- [PATCH v8 06/11] tests/qtest: Creating qtest for GMAC Module, Nabih Estefan, 2023/12/14
- [PATCH v8 11/11] tests/qtest: Adding PCS Module test to GMAC Qtest, Nabih Estefan, 2023/12/14
- Re: [PATCH v8 11/11] tests/qtest: Adding PCS Module test to GMAC Qtest,
Peter Maydell <=
- [PATCH v8 07/11] include/hw/net: Implemented Classes and Masks for GMAC Descriptors, Nabih Estefan, 2023/12/14
- [PATCH v8 08/11] hw/net: General GMAC Implementation, Nabih Estefan, 2023/12/14
- [PATCH v8 04/11] hw/net: Add NPCMXXX GMAC device, Nabih Estefan, 2023/12/14