diff options
Diffstat (limited to 'drivers/net/skfp/drvfbi.c')
-rw-r--r-- | drivers/net/skfp/drvfbi.c | 222 |
1 files changed, 4 insertions, 218 deletions
diff --git a/drivers/net/skfp/drvfbi.c b/drivers/net/skfp/drvfbi.c index 052e841ba187..5b475833f645 100644 --- a/drivers/net/skfp/drvfbi.c +++ b/drivers/net/skfp/drvfbi.c | |||
@@ -105,8 +105,8 @@ extern int AIX_vpdReadByte() ; | |||
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | 107 | ||
108 | /* Prototypes of local functions. */ | 108 | /* Prototype of a local function. */ |
109 | void smt_stop_watchdog(struct s_smc *smc); | 109 | static void smt_stop_watchdog(struct s_smc *smc); |
110 | 110 | ||
111 | #ifdef MCA | 111 | #ifdef MCA |
112 | static int read_card_id() ; | 112 | static int read_card_id() ; |
@@ -631,7 +631,7 @@ void plc_clear_irq(struct s_smc *smc, int p) | |||
631 | * LED_Y_OFF just switch yellow LED off | 631 | * LED_Y_OFF just switch yellow LED off |
632 | * LED_Y_ON just switch yello LED on | 632 | * LED_Y_ON just switch yello LED on |
633 | */ | 633 | */ |
634 | void led_indication(struct s_smc *smc, int led_event) | 634 | static void led_indication(struct s_smc *smc, int led_event) |
635 | { | 635 | { |
636 | /* use smc->hw.mac_ring_is_up == TRUE | 636 | /* use smc->hw.mac_ring_is_up == TRUE |
637 | * as indication for Ring Operational | 637 | * as indication for Ring Operational |
@@ -764,122 +764,6 @@ void llc_recover_tx(struct s_smc *smc) | |||
764 | #endif | 764 | #endif |
765 | } | 765 | } |
766 | 766 | ||
767 | /*--------------------------- DMA init ----------------------------*/ | ||
768 | #ifdef ISA | ||
769 | |||
770 | /* | ||
771 | * init DMA | ||
772 | */ | ||
773 | void init_dma(struct s_smc *smc, int dma) | ||
774 | { | ||
775 | SK_UNUSED(smc) ; | ||
776 | |||
777 | /* | ||
778 | * set cascade mode, | ||
779 | * clear mask bit (enable DMA cannal) | ||
780 | */ | ||
781 | if (dma > 3) { | ||
782 | outp(0xd6,(dma & 0x03) | 0xc0) ; | ||
783 | outp(0xd4, dma & 0x03) ; | ||
784 | } | ||
785 | else { | ||
786 | outp(0x0b,(dma & 0x03) | 0xc0) ; | ||
787 | outp(0x0a,dma & 0x03) ; | ||
788 | } | ||
789 | } | ||
790 | |||
791 | /* | ||
792 | * disable DMA | ||
793 | */ | ||
794 | void dis_dma(struct s_smc *smc, int dma) | ||
795 | { | ||
796 | SK_UNUSED(smc) ; | ||
797 | |||
798 | /* | ||
799 | * set mask bit (disable DMA cannal) | ||
800 | */ | ||
801 | if (dma > 3) { | ||
802 | outp(0xd4,(dma & 0x03) | 0x04) ; | ||
803 | } | ||
804 | else { | ||
805 | outp(0x0a,(dma & 0x03) | 0x04) ; | ||
806 | } | ||
807 | } | ||
808 | |||
809 | #endif /* ISA */ | ||
810 | |||
811 | #ifdef EISA | ||
812 | |||
813 | /*arrays with io addresses of dma controller length and address registers*/ | ||
814 | static const int cntr[8] = { 0x001,0x003,0x005,0x007,0,0x0c6,0x0ca,0x0ce } ; | ||
815 | static const int base[8] = { 0x000,0x002,0x004,0x006,0,0x0c4,0x0c8,0x0cc } ; | ||
816 | static const int page[8] = { 0x087,0x083,0x081,0x082,0,0x08b,0x089,0x08a } ; | ||
817 | |||
818 | void init_dma(struct s_smc *smc, int dma) | ||
819 | { | ||
820 | /* | ||
821 | * extended mode register | ||
822 | * 32 bit IO | ||
823 | * type c | ||
824 | * TC output | ||
825 | * disable stop | ||
826 | */ | ||
827 | |||
828 | /* mode read (write) demand */ | ||
829 | smc->hw.dma_rmode = (dma & 3) | 0x08 | 0x0 ; | ||
830 | smc->hw.dma_wmode = (dma & 3) | 0x04 | 0x0 ; | ||
831 | |||
832 | /* 32 bit IO's, burst DMA mode (type "C") */ | ||
833 | smc->hw.dma_emode = (dma & 3) | 0x08 | 0x30 ; | ||
834 | |||
835 | outp((dma < 4) ? 0x40b : 0x4d6,smc->hw.dma_emode) ; | ||
836 | |||
837 | /* disable chaining */ | ||
838 | outp((dma < 4) ? 0x40a : 0x4d4,(dma&3)) ; | ||
839 | |||
840 | /*load dma controller addresses for fast access during set dma*/ | ||
841 | smc->hw.dma_base_word_count = cntr[smc->hw.dma]; | ||
842 | smc->hw.dma_base_address = base[smc->hw.dma]; | ||
843 | smc->hw.dma_base_address_page = page[smc->hw.dma]; | ||
844 | |||
845 | } | ||
846 | |||
847 | void dis_dma(struct s_smc *smc, int dma) | ||
848 | { | ||
849 | SK_UNUSED(smc) ; | ||
850 | |||
851 | outp((dma < 4) ? 0x0a : 0xd4,(dma&3)|4) ;/* mask bit */ | ||
852 | } | ||
853 | #endif /* EISA */ | ||
854 | |||
855 | #ifdef MCA | ||
856 | void init_dma(struct s_smc *smc, int dma) | ||
857 | { | ||
858 | SK_UNUSED(smc) ; | ||
859 | SK_UNUSED(dma) ; | ||
860 | } | ||
861 | |||
862 | void dis_dma(struct s_smc *smc, int dma) | ||
863 | { | ||
864 | SK_UNUSED(smc) ; | ||
865 | SK_UNUSED(dma) ; | ||
866 | } | ||
867 | #endif | ||
868 | |||
869 | #ifdef PCI | ||
870 | void init_dma(struct s_smc *smc, int dma) | ||
871 | { | ||
872 | SK_UNUSED(smc) ; | ||
873 | SK_UNUSED(dma) ; | ||
874 | } | ||
875 | |||
876 | void dis_dma(struct s_smc *smc, int dma) | ||
877 | { | ||
878 | SK_UNUSED(smc) ; | ||
879 | SK_UNUSED(dma) ; | ||
880 | } | ||
881 | #endif | ||
882 | |||
883 | #ifdef MULT_OEM | 767 | #ifdef MULT_OEM |
884 | static int is_equal_num(char comp1[], char comp2[], int num) | 768 | static int is_equal_num(char comp1[], char comp2[], int num) |
885 | { | 769 | { |
@@ -1407,7 +1291,7 @@ void smt_start_watchdog(struct s_smc *smc) | |||
1407 | #endif /* DEBUG */ | 1291 | #endif /* DEBUG */ |
1408 | } | 1292 | } |
1409 | 1293 | ||
1410 | void smt_stop_watchdog(struct s_smc *smc) | 1294 | static void smt_stop_watchdog(struct s_smc *smc) |
1411 | { | 1295 | { |
1412 | SK_UNUSED(smc) ; /* Make LINT happy. */ | 1296 | SK_UNUSED(smc) ; /* Make LINT happy. */ |
1413 | #ifndef DEBUG | 1297 | #ifndef DEBUG |
@@ -1422,104 +1306,6 @@ void smt_stop_watchdog(struct s_smc *smc) | |||
1422 | } | 1306 | } |
1423 | 1307 | ||
1424 | #ifdef PCI | 1308 | #ifdef PCI |
1425 | static char get_rom_byte(struct s_smc *smc, u_short addr) | ||
1426 | { | ||
1427 | GET_PAGE(addr) ; | ||
1428 | return (READ_PROM(ADDR(B2_FDP))) ; | ||
1429 | } | ||
1430 | |||
1431 | /* | ||
1432 | * ROM image defines | ||
1433 | */ | ||
1434 | #define ROM_SIG_1 0 | ||
1435 | #define ROM_SIG_2 1 | ||
1436 | #define PCI_DATA_1 0x18 | ||
1437 | #define PCI_DATA_2 0x19 | ||
1438 | |||
1439 | /* | ||
1440 | * PCI data structure defines | ||
1441 | */ | ||
1442 | #define VPD_DATA_1 0x08 | ||
1443 | #define VPD_DATA_2 0x09 | ||
1444 | #define IMAGE_LEN_1 0x10 | ||
1445 | #define IMAGE_LEN_2 0x11 | ||
1446 | #define CODE_TYPE 0x14 | ||
1447 | #define INDICATOR 0x15 | ||
1448 | |||
1449 | /* | ||
1450 | * BEGIN_MANUAL_ENTRY(mac_drv_vpd_read) | ||
1451 | * mac_drv_vpd_read(smc,buf,size,image) | ||
1452 | * | ||
1453 | * function DOWNCALL (FDDIWARE) | ||
1454 | * reads the VPD data of the FPROM and writes it into the | ||
1455 | * buffer | ||
1456 | * | ||
1457 | * para buf points to the buffer for the VPD data | ||
1458 | * size size of the VPD data buffer | ||
1459 | * image boot image; code type of the boot image | ||
1460 | * image = 0 Intel x86, PC-AT compatible | ||
1461 | * 1 OPENBOOT standard for PCI | ||
1462 | * 2-FF reserved | ||
1463 | * | ||
1464 | * returns len number of VPD data bytes read form the FPROM | ||
1465 | * <0 number of read bytes | ||
1466 | * >0 error: data invalid | ||
1467 | * | ||
1468 | * END_MANUAL_ENTRY | ||
1469 | */ | ||
1470 | int mac_drv_vpd_read(struct s_smc *smc, char *buf, int size, char image) | ||
1471 | { | ||
1472 | u_short ibase ; | ||
1473 | u_short pci_base ; | ||
1474 | u_short vpd ; | ||
1475 | int len ; | ||
1476 | |||
1477 | len = 0 ; | ||
1478 | ibase = 0 ; | ||
1479 | /* | ||
1480 | * as long images defined | ||
1481 | */ | ||
1482 | while (get_rom_byte(smc,ibase+ROM_SIG_1) == 0x55 && | ||
1483 | (u_char) get_rom_byte(smc,ibase+ROM_SIG_2) == 0xaa) { | ||
1484 | /* | ||
1485 | * get the pointer to the PCI data structure | ||
1486 | */ | ||
1487 | pci_base = ibase + get_rom_byte(smc,ibase+PCI_DATA_1) + | ||
1488 | (get_rom_byte(smc,ibase+PCI_DATA_2) << 8) ; | ||
1489 | |||
1490 | if (image == get_rom_byte(smc,pci_base+CODE_TYPE)) { | ||
1491 | /* | ||
1492 | * we have the right image, read the VPD data | ||
1493 | */ | ||
1494 | vpd = ibase + get_rom_byte(smc,pci_base+VPD_DATA_1) + | ||
1495 | (get_rom_byte(smc,pci_base+VPD_DATA_2) << 8) ; | ||
1496 | if (vpd == ibase) { | ||
1497 | break ; /* no VPD data */ | ||
1498 | } | ||
1499 | for (len = 0; len < size; len++,buf++,vpd++) { | ||
1500 | *buf = get_rom_byte(smc,vpd) ; | ||
1501 | } | ||
1502 | break ; | ||
1503 | } | ||
1504 | else { | ||
1505 | /* | ||
1506 | * try the next image | ||
1507 | */ | ||
1508 | if (get_rom_byte(smc,pci_base+INDICATOR) & 0x80) { | ||
1509 | break ; /* this was the last image */ | ||
1510 | } | ||
1511 | ibase = ibase + get_rom_byte(smc,ibase+IMAGE_LEN_1) + | ||
1512 | (get_rom_byte(smc,ibase+IMAGE_LEN_2) << 8) ; | ||
1513 | } | ||
1514 | } | ||
1515 | |||
1516 | return(len) ; | ||
1517 | } | ||
1518 | |||
1519 | void mac_drv_pci_fix(struct s_smc *smc, u_long fix_value) | ||
1520 | { | ||
1521 | smc->hw.pci_fix_value = fix_value ; | ||
1522 | } | ||
1523 | 1309 | ||
1524 | void mac_do_pci_fix(struct s_smc *smc) | 1310 | void mac_do_pci_fix(struct s_smc *smc) |
1525 | { | 1311 | { |