[libc] Fix isdigit(), islower() and isupper().
[people/dverkamp/gpxe.git] / src / drivers / net / mlx_ipoib / mt23108.c
index 37947a8..e1f61db 100644 (file)
@@ -10,10 +10,16 @@ Skeleton NIC driver for Etherboot
  * your option) any later version.
  */
 
+/* to get toupper() */
+#include <ctype.h>
 /* to get some global routines like printf */
 #include "etherboot.h"
 /* to get the interface to the body of the program */
 #include "nic.h"
+/* to get the PCI support functions, if this is a PCI NIC */
+#include <gpxe/pci.h>
+/* to get the ISA support functions, if this is an ISA NIC */
+#include <gpxe/isa.h>
 
 #include "mt_version.c"
 #include "mt23108_imp.c"
@@ -27,12 +33,7 @@ int prompt_key(int secs, unsigned char *ch_p)
 
        for (tmo = currticks() + secs * TICKS_PER_SEC; currticks() < tmo;) {
                if (iskey()) {
-                       ch = getchar();
-                       /* toupper does not work ... */
-                       if (ch == 'v')
-                               ch = 'V';
-                       if (ch == 'i')
-                               ch = 'I';
+                       ch = toupper(getchar());
                        if ((ch=='V') || (ch=='I')) {
                                *ch_p = ch;
                                return 1;
@@ -148,7 +149,7 @@ static void tavor_transmit(struct nic *nic, const char *dest,       /* Destination */
 /**************************************************************************
 DISABLE - Turn off ethernet interface
 ***************************************************************************/
-static void tavor_disable(struct nic *nic)
+static void tavor_disable(struct dev *dev)
 {
        /* put the card in its initial state */
        /* This function serves 3 purposes.
@@ -160,24 +161,18 @@ static void tavor_disable(struct nic *nic)
         * This allows etherboot to reinitialize the interface
         *  if something is something goes wrong.
         */
-       if (nic || 1) {         // ????
+       if (dev || 1) {         // ????
                disable_imp();
        }
 }
 
-static struct nic_operations tavor_operations = {
-       .connect        = dummy_connect,
-       .poll           = tavor_poll,
-       .transmit       = tavor_transmit,
-       .irq            = tavor_irq,
-};
-
 /**************************************************************************
 PROBE - Look for an adapter, this routine's visible to the outside
 ***************************************************************************/
 
-static int tavor_probe(struct nic *nic, struct pci_device *pci)
+static int tavor_probe(struct dev *dev, struct pci_device *pci)
 {
+       struct nic *nic = (struct nic *)dev;
        int rc;
        unsigned char user_request;
 
@@ -221,7 +216,10 @@ static int tavor_probe(struct nic *nic, struct pci_device *pci)
                nic->ioaddr = pci->ioaddr & ~3;
                nic->irqno = pci->irq;
                /* point to NIC specific routines */
-               nic->nic_op = &tavor_operations;
+               dev->disable = tavor_disable;
+               nic->poll = tavor_poll;
+               nic->transmit = tavor_transmit;
+               nic->irq = tavor_irq;
 
                return 1;
        }
@@ -229,12 +227,16 @@ static int tavor_probe(struct nic *nic, struct pci_device *pci)
        return 0;
 }
 
-static struct pci_device_id tavor_nics[] = {
+static struct pci_id tavor_nics[] = {
        PCI_ROM(0x15b3, 0x5a44, "MT23108", "MT23108 HCA driver"),
        PCI_ROM(0x15b3, 0x6278, "MT25208", "MT25208 HCA driver"),
 };
 
-PCI_DRIVER ( tavor_driver, tavor_nics, PCI_NO_CLASS );
-
-DRIVER ( "MT23108/MT25208", nic_driver, pci_driver, tavor_driver,
-        tavor_probe, tavor_disable );
+struct pci_driver tavor_driver __pci_driver = {
+       .type = NIC_DRIVER,
+       .name = "MT23108/MT25208",
+       .probe = tavor_probe,
+       .ids = tavor_nics,
+       .id_count = sizeof(tavor_nics) / sizeof(tavor_nics[0]),
+       .class = 0,
+};