11.2Sthorpej/* $NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $ */ 21.1Sjmcneill 31.1Sjmcneill/*- 41.1Sjmcneill * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca> 51.1Sjmcneill * All rights reserved. 61.1Sjmcneill * 71.1Sjmcneill * Redistribution and use in source and binary forms, with or without 81.1Sjmcneill * modification, are permitted provided that the following conditions 91.1Sjmcneill * are met: 101.1Sjmcneill * 1. Redistributions of source code must retain the above copyright 111.1Sjmcneill * notice, this list of conditions and the following disclaimer. 121.1Sjmcneill * 2. Redistributions in binary form must reproduce the above copyright 131.1Sjmcneill * notice, this list of conditions and the following disclaimer in the 141.1Sjmcneill * documentation and/or other materials provided with the distribution. 151.1Sjmcneill * 161.1Sjmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.1Sjmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.1Sjmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.1Sjmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.1Sjmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.1Sjmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.1Sjmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.1Sjmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.1Sjmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.1Sjmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.1Sjmcneill * POSSIBILITY OF SUCH DAMAGE. 271.1Sjmcneill */ 281.1Sjmcneill 291.1Sjmcneill/* 301.1Sjmcneill * This is a driver for the Processor Container Device. The device acts 311.1Sjmcneill * like a bus in the node namespace. Child nodes can be either processor 321.1Sjmcneill * devices or other processor containers. 331.1Sjmcneill */ 341.1Sjmcneill 351.1Sjmcneill#include <sys/cdefs.h> 361.2Sthorpej__KERNEL_RCSID(0, "$NetBSD: acpi_pcd.c,v 1.2 2021/01/29 15:49:55 thorpej Exp $"); 371.1Sjmcneill 381.1Sjmcneill#include <sys/param.h> 391.1Sjmcneill#include <sys/bus.h> 401.1Sjmcneill#include <sys/cpu.h> 411.1Sjmcneill#include <sys/device.h> 421.1Sjmcneill 431.1Sjmcneill#include <dev/acpi/acpireg.h> 441.1Sjmcneill#include <dev/acpi/acpivar.h> 451.1Sjmcneill 461.2Sthorpejstatic const struct device_compatible_entry compat_data[] = { 471.2Sthorpej { .compat = "ACPI0010" }, /* Processor Container Device */ 481.2Sthorpej DEVICE_COMPAT_EOL 491.1Sjmcneill}; 501.1Sjmcneill 511.1Sjmcneillstatic int acpi_pcd_match(device_t, cfdata_t, void *); 521.1Sjmcneillstatic void acpi_pcd_attach(device_t, device_t, void *); 531.1Sjmcneill 541.1SjmcneillCFATTACH_DECL_NEW(acpipcd, 0, acpi_pcd_match, acpi_pcd_attach, NULL, NULL); 551.1Sjmcneill 561.1Sjmcneillstatic int 571.1Sjmcneillacpi_pcd_match(device_t parent, cfdata_t cf, void *aux) 581.1Sjmcneill{ 591.1Sjmcneill struct acpi_attach_args *aa = aux; 601.1Sjmcneill 611.2Sthorpej return acpi_compatible_match(aa, compat_data); 621.1Sjmcneill} 631.1Sjmcneill 641.1Sjmcneillstatic void 651.1Sjmcneillacpi_pcd_attach(device_t parent, device_t self, void *aux) 661.1Sjmcneill{ 671.1Sjmcneill struct acpi_attach_args * const aa = aux; 681.1Sjmcneill 691.1Sjmcneill aprint_naive("\n"); 701.1Sjmcneill aprint_normal(": Processor Container Device\n"); 711.1Sjmcneill 721.1Sjmcneill /* 731.1Sjmcneill * Initialize the container device. ACPICA should have done this 741.1Sjmcneill * for us, but may have done so before a node that this one depends 751.1Sjmcneill * on had been initialized. 761.1Sjmcneill */ 771.1Sjmcneill AcpiEvaluateObject(aa->aa_node->ad_handle, "_INI", NULL, NULL); 781.1Sjmcneill} 79