Re: acpidmar(4): Move debug printf to show the actual mapping

Mark Kettenis <[email protected]> Wed, 29 Jul 2026 23:15:14 +0200
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
> Date: Tue, 28 Jul 2026 16:04:39 +0200
> From: hshoexer <[email protected]>
> 
> Hi,
> 
> trivial tweak to debug print the single mappings.  Note, this
> requires to adjust debugme() to actually print something.
> 
> ok?

I think I had something similar in my tree at some point.  So ok
kettenis@.  Although I question the usefulness of most of the debug
code in acpidmar(4).  I'd like to see most of it removed eventually.

> 
> ------------------------------------------------------------------------
> diff --git a/sys/dev/acpi/acpidmar.c b/sys/dev/acpi/acpidmar.c
> index cf18265fd09..b680b858411 100644
> --- a/sys/dev/acpi/acpidmar.c
> +++ b/sys/dev/acpi/acpidmar.c
> @@ -857,16 +857,16 @@ domain_load_map(struct domain *dom, bus_dmamap_t map, int flags, int pteflag,
>  			if (error)
>  				goto fail;
>  
> +			if (debugme(dom)) {
> +				printf("  LOADMAP: %.16llx %x => %.16llx\n",
> +				    (uint64_t)seg->ds_addr,
> +				    (uint32_t)seg->ds_len, (uint64_t)res);
> +			}
> +
>  			/* Reassign DMA address */
>  			seg->ds_addr = res | (seg->ds_addr & VTD_PAGE_MASK);
>  		}
>  
> -		if (debugme(dom)) {
> -			printf("  LOADMAP: %.16llx %x => %.16llx\n",
> -			    (uint64_t)seg->ds_addr, (uint32_t)seg->ds_len,
> -			    (uint64_t)res);
> -		}
> -
>  		mapped_nsegs = i + 1;
>  
>  		for (idx = 0; idx < alen; idx += VTD_PAGE_SIZE) {
> 
>