Factor out the duplicated macro for the device type used in the

OFW device tree for PCI bridges and add a new one for PCI Express.
While at it, take advantage of the former for the rman(9) work-
around in jbusppm(4).
This commit is contained in:
Marius Strobl 2009-09-13 14:47:31 +00:00
parent e89666a9ed
commit 7b8253c3eb
4 changed files with 11 additions and 7 deletions

View File

@ -44,6 +44,10 @@ typedef uint32_t ofw_pci_intr_t;
#define OFW_PCI_CS_MEM32 0x02
#define OFW_PCI_CS_MEM64 0x03
/* OFW device types */
#define OFW_TYPE_PCI "pci"
#define OFW_TYPE_PCIE "pciex"
struct ofw_pci_ranges {
uint32_t cspace;
uint32_t child_hi;

View File

@ -224,8 +224,6 @@ struct psycho_dma_sync {
* providing two PCI buses.
*/
#define OFW_PCI_TYPE "pci"
struct psycho_desc {
const char *pd_string;
int pd_mode;
@ -275,7 +273,7 @@ psycho_probe(device_t dev)
const char *dtype;
dtype = ofw_bus_get_type(dev);
if (dtype != NULL && strcmp(dtype, OFW_PCI_TYPE) == 0 &&
if (dtype != NULL && strcmp(dtype, OFW_TYPE_PCI) == 0 &&
psycho_get_desc(dev) != NULL) {
device_set_desc(dev, "U2P UPA-PCI bridge");
return (0);

View File

@ -209,8 +209,6 @@ struct schizo_dma_sync {
#define SCHIZO_ICON_WRITE_8(sc, offs, v) \
SCHIZO_SPC_WRITE_8(STX_ICON, (sc), (offs), (v))
#define OFW_PCI_TYPE "pci"
struct schizo_desc {
const char *sd_string;
int sd_mode;
@ -244,7 +242,7 @@ schizo_probe(device_t dev)
const char *dtype;
dtype = ofw_bus_get_type(dev);
if (dtype != NULL && strcmp(dtype, OFW_PCI_TYPE) == 0 &&
if (dtype != NULL && strcmp(dtype, OFW_TYPE_PCI) == 0 &&
schizo_get_desc(dev) != NULL) {
device_set_desc(dev, "Sun Host-PCI bridge");
return (0);

View File

@ -40,6 +40,10 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/resource.h>
#if 1
#include <sparc64/pci/ofw_pci.h>
#endif
#define JBUSPPM_NREG 2
#define JBUSPPM_DEVID 0
@ -150,7 +154,7 @@ jbusppm_attach(device_t dev)
for (j = 0; j < nchildren; j++) {
if (ofw_bus_get_type(children[j]) != NULL &&
strcmp(ofw_bus_get_type(children[j]),
"pci") == 0 &&
OFW_TYPE_PCI) == 0 &&
ofw_bus_get_compat(children[j]) != NULL &&
strcmp(ofw_bus_get_compat(children[j]),
"pci108e,a801") == 0 &&