require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_EM_H_DEFINED_)) {
    eval 'sub _EM_H_DEFINED_ () {1;}' unless defined(&_EM_H_DEFINED_);
    require 'bpfilter.ph';
    require 'vlan.ph';
    require 'sys/param.ph';
    require 'sys/systm.ph';
    require 'sys/sockio.ph';
    require 'sys/mbuf.ph';
    require 'sys/malloc.ph';
    require 'sys/kernel.ph';
    require 'sys/device.ph';
    require 'sys/socket.ph';
    require 'net/if.ph';
    require 'net/if_dl.ph';
    require 'net/if_media.ph';
    if(defined(&INET)) {
	require 'netinet/in.ph';
	require 'netinet/in_systm.ph';
	require 'netinet/in_var.ph';
	require 'netinet/ip.ph';
	require 'netinet/if_ether.ph';
	require 'netinet/tcp.ph';
	require 'netinet/udp.ph';
    }
    if((defined(&NVLAN) ? &NVLAN : 0) > 0) {
	require 'net/if_types.ph';
	require 'net/if_vlan_var.ph';
    }
    if((defined(&NBPFILTER) ? &NBPFILTER : 0) > 0) {
	require 'net/bpf.ph';
    }
    require 'uvm/uvm_extern.ph';
    require 'dev/pci/pcireg.ph';
    require 'dev/pci/pcivar.ph';
    require 'dev/pci/pcidevs.ph';
    require 'dev/pci/if_em_hw.ph';
    eval 'sub EM_MIN_TXD () {12;}' unless defined(&EM_MIN_TXD);
    eval 'sub EM_MAX_TXD_82543 () {256;}' unless defined(&EM_MAX_TXD_82543);
    eval 'sub EM_MAX_TXD () {512;}' unless defined(&EM_MAX_TXD);
    eval 'sub EM_MIN_RXD () {12;}' unless defined(&EM_MIN_RXD);
    eval 'sub EM_MAX_RXD () {256;}' unless defined(&EM_MAX_RXD);
    eval 'sub EM_TIDV () {64;}' unless defined(&EM_TIDV);
    eval 'sub EM_TADV () {64;}' unless defined(&EM_TADV);
    eval 'sub EM_RDTR () {0;}' unless defined(&EM_RDTR);
    eval 'sub EM_RADV () {64;}' unless defined(&EM_RADV);
    eval 'sub EM_TX_TIMEOUT () {5;}' unless defined(&EM_TX_TIMEOUT);
    eval 'sub EM_TX_CLEANUP_THRESHOLD () {( ($sc->{num_tx_desc}) / 8);}' unless defined(&EM_TX_CLEANUP_THRESHOLD);
    eval 'sub EM_TX_OP_THRESHOLD () {( ($sc->{num_tx_desc}) / 32);}' unless defined(&EM_TX_OP_THRESHOLD);
    eval 'sub DO_AUTO_NEG () {1;}' unless defined(&DO_AUTO_NEG);
    eval 'sub WAIT_FOR_AUTO_NEG_DEFAULT () {0;}' unless defined(&WAIT_FOR_AUTO_NEG_DEFAULT);
    eval 'sub AUTONEG_ADV_DEFAULT () {( &ADVERTISE_10_HALF |  &ADVERTISE_10_FULL |  &ADVERTISE_100_HALF |  &ADVERTISE_100_FULL |  &ADVERTISE_1000_FULL);}' unless defined(&AUTONEG_ADV_DEFAULT);
    eval 'sub EM_MMBA () {0x10;}' unless defined(&EM_MMBA);
    eval 'sub EM_FLASH () {0x14;}' unless defined(&EM_FLASH);
    eval 'sub EM_ROUNDUP {
        my($size, $unit) = @_;
	    eval q(((($size) + ($unit) - 1) & ~(($unit) - 1)));
    }' unless defined(&EM_ROUNDUP);
    eval 'sub EM_SMARTSPEED_DOWNSHIFT () {3;}' unless defined(&EM_SMARTSPEED_DOWNSHIFT);
    eval 'sub EM_SMARTSPEED_MAX () {15;}' unless defined(&EM_SMARTSPEED_MAX);
    eval 'sub MAX_NUM_MULTICAST_ADDRESSES () {128;}' unless defined(&MAX_NUM_MULTICAST_ADDRESSES);
    eval 'sub EM_DBA_ALIGN () {128;}' unless defined(&EM_DBA_ALIGN);
    eval 'sub SPEED_MODE_BIT () {(1<<21);}' unless defined(&SPEED_MODE_BIT);
    eval 'sub DEBUG_INIT () {0;}' unless defined(&DEBUG_INIT);
    eval 'sub DEBUG_IOCTL () {0;}' unless defined(&DEBUG_IOCTL);
    eval 'sub DEBUG_HW () {0;}' unless defined(&DEBUG_HW);
    eval 'sub INIT_DEBUGOUT {
        my($S) = @_;
	    eval q( &if ( &DEBUG_INIT)  &printf($S \\"\\\\n\\"));
    }' unless defined(&INIT_DEBUGOUT);
    eval 'sub INIT_DEBUGOUT1 {
        my($S, $A) = @_;
	    eval q( &if ( &DEBUG_INIT)  &printf($S \\"\\\\n\\", $A));
    }' unless defined(&INIT_DEBUGOUT1);
    eval 'sub INIT_DEBUGOUT2 {
        my($S, $A, $B) = @_;
	    eval q( &if ( &DEBUG_INIT)  &printf($S \\"\\\\n\\", $A, $B));
    }' unless defined(&INIT_DEBUGOUT2);
    eval 'sub IOCTL_DEBUGOUT {
        my($S) = @_;
	    eval q( &if ( &DEBUG_IOCTL)  &printf($S \\"\\\\n\\"));
    }' unless defined(&IOCTL_DEBUGOUT);
    eval 'sub IOCTL_DEBUGOUT1 {
        my($S, $A) = @_;
	    eval q( &if ( &DEBUG_IOCTL)  &printf($S \\"\\\\n\\", $A));
    }' unless defined(&IOCTL_DEBUGOUT1);
    eval 'sub IOCTL_DEBUGOUT2 {
        my($S, $A, $B) = @_;
	    eval q( &if ( &DEBUG_IOCTL)  &printf($S \\"\\\\n\\", $A, $B));
    }' unless defined(&IOCTL_DEBUGOUT2);
    eval 'sub HW_DEBUGOUT {
        my($S) = @_;
	    eval q( &if ( &DEBUG_HW)  &printf($S \\"\\\\n\\"));
    }' unless defined(&HW_DEBUGOUT);
    eval 'sub HW_DEBUGOUT1 {
        my($S, $A) = @_;
	    eval q( &if ( &DEBUG_HW)  &printf($S \\"\\\\n\\", $A));
    }' unless defined(&HW_DEBUGOUT1);
    eval 'sub HW_DEBUGOUT2 {
        my($S, $A, $B) = @_;
	    eval q( &if ( &DEBUG_HW)  &printf($S \\"\\\\n\\", $A, $B));
    }' unless defined(&HW_DEBUGOUT2);
    eval 'sub EM_RXBUFFER_2048 () {2048;}' unless defined(&EM_RXBUFFER_2048);
    eval 'sub EM_RXBUFFER_4096 () {4096;}' unless defined(&EM_RXBUFFER_4096);
    eval 'sub EM_RXBUFFER_8192 () {8192;}' unless defined(&EM_RXBUFFER_8192);
    eval 'sub EM_RXBUFFER_16384 () {16384;}' unless defined(&EM_RXBUFFER_16384);
    eval 'sub EM_MAX_SCATTER () {64;}' unless defined(&EM_MAX_SCATTER);
    eval 'sub EM_TSO_SIZE () {65535;}' unless defined(&EM_TSO_SIZE);
    eval("sub OFFLOAD_NONE () { 0; }") unless defined(&OFFLOAD_NONE);
    eval("sub OFFLOAD_TCP_IP () { 1; }") unless defined(&OFFLOAD_TCP_IP);
    eval("sub OFFLOAD_UDP_IP () { 2; }") unless defined(&OFFLOAD_UDP_IP);
    if(defined(&__STRICT_ALIGNMENT)) {
    }
    eval 'sub EM_PBA_BYTES_SHIFT () {0xa;}' unless defined(&EM_PBA_BYTES_SHIFT);
    eval 'sub EM_TX_HEAD_ADDR_SHIFT () {7;}' unless defined(&EM_TX_HEAD_ADDR_SHIFT);
    eval 'sub EM_PBA_TX_MASK () {0xffff0000;}' unless defined(&EM_PBA_TX_MASK);
    eval 'sub EM_FIFO_HDR () {0x10;}' unless defined(&EM_FIFO_HDR);
    eval 'sub EM_82547_PKT_THRESH () {0x3e0;}' unless defined(&EM_82547_PKT_THRESH);
}
1;
