/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2009, Intel Corporation.
* All rights reserved.
*/
#ifndef _SYS_ACPIDEV_RSC_H
#define _SYS_ACPIDEV_RSC_H
#ifdef __cplusplus
extern "C" {
#endif
/* ACPI bus range structure. */
typedef struct acpidev_bus_range {
/*
* This structure is modeled after the 1275 "reg" property and
* "assigned-addresses" property for PCI device nodes.
* There's no standard definition available for ACPI devices.
* This structure is used to store resources returned by the ACPI
* _CRS method.
*
* The physical address format is:
* Bit#: 33222222 22221111 11111100 00000000
* 10987654 32109876 54321098 76543210
* phys_hi cell: xxxxxxxx xxxxxxxx xxxxxxxx TSxxxTTT
* phys_hi(memory): xxxxxxxx xxxxxxxx wxxxxxcc --xxx000
* phys_hi(io): xxxxxxxx xxxxxxxx sdxxxxaa --xxx001
* phys_mid cell: hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh
* phys_low cell: llllllll llllllll llllllll llllllll
*
* TTT is type of resource. Such as MEMORY, IO etc.
* S is 1 if address range is subtractive decoding
* T is 1 if resource type is different on primary and
* secondary bus
* cc is memory coherence type
* w is 1 if memory is writable
* aa ranges of decoded ports, ISA only, non-ISA only or full.
* d is 1 if IO port decode 16 bit address, otherwise 10 bits.
* s is 1 if translation is sparse.
* hh...hhh is the 32-bit unsigned number
* ll...lll is the 32-bit unsigned number
*
* The physical size format is:
*
* size_hi cell: hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh
* size_low cell: llllllll llllllll llllllll llllllll
*
* hh...hhh is the 32-bit unsigned number
* ll...lll is the 32-bit unsigned number
*/
typedef struct acpidev_phys_spec {
typedef struct acpidev_ranges {
#ifdef _KERNEL
/* Maximum possible number of IRQs. */
/* Maximum possible number of DMAs. */
/* Forward declaration */
/*
* Resource handler relative interfaces.
* Return values of acpidev_resource_get_xxx interfaces:
* AE_OK: succeed with resources stored in buffer and count updated.
* AE_LIMIT: buffer is too small, count updated to number of resources.
* AE_BAD_PARAMETER: invalid parameter
*/
int dma);
int irq);
/*
* Walk resources returned by 'method' and store parsed resources into rhdlp.
* Caller needs to release rhdlp after using it.
* Return AE_OK on success with resource handle stored in 'rhdlp'.
*/
/*
* Walk resources returned by the ACPI _CRS method and create device properties.
* Create 'reg', 'assigned-addresses', 'dma-channels' and 'interrupts'
* properties for resource consumer.
* Create 'ranges' and 'bus-range' properties for resource producer.
*/
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ACPIDEV_RSC_H */