require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_PCI_AGPVAR_H_)) {
    eval 'sub _PCI_AGPVAR_H_ () {1;}' unless defined(&_PCI_AGPVAR_H_);
    require 'sys/lock.ph';
    require 'dev/pci/vga_pcivar.ph';
    if(defined(&AGP_DEBUG)) {
	eval 'sub AGP_DPF () {( &fmt,  &arg...)  &do {  &printf("agp: "  &fmt , &arg); }  &while (0);}' unless defined(&AGP_DPF);
    } else {
	eval 'sub AGP_DPF () {( &fmt,  &arg...)  &do {}  &while (0);}' unless defined(&AGP_DPF);
    }
    eval 'sub AGPUNIT {
        my($x) = @_;
	    eval q( &minor($x));
    }' unless defined(&AGPUNIT);
    eval 'sub AGP_GET_APERTURE {
        my($sc) = @_;
	    eval q((($sc)-> ($sc_methods->{get_aperture})($sc)));
    }' unless defined(&AGP_GET_APERTURE);
    eval 'sub AGP_SET_APERTURE {
        my($sc,$a) = @_;
	    eval q((($sc)-> ($sc_methods->{set_aperture})(($sc),($a))));
    }' unless defined(&AGP_SET_APERTURE);
    eval 'sub AGP_BIND_PAGE {
        my($sc,$o,$p) = @_;
	    eval q((($sc)-> ($sc_methods->{bind_page})(($sc),($o),($p))));
    }' unless defined(&AGP_BIND_PAGE);
    eval 'sub AGP_UNBIND_PAGE {
        my($sc,$o) = @_;
	    eval q((($sc)-> ($sc_methods->{unbind_page})(($sc), ($o))));
    }' unless defined(&AGP_UNBIND_PAGE);
    eval 'sub AGP_FLUSH_TLB {
        my($sc) = @_;
	    eval q((($sc)-> ($sc_methods->{flush_tlb})($sc)));
    }' unless defined(&AGP_FLUSH_TLB);
    eval 'sub AGP_ENABLE {
        my($sc,$m) = @_;
	    eval q((($sc)-> ($sc_methods->{enable})(($sc),($m))));
    }' unless defined(&AGP_ENABLE);
    eval 'sub AGP_ALLOC_MEMORY {
        my($sc,$t,$s) = @_;
	    eval q((($sc)-> ($sc_methods->{alloc_memory})(($sc),($t),($s))));
    }' unless defined(&AGP_ALLOC_MEMORY);
    eval 'sub AGP_FREE_MEMORY {
        my($sc,$m) = @_;
	    eval q((($sc)-> ($sc_methods->{free_memory})(($sc),($m))));
    }' unless defined(&AGP_FREE_MEMORY);
    eval 'sub AGP_BIND_MEMORY {
        my($sc,$m,$o) = @_;
	    eval q((($sc)-> ($sc_methods->{bind_memory})(($sc),($m),($o))));
    }' unless defined(&AGP_BIND_MEMORY);
    eval 'sub AGP_UNBIND_MEMORY {
        my($sc,$m) = @_;
	    eval q((($sc)-> ($sc_methods->{unbind_memory})(($sc),($m))));
    }' unless defined(&AGP_UNBIND_MEMORY);
}
1;
