| 2004 | |
| 2005 | #define MAX_TRNG_RETRIES 10 |
| 2006 | u_int |
| 2007 | random_ccp_read(void *v, u_int c) |
| 2008 | { |
| 2009 | uint32_t *buf; |
| 2010 | u_int i, j; |
| 2011 | |
| 2012 | KASSERT(c % sizeof(*buf) == 0, ("%u not multiple of u_long", c)); |
| 2013 | |
| 2014 | buf = v; |
| 2015 | for (i = c; i > 0; i -= sizeof(*buf)) { |
| 2016 | for (j = 0; j < MAX_TRNG_RETRIES; j++) { |
| 2017 | *buf = ccp_read_4(g_ccp_softc, TRNG_OUT_OFFSET); |
| 2018 | if (*buf != 0) |
| 2019 | break; |
| 2020 | } |
| 2021 | if (j == MAX_TRNG_RETRIES) |
| 2022 | return (0); |
| 2023 | buf++; |
| 2024 | } |
| 2025 | return (c); |
| 2026 | |
| 2027 | } |
| 2028 | |
| 2029 | #ifdef DDB |
| 2030 | void |
nothing calls this directly
no test coverage detected