1*ce099b40Smartin /* $NetBSD: ofw_pci.h,v 1.7 2008/04/28 20:23:54 martin Exp $ */ 29382ef37Sthorpej 39382ef37Sthorpej /*- 49382ef37Sthorpej * Copyright (c) 1999 The NetBSD Foundation, Inc. 59382ef37Sthorpej * All rights reserved. 69382ef37Sthorpej * 79382ef37Sthorpej * This code is derived from software contributed to The NetBSD Foundation 89382ef37Sthorpej * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 99382ef37Sthorpej * NASA Ames Research Center. 109382ef37Sthorpej * 119382ef37Sthorpej * Redistribution and use in source and binary forms, with or without 129382ef37Sthorpej * modification, are permitted provided that the following conditions 139382ef37Sthorpej * are met: 149382ef37Sthorpej * 1. Redistributions of source code must retain the above copyright 159382ef37Sthorpej * notice, this list of conditions and the following disclaimer. 169382ef37Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 179382ef37Sthorpej * notice, this list of conditions and the following disclaimer in the 189382ef37Sthorpej * documentation and/or other materials provided with the distribution. 199382ef37Sthorpej * 209382ef37Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 219382ef37Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 229382ef37Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 239382ef37Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 249382ef37Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 259382ef37Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 269382ef37Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 279382ef37Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 289382ef37Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 299382ef37Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 309382ef37Sthorpej * POSSIBILITY OF SUCH DAMAGE. 319382ef37Sthorpej */ 329382ef37Sthorpej 339382ef37Sthorpej #ifndef _DEV_OFW_OFW_PCI_H_ 349382ef37Sthorpej #define _DEV_OFW_OFW_PCI_H_ 359382ef37Sthorpej 369382ef37Sthorpej /* 379382ef37Sthorpej * PCI Bus Binding to: 389382ef37Sthorpej * 399382ef37Sthorpej * IEEE Std 1275-1994 409382ef37Sthorpej * Standard for Boot (Initialization Configuration) Firmware 419382ef37Sthorpej * 429382ef37Sthorpej * Revision 2.1 439382ef37Sthorpej */ 449382ef37Sthorpej 459382ef37Sthorpej /* 469382ef37Sthorpej * Section 2.2.1. Physical Address Formats 479382ef37Sthorpej * 489382ef37Sthorpej * A PCI physical address is represented by 3 address cells: 499382ef37Sthorpej * 509382ef37Sthorpej * phys.hi cell: npt000ss bbbbbbbb dddddfff rrrrrrrr 519382ef37Sthorpej * phys.mid cell: hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh 529382ef37Sthorpej * phys.lo cell: llllllll llllllll llllllll llllllll 539382ef37Sthorpej * 549382ef37Sthorpej * n nonrelocatable 55e959b27dSmjl * p prefetchable 569382ef37Sthorpej * t aliased below 1MB (memory) or 64k (i/o) 579382ef37Sthorpej * ss space code 589382ef37Sthorpej * b bus number 599382ef37Sthorpej * d device number 609382ef37Sthorpej * f function number 619382ef37Sthorpej * r register number 629382ef37Sthorpej * h high 32-bits of PCI address 639382ef37Sthorpej * l low 32-bits of PCI address 649382ef37Sthorpej */ 659382ef37Sthorpej 669382ef37Sthorpej #define OFW_PCI_PHYS_HI_NONRELOCATABLE 0x80000000 679382ef37Sthorpej #define OFW_PCI_PHYS_HI_PREFETCHABLE 0x40000000 689382ef37Sthorpej #define OFW_PCI_PHYS_HI_ALIASED 0x20000000 699382ef37Sthorpej #define OFW_PCI_PHYS_HI_SPACEMASK 0x03000000 709382ef37Sthorpej #define OFW_PCI_PHYS_HI_BUSMASK 0x00ff0000 719382ef37Sthorpej #define OFW_PCI_PHYS_HI_BUSSHIFT 16 72dc8d07a0Stsubai #define OFW_PCI_PHYS_HI_DEVICEMASK 0x0000f800 739382ef37Sthorpej #define OFW_PCI_PHYS_HI_DEVICESHIFT 11 749382ef37Sthorpej #define OFW_PCI_PHYS_HI_FUNCTIONMASK 0x00000700 759382ef37Sthorpej #define OFW_PCI_PHYS_HI_FUNCTIONSHIFT 8 769382ef37Sthorpej #define OFW_PCI_PHYS_HI_REGISTERMASK 0x000000ff 779382ef37Sthorpej 789382ef37Sthorpej #define OFW_PCI_PHYS_HI_SPACE_CONFIG 0x00000000 799382ef37Sthorpej #define OFW_PCI_PHYS_HI_SPACE_IO 0x01000000 809382ef37Sthorpej #define OFW_PCI_PHYS_HI_SPACE_MEM32 0x02000000 819382ef37Sthorpej #define OFW_PCI_PHYS_HI_SPACE_MEM64 0x03000000 829382ef37Sthorpej 83eb77d484Smrg #define OFW_PCI_PHYS_HI_BUS(hi) \ 84eb77d484Smrg (((hi) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT) 852f85e9e1Smrg #define OFW_PCI_PHYS_HI_DEVICE(hi) \ 862f85e9e1Smrg (((hi) & OFW_PCI_PHYS_HI_DEVICEMASK) >> OFW_PCI_PHYS_HI_DEVICESHIFT) 872f85e9e1Smrg #define OFW_PCI_PHYS_HI_FUNCTION(hi) \ 882f85e9e1Smrg (((hi) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT) 892f85e9e1Smrg 902f85e9e1Smrg /* 912f85e9e1Smrg * This has the 3 32bit cell values, plus 2 more to make up a 64-bit size. 922f85e9e1Smrg */ 932f85e9e1Smrg struct ofw_pci_register { 942f85e9e1Smrg u_int32_t phys_hi; 952f85e9e1Smrg u_int32_t phys_mid; 962f85e9e1Smrg u_int32_t phys_lo; 972f85e9e1Smrg u_int32_t size_hi; 982f85e9e1Smrg u_int32_t size_lo; 992f85e9e1Smrg }; 1002f85e9e1Smrg 1019382ef37Sthorpej #endif /* _DEV_OFW_OFW_PCI_H_ */ 102