drivers/acpi/acpica/utbuffer.c

Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/utbuffer.c

File Facts

System
Linux kernel
Corpus path
drivers/acpi/acpica/utbuffer.c
Extension
.c
Size
7252 bytes
Lines
308
Domain
Driver Families
Bucket
drivers/acpi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!display_data_only) {
			acpi_os_printf("%8.4X: ", (base_offset + i));
		}

		/* Print 16 hex chars */

		for (j = 0; j < 16;) {
			if (i + j >= count) {

				/* Dump fill spaces */

				acpi_os_printf("%*s", ((display * 2) + 1), " ");
				j += display;
				continue;
			}

			switch (display) {
			case DB_BYTE_DISPLAY:
			default:	/* Default is BYTE display */

				acpi_os_printf("%02X ",
					       buffer[(acpi_size)i + j]);
				break;

			case DB_WORD_DISPLAY:

				ACPI_MOVE_16_TO_32(&temp32,
						   &buffer[(acpi_size)i + j]);
				acpi_os_printf("%04X ", temp32);
				break;

			case DB_DWORD_DISPLAY:

				ACPI_MOVE_32_TO_32(&temp32,
						   &buffer[(acpi_size)i + j]);
				acpi_os_printf("%08X ", temp32);
				break;

			case DB_QWORD_DISPLAY:

				ACPI_MOVE_32_TO_32(&temp32,
						   &buffer[(acpi_size)i + j]);
				acpi_os_printf("%08X", temp32);

				ACPI_MOVE_32_TO_32(&temp32,
						   &buffer[(acpi_size)i + j +
							   4]);
				acpi_os_printf("%08X ", temp32);
				break;
			}

			j += display;
		}

		/*
		 * Print the ASCII equivalent characters but watch out for the bad
		 * unprintable ones (printable chars are 0x20 through 0x7E)
		 */
		if (!display_data_only) {
			acpi_os_printf(" ");
			for (j = 0; j < 16; j++) {
				if (i + j >= count) {
					acpi_os_printf("\n");
					return;
				}

				/*
				 * Add comment characters so rest of line is ignored when
				 * compiled
				 */
				if (j == 0) {
					acpi_os_printf("// ");
				}

				buf_char = buffer[(acpi_size)i + j];
				if (isprint(buf_char)) {
					acpi_os_printf("%c", buf_char);
				} else {
					acpi_os_printf(".");
				}
			}

			/* Done with that line. */

			acpi_os_printf("\n");
		}
		i += 16;
	}

	return;

Annotation

Implementation Notes