require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_MACHINE_PCI_MACHDEP_H_)) {
    eval 'sub _MACHINE_PCI_MACHDEP_H_ () {1;}' unless defined(&_MACHINE_PCI_MACHDEP_H_);
    eval 'sub PCITAG_NODE {
        my($x) = @_;
	    eval q(((($x)>>32)&0xffffffff));
    }' unless defined(&PCITAG_NODE);
    eval 'sub PCITAG_OFFSET {
        my($x) = @_;
	    eval q((($x)&0xffffffff));
    }' unless defined(&PCITAG_OFFSET);
    eval 'sub PCITAG_BUS {
        my($t) = @_;
	    eval q((( &PCITAG_OFFSET($t)>>16)&0xff));
    }' unless defined(&PCITAG_BUS);
    eval 'sub PCITAG_DEV {
        my($t) = @_;
	    eval q((( &PCITAG_OFFSET($t)>>11)&0x1f));
    }' unless defined(&PCITAG_DEV);
    eval 'sub PCITAG_FUN {
        my($t) = @_;
	    eval q((( &PCITAG_OFFSET($t)>>8)&0x7));
    }' unless defined(&PCITAG_FUN);
    eval 'sub PCITAG_CREATE {
        my($n,$b,$d,$f) = @_;
	    eval q(((( &u_int64_t)($n)<<32)|(($b)<<16)|(($d)<<11)|(($f)<<8)));
    }' unless defined(&PCITAG_CREATE);
    eval 'sub PCITAG_SETNODE {
        my($t,$n) = @_;
	    eval q((($t)&0xffffffff)|((($n)<<32));
    }' unless defined(&PCITAG_SETNODE);
    eval 'sub PCI_MACHDEP_ENUMERATE_BUS () { &sparc64_pci_enumerate_bus;}' unless defined(&PCI_MACHDEP_ENUMERATE_BUS);
    eval 'sub pciide_machdep_compat_intr_establish {
        my($a, $b, $c, $d, $e) = @_;
	    eval q(( &NULL));
    }' unless defined(&pciide_machdep_compat_intr_establish);
    eval 'sub pciide_machdep_compat_intr_disestablish {
        my($a, $b) = @_;
	    eval q( &do { }  &while (0));
    }' unless defined(&pciide_machdep_compat_intr_disestablish);
}
1;
