ofw_pci.h revision 141752
186557Stmm/*- 286557Stmm * Copyright (c) 1999 The NetBSD Foundation, Inc. 386557Stmm * All rights reserved. 486557Stmm * 586557Stmm * This code is derived from software contributed to The NetBSD Foundation 686557Stmm * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 786557Stmm * NASA Ames Research Center. 886557Stmm * 986557Stmm * Redistribution and use in source and binary forms, with or without 1086557Stmm * modification, are permitted provided that the following conditions 1186557Stmm * are met: 1286557Stmm * 1. Redistributions of source code must retain the above copyright 1386557Stmm * notice, this list of conditions and the following disclaimer. 1486557Stmm * 2. Redistributions in binary form must reproduce the above copyright 1586557Stmm * notice, this list of conditions and the following disclaimer in the 1686557Stmm * documentation and/or other materials provided with the distribution. 1786557Stmm * 3. All advertising materials mentioning features or use of this software 1886557Stmm * must display the following acknowledgement: 1986557Stmm * This product includes software developed by the NetBSD 2086557Stmm * Foundation, Inc. and its contributors. 2186557Stmm * 4. Neither the name of The NetBSD Foundation nor the names of its 2286557Stmm * contributors may be used to endorse or promote products derived 2386557Stmm * from this software without specific prior written permission. 2486557Stmm * 2586557Stmm * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2686557Stmm * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2786557Stmm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2886557Stmm * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2986557Stmm * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3086557Stmm * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3186557Stmm * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3286557Stmm * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3386557Stmm * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3486557Stmm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3586557Stmm * POSSIBILITY OF SUCH DAMAGE. 3686557Stmm * 37141752Smarius * from: NetBSD: ofw_pci.h,v 1.5 2003/10/22 09:04:39 mjl Exp 3886557Stmm * 3986557Stmm * $FreeBSD: head/sys/dev/ofw/ofw_pci.h 141752 2005-02-12 19:12:17Z marius $ 4086557Stmm */ 4186557Stmm 4286557Stmm#ifndef _DEV_OFW_OFW_PCI_H_ 4386557Stmm#define _DEV_OFW_OFW_PCI_H_ 4486557Stmm 4586557Stmm/* 4686557Stmm * PCI Bus Binding to: 4786557Stmm * 4886557Stmm * IEEE Std 1275-1994 4986557Stmm * Standard for Boot (Initialization Configuration) Firmware 5086557Stmm * 5186557Stmm * Revision 2.1 5286557Stmm */ 5386557Stmm 5486557Stmm/* 5586557Stmm * Section 2.2.1. Physical Address Formats 5686557Stmm * 5786557Stmm * A PCI physical address is represented by 3 address cells: 5886557Stmm * 5986557Stmm * phys.hi cell: npt000ss bbbbbbbb dddddfff rrrrrrrr 6086557Stmm * phys.mid cell: hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh 6186557Stmm * phys.lo cell: llllllll llllllll llllllll llllllll 6286557Stmm * 6386557Stmm * n nonrelocatable 64141752Smarius * p prefetchable 6586557Stmm * t aliased below 1MB (memory) or 64k (i/o) 6686557Stmm * ss space code 6786557Stmm * b bus number 6886557Stmm * d device number 6986557Stmm * f function number 7086557Stmm * r register number 7186557Stmm * h high 32-bits of PCI address 7286557Stmm * l low 32-bits of PCI address 7386557Stmm */ 7486557Stmm 7586557Stmm#define OFW_PCI_PHYS_HI_NONRELOCATABLE 0x80000000 7686557Stmm#define OFW_PCI_PHYS_HI_PREFETCHABLE 0x40000000 7786557Stmm#define OFW_PCI_PHYS_HI_ALIASED 0x20000000 7886557Stmm#define OFW_PCI_PHYS_HI_SPACEMASK 0x03000000 7986557Stmm#define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 8086557Stmm#define OFW_PCI_PHYS_HI_BUSSHIFT 16 8186557Stmm#define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 8286557Stmm#define OFW_PCI_PHYS_HI_DEVICESHIFT 11 8386557Stmm#define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 8486557Stmm#define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 8586557Stmm#define OFW_PCI_PHYS_HI_REGISTERMASK 0x000000ff 8686557Stmm 8786557Stmm#define OFW_PCI_PHYS_HI_SPACE_CONFIG 0x00000000 8886557Stmm#define OFW_PCI_PHYS_HI_SPACE_IO 0x01000000 8986557Stmm#define OFW_PCI_PHYS_HI_SPACE_MEM32 0x02000000 9086557Stmm#define OFW_PCI_PHYS_HI_SPACE_MEM64 0x03000000 9186557Stmm 9286557Stmm#define OFW_PCI_PHYS_HI_BUS(hi) \ 9386557Stmm (((hi) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) 9486557Stmm#define OFW_PCI_PHYS_HI_DEVICE(hi) \ 9586557Stmm (((hi) & OFW_PCI_PHYS_HI_DEVICEMASK) >> OFW_PCI_PHYS_HI_DEVICESHIFT) 9686557Stmm#define OFW_PCI_PHYS_HI_FUNCTION(hi) \ 9786557Stmm (((hi) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT) 9886557Stmm 9986557Stmm/* 10086557Stmm * This has the 3 32bit cell values, plus 2 more to make up a 64-bit size. 10186557Stmm */ 10286557Stmmstruct ofw_pci_register { 10386557Stmm u_int32_t phys_hi; 10486557Stmm u_int32_t phys_mid; 10586557Stmm u_int32_t phys_lo; 10686557Stmm u_int32_t size_hi; 10786557Stmm u_int32_t size_lo; 10886557Stmm}; 10986557Stmm 11086557Stmm#endif /* _DEV_OFW_OFW_PCI_H_ */ 111