qtest/ide: add another short PRDT test flavor
PATCH 1/1 qtest/ide: add another short PRDT test flavor
The existing short PRDT test case does not transfer any data because the first PRD is less than 1 sector.
This patch adds another short PRDT test case where the first sector can be read but the PRDT is still smaller than the requested number of sectors. This exercises a different code path in ide_dma_cb().
--- tests/ide-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
tests/ide-test.c +27 -0
@@ -339,6 +339,31 @@ static void test_bmdma_short_prdt(void)assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); } +static void test_bmdma_one_sector_short_prdt (void ) +{ +uint8_t status; + +/* Read 2 sectors but only give 1 sector in PRDT */ +PrdtEntry prdt[] = { + { + .addr =0 , + .size =cpu_to_le32 (0x200 |PRDT_EOT ), + }, + }; + +/* Normal request */ + status =send_dma_request (CMD_READ_DMA ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); + +/* Abort the request before it completes */ + status =send_dma_request (CMD_READ_DMA |CMDF_ABORT ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); +} +static void test_bmdma_long_prdt (void ) {uint8_t status;
@@ -592,6 +617,8 @@ int main(int argc, char **argv)qtest_add_func ("/ide/bmdma/setup" , test_bmdma_setup);qtest_add_func ("/ide/bmdma/simple_rw" , test_bmdma_simple_rw);qtest_add_func ("/ide/bmdma/short_prdt" , test_bmdma_short_prdt); +qtest_add_func ("/ide/bmdma/one_sector_short_prdt" , + test_bmdma_one_sector_short_prdt);qtest_add_func ("/ide/bmdma/long_prdt" , test_bmdma_long_prdt);qtest_add_func ("/ide/bmdma/no_busmaster" , test_bmdma_no_busmaster);qtest_add_func ("/ide/bmdma/teardown" , test_bmdma_teardown);
Signature · 1 line
2.4.3
Quoted 51 lines · Stefan Hajnoczi
The existing short PRDT test case does not transfer any data because the first PRD is less than 1 sector.
This patch adds another short PRDT test case where the first sector can be read but the PRDT is still smaller than the requested number of sectors. This exercises a different code path in
ide_dma_cb().Cc John Snow <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- tests/ide-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)tests/ide-test.c +25
-0@@ -339,6 +339,31 @@ static void test_bmdma_short_prdt(void)assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); } +static void test_bmdma_one_sector_short_prdt (void ) +{ +uint8_t status; + +/* Read 2 sectors but only give 1 sector in PRDT */ +PrdtEntry prdt[] = { + { + .addr =0 , + .size =cpu_to_le32 (0x200 |PRDT_EOT ), + }, + }; + +/* Normal request */ + status =send_dma_request (CMD_READ_DMA ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); + +/* Abort the request before it completes */ + status =send_dma_request (CMD_READ_DMA |CMDF_ABORT ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); +} +static void test_bmdma_long_prdt (void ) {uint8_t status;
tests/ide-test.c int main(int argc, char **argv) · line 624
Quoted 8 lines
tests/ide-test.c +2
-0@@ -592,6 +617,8 @@ int main(int argc, char **argv)qtest_add_func ("/ide/bmdma/setup" , test_bmdma_setup);qtest_add_func ("/ide/bmdma/simple_rw" , test_bmdma_simple_rw);qtest_add_func ("/ide/bmdma/short_prdt" , test_bmdma_short_prdt); +qtest_add_func ("/ide/bmdma/one_sector_short_prdt" , + test_bmdma_one_sector_short_prdt);qtest_add_func ("/ide/bmdma/long_prdt" , test_bmdma_long_prdt);qtest_add_func ("/ide/bmdma/no_busmaster" , test_bmdma_no_busmaster);qtest_add_func ("/ide/bmdma/teardown" , test_bmdma_teardown);
köszönöm!
Quoted 51 lines · Stefan Hajnoczi
The existing short PRDT test case does not transfer any data because the first PRD is less than 1 sector.
This patch adds another short PRDT test case where the first sector can be read but the PRDT is still smaller than the requested number of sectors. This exercises a different code path in
ide_dma_cb().Cc John Snow <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- tests/ide-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)tests/ide-test.c +25
-0@@ -339,6 +339,31 @@ static void test_bmdma_short_prdt(void)assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); } +static void test_bmdma_one_sector_short_prdt (void ) +{ +uint8_t status; + +/* Read 2 sectors but only give 1 sector in PRDT */ +PrdtEntry prdt[] = { + { + .addr =0 , + .size =cpu_to_le32 (0x200 |PRDT_EOT ), + }, + }; + +/* Normal request */ + status =send_dma_request (CMD_READ_DMA ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); + +/* Abort the request before it completes */ + status =send_dma_request (CMD_READ_DMA |CMDF_ABORT ,0 ,2 , + prdt,ARRAY_SIZE (prdt)); + g_assert_cmphex(status, ==, 0); +assert_bit_clear (inb (IDE_BASE + reg_status),DF |ERR ); +} +static void test_bmdma_long_prdt (void ) {uint8_t status;
tests/ide-test.c int main(int argc, char **argv) · line 624
Quoted 8 lines
tests/ide-test.c +2
-0@@ -592,6 +617,8 @@ int main(int argc, char **argv)qtest_add_func ("/ide/bmdma/setup" , test_bmdma_setup);qtest_add_func ("/ide/bmdma/simple_rw" , test_bmdma_simple_rw);qtest_add_func ("/ide/bmdma/short_prdt" , test_bmdma_short_prdt); +qtest_add_func ("/ide/bmdma/one_sector_short_prdt" , + test_bmdma_one_sector_short_prdt);qtest_add_func ("/ide/bmdma/long_prdt" , test_bmdma_long_prdt);qtest_add_func ("/ide/bmdma/no_busmaster" , test_bmdma_no_busmaster);qtest_add_func ("/ide/bmdma/teardown" , test_bmdma_teardown);
I goofed and didn't stage this one. I'll batch it with the next bugfix I send out, or will otherwise stage for 2.5.
Apologies.
--js