amdvi_hw.c (7c8c0b8227679b4684566e408ccc96d6ef7175e9) amdvi_hw.c (4f3f3e9a1dee62c031fa67cfe64e11d6dd3fab1b)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2016, Anish Gupta (anish@freebsd.org)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 404 unchanged lines hidden (view full) ---

413#endif
414}
415#endif
416
417/* Invalidate domain using INVALIDATE_IOMMU_PAGES command. */
418static void
419amdvi_inv_domain(struct amdvi_softc *softc, uint16_t domain_id)
420{
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2016, Anish Gupta (anish@freebsd.org)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 404 unchanged lines hidden (view full) ---

413#endif
414}
415#endif
416
417/* Invalidate domain using INVALIDATE_IOMMU_PAGES command. */
418static void
419amdvi_inv_domain(struct amdvi_softc *softc, uint16_t domain_id)
420{
421 struct amdvi_cmd *cmd;
421 struct amdvi_cmd *cmd __diagused;
422
423 cmd = amdvi_get_cmd_tail(softc);
424 KASSERT(cmd != NULL, ("Cmd is NULL"));
425
426 /*
427 * See section 3.3.3 of IOMMU spec rev 2.0, software note
428 * for invalidating domain.
429 */

--- 4 unchanged lines hidden (view full) ---

434 device_printf(softc->dev, "Invalidate domain:0x%x\n", domain_id);
435
436#endif
437}
438
439static bool
440amdvi_cmp_wait(struct amdvi_softc *softc)
441{
422
423 cmd = amdvi_get_cmd_tail(softc);
424 KASSERT(cmd != NULL, ("Cmd is NULL"));
425
426 /*
427 * See section 3.3.3 of IOMMU spec rev 2.0, software note
428 * for invalidating domain.
429 */

--- 4 unchanged lines hidden (view full) ---

434 device_printf(softc->dev, "Invalidate domain:0x%x\n", domain_id);
435
436#endif
437}
438
439static bool
440amdvi_cmp_wait(struct amdvi_softc *softc)
441{
442 struct amdvi_ctrl *ctrl;
442#ifdef AMDVI_DEBUG_CMD
443 struct amdvi_ctrl *ctrl = softc->ctrl;
444#endif
443 const uint64_t VERIFY = 0xA5A5;
444 volatile uint64_t *read;
445 int i;
446 bool status;
447
445 const uint64_t VERIFY = 0xA5A5;
446 volatile uint64_t *read;
447 int i;
448 bool status;
449
448 ctrl = softc->ctrl;
449 read = &softc->cmp_data;
450 *read = 0;
451 amdvi_cmd_cmp(softc, VERIFY);
452 /* Wait for h/w to update completion data. */
453 for (i = 0; i < 100 && (*read != VERIFY); i++) {
454 DELAY(1000); /* 1 ms */
455 }
456 status = (VERIFY == softc->cmp_data) ? true : false;

--- 923 unchanged lines hidden ---
450 read = &softc->cmp_data;
451 *read = 0;
452 amdvi_cmd_cmp(softc, VERIFY);
453 /* Wait for h/w to update completion data. */
454 for (i = 0; i < 100 && (*read != VERIFY); i++) {
455 DELAY(1000); /* 1 ms */
456 }
457 status = (VERIFY == softc->cmp_data) ? true : false;

--- 923 unchanged lines hidden ---