Changeset 7e9e652 in mainline for uspace/drv/bus/isa/isa.c


Ignore:
Timestamp:
2016-12-17T09:37:08Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0195374
Parents:
3c5b86c
Message:

Detect the default ISA bridge by its PCI class and subclass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    r3c5b86c r7e9e652  
    7878typedef struct {
    7979        fibril_mutex_t mutex;
    80         uint16_t vendor_id;
    81         uint16_t device_id;
     80        uint16_t pci_vendor_id;
     81        uint16_t pci_device_id;
     82        uint8_t pci_class;
     83        uint8_t pci_subclass;
    8284        ddf_dev_t *dev;
    8385        ddf_fun_t *fctl;
     
    598600static void isa_functions_add(isa_bus_t *isa)
    599601{
     602#define BASE_CLASS_BRIDGE       0x06
     603#define SUB_CLASS_BRIDGE_ISA    0x01
     604        bool isa_bridge = ((isa->pci_class == BASE_CLASS_BRIDGE) &&
     605            (isa->pci_subclass == SUB_CLASS_BRIDGE_ISA));
     606
    600607#define VENDOR_ID_SUN   0x108e
    601608#define DEVICE_ID_EBUS  0x1000
    602         bool ebus = ((isa->vendor_id == VENDOR_ID_SUN) &&
    603             (isa->device_id == DEVICE_ID_EBUS));
    604 
    605         const char *conf_path;
    606         if (ebus)
    607                 conf_path = EBUS_CHILD_FUN_CONF_PATH;
    608         else
     609        bool ebus = ((isa->pci_vendor_id == VENDOR_ID_SUN) &&
     610            (isa->pci_device_id == DEVICE_ID_EBUS));
     611
     612        const char *conf_path = NULL;
     613        if (isa_bridge)
    609614                conf_path = ISA_CHILD_FUN_CONF_PATH;
     615        else if (ebus)
     616                conf_path = EBUS_CHILD_FUN_CONF_PATH;
    610617
    611618        char *conf = fun_conf_read(conf_path);
     
    639646        }
    640647
    641         rc = pci_config_space_read_16(sess, PCI_VENDOR_ID, &isa->vendor_id);
     648        rc = pci_config_space_read_16(sess, PCI_VENDOR_ID, &isa->pci_vendor_id);
    642649        if (rc != EOK)
    643650                return rc;
    644         rc = pci_config_space_read_16(sess, PCI_DEVICE_ID, &isa->device_id);
     651        rc = pci_config_space_read_16(sess, PCI_DEVICE_ID, &isa->pci_device_id);
     652        if (rc != EOK)
     653                return rc;
     654        rc = pci_config_space_read_8(sess, PCI_BASE_CLASS, &isa->pci_class);
     655        if (rc != EOK)
     656                return rc;
     657        rc = pci_config_space_read_8(sess, PCI_SUB_CLASS, &isa->pci_subclass);
    645658        if (rc != EOK)
    646659                return rc;
Note: See TracChangeset for help on using the changeset viewer.