1bc7b9300SIan Lepore /*- 2bc7b9300SIan Lepore * Copyright (c) 2015 Ian Lepore <ian@freebsd.org> 3bc7b9300SIan Lepore * All rights reserved. 4bc7b9300SIan Lepore * 5bc7b9300SIan Lepore * Redistribution and use in source and binary forms, with or without 6bc7b9300SIan Lepore * modification, are permitted provided that the following conditions 7bc7b9300SIan Lepore * are met: 8bc7b9300SIan Lepore * 1. Redistributions of source code must retain the above copyright 9bc7b9300SIan Lepore * notice, this list of conditions and the following disclaimer. 10bc7b9300SIan Lepore * 2. Redistributions in binary form must reproduce the above copyright 11bc7b9300SIan Lepore * notice, this list of conditions and the following disclaimer in the 12bc7b9300SIan Lepore * documentation and/or other materials provided with the distribution. 13bc7b9300SIan Lepore * 14bc7b9300SIan Lepore * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15bc7b9300SIan Lepore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16bc7b9300SIan Lepore * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17bc7b9300SIan Lepore * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18bc7b9300SIan Lepore * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19bc7b9300SIan Lepore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20bc7b9300SIan Lepore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21bc7b9300SIan Lepore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22bc7b9300SIan Lepore * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23bc7b9300SIan Lepore * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24bc7b9300SIan Lepore * SUCH DAMAGE. 25bc7b9300SIan Lepore */ 26bc7b9300SIan Lepore 27bc7b9300SIan Lepore #ifndef _DEV_OFW_OFW_SUBR_H_ 28bc7b9300SIan Lepore #define _DEV_OFW_OFW_SUBR_H_ 29bc7b9300SIan Lepore 30bc7b9300SIan Lepore /* 31bc7b9300SIan Lepore * Translate an address from the Nth tuple of a device node's reg properties to 32bc7b9300SIan Lepore * a physical memory address, by applying the range mappings from all ancestors. 33bc7b9300SIan Lepore * This assumes that all ancestor ranges are simple numerical offsets for which 34bc7b9300SIan Lepore * addition and subtraction operations will perform the required mapping (the 35bc7b9300SIan Lepore * bit-options in the high word of standard PCI properties are also handled). 36bc7b9300SIan Lepore * After the call, *pci_hi (if non-NULL) contains the phys.hi cell of the 37bc7b9300SIan Lepore * device's parent PCI bus, or OFW_PADDR_NOT_PCI if no PCI bus is involved. 38bc7b9300SIan Lepore * 39bc7b9300SIan Lepore * This is intended to be a helper function called by the platform-specific 40bc7b9300SIan Lepore * implementation of OF_decode_addr(), and not for direct use by device drivers. 41bc7b9300SIan Lepore */ 42bc7b9300SIan Lepore #define OFW_PADDR_NOT_PCI (~0) 43bc7b9300SIan Lepore 44bc7b9300SIan Lepore int ofw_reg_to_paddr(phandle_t _dev, int _regno, bus_addr_t *_paddr, 45bc7b9300SIan Lepore bus_size_t *_size, pcell_t *_pci_hi); 46bc7b9300SIan Lepore 47*9ed9b267SJustin Hibbits int ofw_parse_bootargs(void); 48*9ed9b267SJustin Hibbits 49bc7b9300SIan Lepore #endif 50