[BACK]Return to rbus_machdep.c CVS log [TXT][DIR] Up to [local] / sys / arch / amd64 / amd64

Annotation of sys/arch/amd64/amd64/rbus_machdep.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: rbus_machdep.c,v 1.3 2007/05/31 23:35:46 tedu Exp $ */
                      2: /*     $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $    */
                      3:
                      4: /*
                      5:  * Copyright (c) 1999
                      6:  *     HAYAKAWA Koichi.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by HAYAKAWA Koichi.
                     19:  * 4. The name of the author may not be used to endorse or promote products
                     20:  *    derived from this software without specific prior written permission.
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     31:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32:  */
                     33:
                     34: /*#include "pcibios.h"*/
                     35:
                     36: #include <sys/param.h>
                     37: #include <sys/systm.h>
                     38: #include <sys/extent.h>
                     39:
                     40: #include <uvm/uvm_extern.h>
                     41:
                     42: #include <sys/sysctl.h>
                     43:
                     44: #include <sys/device.h>
                     45:
                     46: #include <machine/bus.h>
                     47: #include <dev/cardbus/rbus.h>
                     48:
                     49: #include <dev/isa/isareg.h>
                     50: #include <dev/isa/isavar.h>
                     51:
                     52: #include <dev/pci/pcivar.h>
                     53:
                     54:
                     55: /**********************************************************************
                     56:  * rbus_tag_t rbus_fakeparent_mem(struct pci_attach_args *pa)
                     57:  *
                     58:  *   This function makes an rbus tag for memory space.  This rbus tag
                     59:  *   shares the all memory region of ex_iomem.
                     60:  **********************************************************************/
                     61: #define RBUS_MEM_START 0x40000000
                     62: #define RBUS_MEM_SIZE  0x00100000
                     63:
                     64: rbus_tag_t
                     65: rbus_pccbb_parent_mem(struct device *self, struct pci_attach_args *pa)
                     66: {
                     67:        bus_addr_t start, min_start;
                     68:        bus_size_t size;
                     69:        struct extent *ex;
                     70:
                     71:        size = RBUS_MEM_SIZE;
                     72:        start = min_start = max(RBUS_MEM_START, ctob(physmem));
                     73: #if NPCIBIOS > 0
                     74:        if ((ex = pciaddr_search(PCIADDR_SEARCH_MEM, &start, size)) == NULL)
                     75: #endif
                     76:        {
                     77:                extern struct extent *iomem_ex;
                     78:                ex = iomem_ex;
                     79:                start = ex->ex_start;
                     80:
                     81:                /* XXX: unfortunately, iomem_ex cannot be used for the
                     82:                 * dynamic bus_space allocatoin.  There are some
                     83:                 * hidden memory (or some obstacles which do not
                     84:                 * recognised by the kernel) in the region governed by
                     85:                 * iomem_ex.  So I decide to use only very high
                     86:                 * address region.
                     87:                 *
                     88:                 * if defined PCIBIOS_ADDR_FIXUP, PCI device using
                     89:                 * area which is not recognised by the kernel are
                     90:                 * already reserved.
                     91:                 */
                     92:
                     93:                if (start < min_start) {
                     94:                        start = min_start;
                     95:                }
                     96:
                     97:                size = ex->ex_end - start;
                     98:        }
                     99:
                    100:        return rbus_new_root_share(pa->pa_memt, ex, start, size, 0);
                    101: }
                    102:
                    103:
                    104: /**********************************************************************
                    105:  * rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *pa)
                    106:  **********************************************************************/
                    107: #define RBUS_IO_START  0xa000
                    108: #define RBUS_IO_SIZE   0x1000
                    109:
                    110: rbus_tag_t
                    111: rbus_pccbb_parent_io(struct device *self, struct pci_attach_args *pa)
                    112: {
                    113:        struct extent *ex;
                    114:        bus_addr_t start;
                    115:        bus_size_t size;
                    116:
                    117:        size =  RBUS_IO_SIZE;
                    118:        start = RBUS_IO_START;
                    119: #if NPCIBIOS > 0
                    120:        if ((ex = pciaddr_search(PCIADDR_SEARCH_IO, &start, size)) == NULL)
                    121: #endif
                    122:        {
                    123:                extern struct extent *ioport_ex;
                    124:                ex = ioport_ex;
                    125:        }
                    126:
                    127:        return rbus_new_root_share(pa->pa_iot, ex, start, size, 0);
                    128: }

CVSweb