re-add local ebusvar.h, and use it to share between ebus.c and ebus_mainbus.c
This commit is contained in:
parent
30b9b129ac
commit
4d4222abed
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ebus.c,v 1.55 2011/03/11 18:55:26 nakayama Exp $ */
|
||||
/* $NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000, 2001 Matthew R. Green
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.55 2011/03/11 18:55:26 nakayama Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.56 2011/03/18 09:52:54 mrg Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -46,7 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.55 2011/03/11 18:55:26 nakayama Exp $");
|
||||
#define EDB_CHILD 0x02
|
||||
#define EDB_INTRMAP 0x04
|
||||
#define EDB_BUSMAP 0x08
|
||||
int ebus_debug = 0;
|
||||
#define EDB_BUSDMA 0x10
|
||||
#define EDB_INTR 0x20
|
||||
int ebus_debug = 0x0;
|
||||
#define DPRINTF(l, s) do { if (ebus_debug & l) printf s; } while (0)
|
||||
#else
|
||||
#define DPRINTF(l, s)
|
||||
@ -72,24 +74,7 @@ int ebus_debug = 0;
|
||||
|
||||
#include <dev/ebus/ebusreg.h>
|
||||
#include <dev/ebus/ebusvar.h>
|
||||
|
||||
struct ebus_softc {
|
||||
struct device sc_dev;
|
||||
|
||||
int sc_node;
|
||||
|
||||
bus_space_tag_t sc_memtag; /* from pci */
|
||||
bus_space_tag_t sc_iotag; /* from pci */
|
||||
bus_space_tag_t sc_childbustag; /* pass to children */
|
||||
bus_dma_tag_t sc_dmatag;
|
||||
|
||||
struct ebus_ranges *sc_range;
|
||||
struct ebus_interrupt_map *sc_intmap;
|
||||
struct ebus_interrupt_map_mask sc_intmapmask;
|
||||
|
||||
int sc_nrange; /* counters */
|
||||
int sc_nintmap;
|
||||
};
|
||||
#include <sparc64/dev/ebusvar.h>
|
||||
|
||||
int ebus_match(struct device *, struct cfdata *, void *);
|
||||
void ebus_attach(struct device *, struct device *, void *);
|
||||
@ -97,18 +82,9 @@ void ebus_attach(struct device *, struct device *, void *);
|
||||
CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
|
||||
ebus_match, ebus_attach, NULL, NULL);
|
||||
|
||||
bus_space_tag_t ebus_alloc_bus_tag(struct ebus_softc *, int);
|
||||
|
||||
int ebus_setup_attach_args(struct ebus_softc *, int,
|
||||
struct ebus_attach_args *);
|
||||
void ebus_destroy_attach_args(struct ebus_attach_args *);
|
||||
int ebus_print(void *, const char *);
|
||||
void ebus_find_ino(struct ebus_softc *, struct ebus_attach_args *);
|
||||
|
||||
/*
|
||||
* here are our bus space and bus DMA routines.
|
||||
*/
|
||||
static paddr_t ebus_bus_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
|
||||
static int _ebus_bus_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, vaddr_t,
|
||||
bus_space_handle_t *);
|
||||
static void *ebus_intr_establish(bus_space_tag_t, int, int, int (*)(void *),
|
||||
@ -455,7 +431,7 @@ _ebus_bus_map(bus_space_tag_t t, bus_addr_t ba, bus_size_t size, int flags,
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
static paddr_t
|
||||
paddr_t
|
||||
ebus_bus_mmap(bus_space_tag_t t, bus_addr_t paddr, off_t off, int prot,
|
||||
int flags)
|
||||
{
|
||||
|
82
sys/arch/sparc64/dev/ebusvar.h
Normal file
82
sys/arch/sparc64/dev/ebusvar.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* $NetBSD: ebusvar.h,v 1.9 2011/03/18 09:52:54 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000, 2001 Matthew R. Green
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SPARC64_DEV_EBUSVAR_H_
|
||||
#define _SPARC64_DEV_EBUSVAR_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define _SPARC_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
|
||||
#include <dev/ebus/ebusreg.h>
|
||||
#include <dev/ebus/ebusvar.h>
|
||||
|
||||
struct ebus_softc {
|
||||
struct device sc_dev;
|
||||
|
||||
int sc_node;
|
||||
|
||||
bus_space_tag_t sc_memtag; /* from pci */
|
||||
bus_space_tag_t sc_iotag; /* from pci */
|
||||
bus_space_tag_t sc_childbustag; /* pass to children */
|
||||
bus_dma_tag_t sc_dmatag;
|
||||
|
||||
struct ebus_ranges *sc_range;
|
||||
struct ebus_interrupt_map *sc_intmap;
|
||||
struct ebus_interrupt_map_mask sc_intmapmask;
|
||||
|
||||
int sc_nrange; /* counters */
|
||||
int sc_nintmap;
|
||||
|
||||
int sc_ign;
|
||||
|
||||
bus_space_tag_t sc_bust;
|
||||
bus_addr_t sc_csr;
|
||||
bus_space_handle_t sc_csrh;
|
||||
};
|
||||
|
||||
int ebus_setup_attach_args(struct ebus_softc *, int,
|
||||
struct ebus_attach_args *);
|
||||
void ebus_destroy_attach_args(struct ebus_attach_args *);
|
||||
int ebus_print(void *, const char *);
|
||||
void ebus_find_ino(struct ebus_softc *, struct ebus_attach_args *);
|
||||
|
||||
paddr_t ebus_bus_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
|
||||
|
||||
bus_space_tag_t ebus_alloc_bus_tag(struct ebus_softc *, int);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user