1/* $NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca> 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 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29/* 30 * This is a driver for the Processor Container Device. The device acts 31 * like a bus in the node namespace. Child nodes can be either processor 32 * devices or other processor containers. 33 */ 34 35#include <sys/cdefs.h> 36__KERNEL_RCSID(0, "$NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $"); 37 38#include <sys/param.h> 39#include <sys/bus.h> 40#include <sys/cpu.h> 41#include <sys/device.h> 42 43#include <dev/acpi/acpireg.h> 44#include <dev/acpi/acpivar.h> 45 46static const struct device_compatible_entry compat_data[] = { 47 { .compat = "ACPI0010" }, /* Processor Container Device */ 48 DEVICE_COMPAT_EOL 49}; 50 51static int acpi_pcd_match(device_t, cfdata_t, void *); 52static void acpi_pcd_attach(device_t, device_t, void *); 53 54CFATTACH_DECL_NEW(acpipcd, 0, acpi_pcd_match, acpi_pcd_attach, NULL, NULL); 55 56static int 57acpi_pcd_match(device_t parent, cfdata_t cf, void *aux) 58{ 59 struct acpi_attach_args *aa = aux; 60 61 return acpi_compatible_match(aa, compat_data); 62} 63 64static void 65acpi_pcd_attach(device_t parent, device_t self, void *aux) 66{ 67 struct acpi_attach_args * const aa = aux; 68 69 aprint_naive("\n"); 70 aprint_normal(": Processor Container Device\n"); 71 72 /* 73 * Initialize the container device. ACPICA should have done this 74 * for us, but may have done so before a node that this one depends 75 * on had been initialized. 76 */ 77 AcpiEvaluateObject(aa->aa_node->ad_handle, "_INI", NULL, NULL); 78} 79