summaryrefslogtreecommitdiff
path: root/sys/arch/sgi/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sgi/pci')
-rw-r--r--sys/arch/sgi/pci/ioc.c10
-rw-r--r--sys/arch/sgi/pci/iocvar.h26
-rw-r--r--sys/arch/sgi/pci/iof.c10
-rw-r--r--sys/arch/sgi/pci/iofvar.h22
-rw-r--r--sys/arch/sgi/pci/macepcibridge.c22
-rw-r--r--sys/arch/sgi/pci/pci_machdep.h11
6 files changed, 51 insertions, 50 deletions
diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c
index c19fc82b88e..e1f9a00707e 100644
--- a/sys/arch/sgi/pci/ioc.c
+++ b/sys/arch/sgi/pci/ioc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioc.c,v 1.33 2010/03/20 16:22:53 miod Exp $ */
+/* $OpenBSD: ioc.c,v 1.34 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -66,7 +66,6 @@ struct ioc_intr {
struct ioc_softc {
struct device sc_dev;
- int sc_npci;
struct mips_bus_space *sc_mem_bus_space;
@@ -74,6 +73,7 @@ struct ioc_softc {
bus_space_handle_t sc_memh;
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ pcitag_t sc_tag;
void *sc_ih_enet; /* Ethernet interrupt */
void *sc_ih_superio; /* SuperIO interrupt */
@@ -171,7 +171,7 @@ ioc_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc_pc = pa->pa_pc;
- sc->sc_npci = pa->pa_device;
+ sc->sc_tag = pa->pa_tag;
sc->sc_dmat = pa->pa_dmat;
/*
@@ -508,9 +508,7 @@ ioc_attach_child(struct ioc_softc *sc, const char *name, bus_addr_t base,
memset(&iaa, 0, sizeof iaa);
iaa.iaa_name = name;
- iaa.iaa_nasid = pci_get_nasid(sc->sc_pc);
- iaa.iaa_widget = pci_get_widget(sc->sc_pc);
- iaa.iaa_npci = sc->sc_npci;
+ pci_get_device_location(sc->sc_pc, sc->sc_tag, &iaa.iaa_location);
iaa.iaa_memt = sc->sc_memt;
iaa.iaa_memh = sc->sc_memh;
iaa.iaa_dmat = sc->sc_dmat;
diff --git a/sys/arch/sgi/pci/iocvar.h b/sys/arch/sgi/pci/iocvar.h
index 6071e2bd24f..12db7f144a6 100644
--- a/sys/arch/sgi/pci/iocvar.h
+++ b/sys/arch/sgi/pci/iocvar.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: iocvar.h,v 1.5 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iocvar.h,v 1.6 2010/04/06 19:12:34 miod Exp $ */
/*
- * Copyright (c) 2008 Miodrag Vallat.
+ * Copyright (c) 2008, 2010 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,23 +17,21 @@
*/
struct ioc_attach_args {
- const char *iaa_name;
+ const char *iaa_name;
- int16_t iaa_nasid;
- int iaa_widget;
- int iaa_npci;
+ bus_space_tag_t iaa_memt;
+ bus_space_handle_t iaa_memh;
+ bus_dma_tag_t iaa_dmat;
- bus_space_tag_t iaa_memt;
- bus_space_handle_t iaa_memh;
- bus_dma_tag_t iaa_dmat;
+ bus_addr_t iaa_base;
+ int iaa_dev;
- bus_addr_t iaa_base;
- int iaa_dev;
+ uint8_t iaa_enaddr[6];
- uint8_t iaa_enaddr[6];
+ int iaa_flags;
+#define IOC_FLAGS_OBIO 0x00000001
- int iaa_flags;
-#define IOC_FLAGS_OBIO 0x00000001
+ struct sgi_device_location iaa_location;
};
void *ioc_intr_establish(void *, u_long, int, int (*)(void *),
diff --git a/sys/arch/sgi/pci/iof.c b/sys/arch/sgi/pci/iof.c
index bf95cddb66d..ba03717eb02 100644
--- a/sys/arch/sgi/pci/iof.c
+++ b/sys/arch/sgi/pci/iof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iof.c,v 1.5 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iof.c,v 1.6 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -56,7 +56,6 @@ struct iof_intr {
struct iof_softc {
struct device sc_dev;
- int sc_npci;
struct mips_bus_space *sc_mem_bus_space;
@@ -64,6 +63,7 @@ struct iof_softc {
bus_space_handle_t sc_memh;
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ pcitag_t sc_tag;
uint32_t sc_mcr;
@@ -127,7 +127,7 @@ iof_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc_pc = pa->pa_pc;
- sc->sc_npci = pa->pa_device;
+ sc->sc_tag = pa->pa_tag;
sc->sc_dmat = pa->pa_dmat;
/*
@@ -212,9 +212,7 @@ iof_attach_child(struct device *iof, const char *name, bus_addr_t base,
struct iof_attach_args iaa;
iaa.iaa_name = name;
- iaa.iaa_nasid = pci_get_nasid(sc->sc_pc);
- iaa.iaa_widget = pci_get_widget(sc->sc_pc);
- iaa.iaa_npci = sc->sc_npci;
+ pci_get_device_location(sc->sc_pc, sc->sc_tag, &iaa.iaa_location);
iaa.iaa_memt = sc->sc_memt;
iaa.iaa_memh = sc->sc_memh;
iaa.iaa_dmat = sc->sc_dmat;
diff --git a/sys/arch/sgi/pci/iofvar.h b/sys/arch/sgi/pci/iofvar.h
index 97a3d00598f..a6dc905e05d 100644
--- a/sys/arch/sgi/pci/iofvar.h
+++ b/sys/arch/sgi/pci/iofvar.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: iofvar.h,v 1.3 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iofvar.h,v 1.4 2010/04/06 19:12:34 miod Exp $ */
/*
- * Copyright (c) 2009 Miodrag Vallat.
+ * Copyright (c) 2009, 2010 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,19 +17,17 @@
*/
struct iof_attach_args {
- const char *iaa_name;
+ const char *iaa_name;
- int16_t iaa_nasid;
- int iaa_widget;
- int iaa_npci;
+ bus_space_tag_t iaa_memt;
+ bus_space_handle_t iaa_memh;
+ bus_dma_tag_t iaa_dmat;
- bus_space_tag_t iaa_memt;
- bus_space_handle_t iaa_memh;
- bus_dma_tag_t iaa_dmat;
+ bus_addr_t iaa_base;
+ uint iaa_dev;
+ uint iaa_clock;
- bus_addr_t iaa_base;
- uint iaa_dev;
- uint iaa_clock;
+ struct sgi_device_location iaa_location;
};
void *iof_intr_establish(void *, uint, int, int (*)(void *), void *, char *);
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c
index db0a8f141a7..5feaa065973 100644
--- a/sys/arch/sgi/pci/macepcibridge.c
+++ b/sys/arch/sgi/pci/macepcibridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macepcibridge.c,v 1.37 2010/03/07 13:38:58 miod Exp $ */
+/* $OpenBSD: macepcibridge.c,v 1.38 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -84,8 +84,8 @@ pcitag_t mace_pcibr_make_tag(void *, int, int, int);
void mace_pcibr_decompose_tag(void *, pcitag_t, int *, int *, int *);
pcireg_t mace_pcibr_conf_read(void *, pcitag_t, int);
void mace_pcibr_conf_write(void *, pcitag_t, int, pcireg_t);
-int16_t mace_pcibr_get_nasid(void *);
int mace_pcibr_get_widget(void *);
+int mace_pcibr_get_dl(void *, pcitag_t, struct sgi_device_location *);
int mace_pcibr_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
const char *mace_pcibr_intr_string(void *, pci_intr_handle_t);
void *mace_pcibr_intr_establish(void *, pci_intr_handle_t, int,
@@ -239,8 +239,8 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux)
sc->sc_pc.pc_bus_maxdevs = mace_pcibr_bus_maxdevs;
sc->sc_pc.pc_conf_read = mace_pcibr_conf_read;
sc->sc_pc.pc_conf_write = mace_pcibr_conf_write;
- sc->sc_pc.pc_get_nasid = mace_pcibr_get_nasid;
sc->sc_pc.pc_get_widget = mace_pcibr_get_widget;
+ sc->sc_pc.pc_get_dl = mace_pcibr_get_dl;
sc->sc_pc.pc_intr_v = NULL;
sc->sc_pc.pc_intr_map = mace_pcibr_intr_map;
sc->sc_pc.pc_intr_string = mace_pcibr_intr_string;
@@ -418,16 +418,24 @@ mace_pcibr_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data)
splx(s);
}
-int16_t
-mace_pcibr_get_nasid(void *unused)
+int
+mace_pcibr_get_widget(void *unused)
{
return 0;
}
int
-mace_pcibr_get_widget(void *unused)
+mace_pcibr_get_dl(void *cpv, pcitag_t tag, struct sgi_device_location *sdl)
{
- return 0;
+ int bus, device, fn;
+
+ memset(sdl, 0, sizeof *sdl);
+ mace_pcibr_decompose_tag(cpv, tag, &bus, &device, &fn);
+ if (bus != 0)
+ return 0;
+ sdl->device = device;
+ sdl->fn = fn;
+ return 1;
}
int
diff --git a/sys/arch/sgi/pci/pci_machdep.h b/sys/arch/sgi/pci/pci_machdep.h
index 011b17385ec..2d7467b851e 100644
--- a/sys/arch/sgi/pci/pci_machdep.h
+++ b/sys/arch/sgi/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.9 2010/03/07 13:38:58 miod Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.10 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -30,6 +30,7 @@ typedef u_long pcitag_t;
typedef u_long pci_intr_handle_t;
struct pci_attach_args;
+struct sgi_device_location;
/*
* mips-specific PCI structure and type definitions.
@@ -45,8 +46,8 @@ struct mips_pci_chipset {
int *, int *);
pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
- int16_t (*pc_get_nasid)(void *);
int (*pc_get_widget)(void *);
+ int (*pc_get_dl)(void *, pcitag_t, struct sgi_device_location *);
void *pc_intr_v;
int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *);
@@ -78,11 +79,11 @@ struct mips_pci_chipset {
(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
#define pci_conf_write(c, t, r, v) \
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
-#define pci_get_nasid(c) \
- (*(c)->pc_get_nasid)((c)->pc_conf_v)
#define pci_get_widget(c) \
(*(c)->pc_get_widget)((c)->pc_conf_v)
-#define pci_intr_map(c, ihp) \
+#define pci_get_device_location(c,t,l) \
+ (*(c)->pc_get_dl)((c)->pc_conf_v, (t), (l))
+#define pci_intr_map(c, ihp) \
(*(c)->pa_pc->pc_intr_map)((c), (ihp))
#define pci_intr_string(c, ih) \
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))