1*5103e761SPatrick Mooney /* 2*5103e761SPatrick Mooney * This file and its contents are supplied under the terms of the 3*5103e761SPatrick Mooney * Common Development and Distribution License ("CDDL"), version 1.0. 4*5103e761SPatrick Mooney * You may only use this file in accordance with the terms of version 5*5103e761SPatrick Mooney * 1.0 of the CDDL. 6*5103e761SPatrick Mooney * 7*5103e761SPatrick Mooney * A full copy of the text of the CDDL should have accompanied this 8*5103e761SPatrick Mooney * source. A copy of the CDDL is also available via the Internet at 9*5103e761SPatrick Mooney * http://www.illumos.org/license/CDDL. 10*5103e761SPatrick Mooney */ 11*5103e761SPatrick Mooney 12*5103e761SPatrick Mooney /* 13*5103e761SPatrick Mooney * Copyright 2022 Oxide Computer Company 14*5103e761SPatrick Mooney */ 15*5103e761SPatrick Mooney 16*5103e761SPatrick Mooney #include "payload_common.h" 17*5103e761SPatrick Mooney #include "payload_utils.h" 18*5103e761SPatrick Mooney #include "test_defs.h" 19*5103e761SPatrick Mooney 20*5103e761SPatrick Mooney void start(void)21*5103e761SPatrick Mooneystart(void) 22*5103e761SPatrick Mooney { 23*5103e761SPatrick Mooney /* loop for as long as the host wants */ 24*5103e761SPatrick Mooney for (;;) { 25*5103e761SPatrick Mooney uint32_t start, end; 26*5103e761SPatrick Mooney 27*5103e761SPatrick Mooney start = inl(IOP_PMTMR); 28*5103e761SPatrick Mooney outl(IOP_TEST_VALUE, start); 29*5103e761SPatrick Mooney 30*5103e761SPatrick Mooney do { 31*5103e761SPatrick Mooney end = inl(IOP_PMTMR); 32*5103e761SPatrick Mooney /* wait for enough ticks to pass */ 33*5103e761SPatrick Mooney } while (end < (start + PMTMR_TARGET_TICKS)); 34*5103e761SPatrick Mooney outl(IOP_TEST_VALUE, end); 35*5103e761SPatrick Mooney } 36*5103e761SPatrick Mooney } 37