x.y VENDOR ID Vendor ID �� AMD ���������� 0x1022, �� Device ID �������������� ���������� - 0x2000. ������ ���������������� ������������������ �� ������ PCI_VENDOR_ID_AMD �� PCI_DEVICE_ID_AMD_LANCE ����������������������������. ������ �������������������� ������������������ pci_device_id ���������� ������������������������������ ���������������� PCI_DEVICE, �������������� ���������������� �� . �������� ������������ ���������������������� ���������������� vendor �� device �� ������������������, �� ���������������� subvendor �� subdevice �������������������������� �� PCI_ANY_ID. �������������������������� �� ���������� ������������: struct pci_device_id pcnet_pci_tbl[] = { { PCI_DEVICE( PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE ), }, { } } x.y ���������������������� PCI ���������������� �������������������� ������������������ ������������������ pci_driver. ������ �������������������� ������������ �������� �������� ������������������: struct pci_driver pcnet_pci_driver = { .name = DRV_NAME, .id_table = pcnet_pci_tbl, .probe = pcnet_probe, .remove = pcnet_remove }; name ���������������� �������������������� ���� ������������. ������������������ �������������� probe() �� remove() ���������� �������������������� �� ���������������� ������������������ pci_driver �� ���������������������� PCI ���������������� ���������� ���������� ������������������ ������������ �������������� �������������������������� ������������: pci_register_driver(&pcnet_pci_driver); ���������� ���������� �������� ���������������� �������������������� �������������� pcnet_probe(), �� �������������������� ���� PCI ��������������������, ������ ���������������� �������������� ���������������� Vendor ID �� Device ID (������������������������ =)) �������������� �������������������������� �� �������������� �������������������� "���������������� ����������������������", �������������� �������������������� �� [2]. ������ �������������� �������������������������� �� �������������� ������������ �������������������� ������������������������ __init �� __exit ����������������������������, �� ������ �������������������������� �� �������������� �������������������� - __devinit �� __devexit. ��������������, �������������������� ���� probe() ���������� ���������� ���������������� __devinit. ������ ������������������ �� [2], ���������� ���� ���������������� ��������������, ������ ���������������� ����������������������. �������������� pcnet_pci_tbl ������������ �������� ���������������� ������ __devinitconst [2], ���� ������ ���������������� ��������������������������, �������� �������������� ������������������ ���������� DEFINE_PCI_DEVICE_TABLE() x.y PCI BUS MASTERING Bus mastering [6] Bus mastering (�������������������� ����������) ������ �������������� �������� PCI �������������� ���������� ���������������������������� ���������� PCI ���������������������� (���������������� ������������������������ ����������, ���������������������� ������������������������ ������ ���������������� ������������). Bus mastering ������������������ �������������������� ������������������ ���������� �� ������������������������ (������������������������) ���������� �������������������� ������������ / ������������ �� ������������ ���������������������� ���� �������� PCI ������ �� ������������������ ������������. ������ �������������������� ���������������������������� �������������������� ���� ���������������� ��������������������, �������������� ������ ���������������� ���������� ������������ �� ��������, ���� ���� �� ��������������������. Bus mastering �������������������� ���������������������� ���� �������������� �������������� ��������������������, ���������������������������� ����������������������. ������������������������ bus mastering �� ������, ������ �������������������� �������������������������������������� ���� �������������������� ����������-�������� ���������������� ������������ ������ ���� �������������������� ������������������������������������ ������������ ������������ ���� �������������� ���������������� ���� �������������������� �������� ���� (��������������������) ���� ���������������� �������� ������������. ������������ ������ ���������������������������� �������������������� �� ������, ������ ������������ �������� (bus master) ���������������� �������� ���������������� ������������������������ ���������������� ��������������������. ������ ������������������ �������������� bus mastering ������ pci ��������������������, ������������������������ �������������� pci_set_master(). x.y �������������� ���������� I/O �� ������������������ ��������������, �������������� ���������������� ���� ������������������ pci_dev ������������������ ���������� I/O, ����������������, ������������ ���������� ������������������ ������������������������ �� ����������. ������ �������������� �������� ������������������ ������������������ �� ������������������ ��������. ���� ���������� �������� ������ �������������������� ���� ������������������ �� �������� resource. ������������������ �������������������� ������������ ����������������: ioaddr = pci_resource_start(pdev, 0); x.y ���������� ���������������������� S_RESET [1] Software Reset (S_RESET) is a PCnet-PCI II controller reset operation that has been created by a read access to the Reset register which is located at offset 14h in Word I/O mode or offset 18h in DWord I/O mode from the PCnet-PCI II controller I/O or memory mapped I/O base address. ���������� �������������� ������ ������������ ���������������������� �������������������� ������������������ �������������� Reset, �������������� ������������������ ���� ���������������� 14h ������������������������ ���������������� ������������ I/O. ������ ���������� ������������������ ������������������ ��������������: inw( BASE_IO_ADDR + 0x14 ); ������ ������������ ���������������� ������������������ ���������������� PCNET_PIO_RESET ������������ 0x14. ��������������������, ������ 32-������������ ������������������: inl( BASE_IO_ADDR + 0x18 ); ���������������� ���� ������������������ ���������������� CSR0 ���������� 0x0004 [5], ��.��. �������������������������� ������ STOP. x.y ������������ �� ������������ ������������������ CSR I/O Register Accesses [5] To access a Control Status Register, you must com- plete a two step operation. First, you perform an I/O write to the RAP using the appropriate CSR number as your data. Then, you perform an I/O read or write ac- cess to the RDP. Note that the contents of the RAP is latched and is not changed until rewritten; therefore, the register select cycle is not required in order to re- peatedly access the same CSR. Register 16bit I/O 32bit I/O RDP 0x10 0x10 RAP 0x12 0x14 RESET 0x14 0x18 ��������������������������, ���������� ���������������� �� �������������� RAP ���������� ���������������� CSR, �� ���������� ������������/������������ ���������������� ����/�� �������������� RDP. ���������������� ������������������ ������ �������������� ������������ ������������������ ������������������ �� �������������� ��������. x.y ���������������������� ���������������������� I/O ������������������ ������������������ ���������������� ���� ������������������ ���������������� CSR0, ���������� �������������������� ���������� ������������������ ������������������ ����������������. ���������� ������������ ���������������������� ���������������� ������������������ CSR0 �� �������������� ������ ����������������. �������������� �������������� 16-������������ ������������������, ������������������ ������ ���������� ������������������������������ ���������������� ������������ I/O ������������������������. �� ������������ ������������ �������������� 32-������������ ������������������. �������� ���� �� ���������� ������������ - �������������������� ������������ ���������������������� ��������������������. x.y �������������� ������������ ����������-������������ ���������� PROM, ���������������� ������������������������ �������� �� ���������������� ���������������������� ���������������� 32 ���������� ������������������ ������������������������ [1]. ������������ ������ PIO, ������ �� MMIO ����������������������������. �������������������� ���������� ���������� ������������������������������ 32 ���������� �������������� ������������ ����������-������������ �������������� �� ���������������� ������������. ������ �������������� �������������� ������������������ ���������������� PCNET_IO_RANGE_SIZE ������������ 32. request_region( BASE_IO_ADDR, PCNET_IO_RANGE_SIZE, DRV_NAME ); ���������� ���������� ������������������������������ ���������������� pci_request_regions(), �������������� ���������� �������������� ���������� �� ������������ �������������� ���� ������������������ pci_dev. �� ���������� ������������ ������ �������������� ����������: pci_request_regions(pdev, DRV_NAME); ������ ������������������������ ���������������������������������� �������������� ���������� ������������������������������ ������������������ release_region() ������ pci_release_regions() ����������������������������. x.y HARDWARE (MAC) ADDRESS �������������������� ���������� ������������������ �� ������������ ���������� ������������ EEPROM [1]. ������ �������������� �� ������ ���������� ������������������������������ �������������� ����������-������������ ���� ���������������� 0-5 ������������������������ ���������������� ������������. I/O offsers 0h-Fh Address PROM locations [1] x.y �������������������� ���������� ������������������ net_device ������������������ net_device �������������� �� ������ �������������� �������������������� ������������������ net_device �������� 2.6.27 �� 2.6.31 ��������������������. �� ���������� �������������� ���� ������������������ �������������� ������������������ ���� ��������������, ���������������������� �������������������������������� ����������������. ������������ ���������� ������������������ ���������� �������� netdev_ops, �������������� ������ ������������������ net_device_ops. ������ ������������������ ���� �������������� (�������������� ����������������������������) �������������������� ������������ ������. ������ ���������������� ����������������������, ���������� �������������� �������������������� ������������������������, �� ���������� ���������� �������������������� ���������������� HAVE_NET_DEVICE_OPS �������� ������������������������ alloc_etherdev() ������ �������������������������� ������������������ net_device, ���� ������ ������ ���������� ������������������ ���������������� �������������������������� ������ Ethernet. �������������������� ������������������ �������� netdev_ops, base_addr, irq, dev_addr. x.y �������������������� The controller hardware interrupt remains asserted until one of the following conditions is met [5]: * A one is written to each bit in CSR0 and CSR4 that indicates an interrupt condition * The controller RESET pin is asserted * The STOP bit is set (CSR0, bit 2) x.y POLLING �������������������� ���������� �������������������� ���� ��������������, ���������������� ������ �������� �������������������� �� ���������������� CSR0. �� ���������� ������������ ������ ������������ ���������� ���������������� ���� �������������������������� �������� �������������������� (7-�� ������ ���������������� CSR0) [5]. ���������� ������������ ���������������� ������������������ ������������������ �������������� ������ �������������� �������������������� �������������������������� ��������������������. x.y �������������������� [1]. Am79C970A PCnetTM-PCI II Single-Chip Full-Duplex Ethernet Controller for PCI Local Bus Product [2]. linux/Documentation/PCI/pci.txt [3]. "Linux. �������������� ����������������������. ������������������ �� �������������������� �������������� �������������������� �� ��������" ��.������������, ��.������������, ��.������������, ��.������������, ��.������������ 2006 [4]. linux/Documentation/DMA-mapping.txt [5]. PCnet Family Software Design Considerations [6]. "���������������������� ���� PCI �� AGP" http://www.3dnews.ru/video/pci-agp-guide/print