Ticket #6164: 0002-Fix-device-type-check.patch

File 0002-Fix-device-type-check.patch, 1.6 KB (added by andreasf, 10 years ago)

proposed patch: fix PIC device type check

  • src/system/kernel/arch/ppc/arch_int.cpp

    From 1efece2e27b5ff87c9fe6a9c1d447d9808addf62 Mon Sep 17 00:00:00 2001
    From: Andreas Faerber <andreas.faerber@web.de>
    Date: Sun, 13 Jun 2010 01:55:12 +0200
    Subject: [PATCH 2/2] Fix device type check
    
    B_DEVICE_TYPE is a 16-bit numeric ID.
    ---
     src/system/kernel/arch/ppc/arch_int.cpp |   18 ++++++++----------
     1 files changed, 8 insertions(+), 10 deletions(-)
    
    diff --git a/src/system/kernel/arch/ppc/arch_int.cpp b/src/system/kernel/arch/ppc/arch_int.cpp
    index 8de2fb0..456d003 100644
    a b  
    2626#include <vm/vm.h>
    2727#include <vm/vm_priv.h>
    2828#include <vm/VMAddressSpace.h>
     29#include <PCI.h>
    2930
    3031#include <string.h>
    3132
    arch_int_init_post_device_manager(struct kernel_args *args)  
    511512    // iterate through the tree again and get an interrupt controller node
    512513    iterator.Rewind();
    513514    while (device_node *node = iterator.Next()) {
    514         const char *deviceType;
    515         if (deviceManager->get_attr_string(node, B_DEVICE_TYPE,
    516                 &deviceType, false) == B_OK) {
    517             bool isPIC = false;
    518 
    519             /*
    520             bool isPIC
    521                 = (strcmp(deviceType, B_INTERRUPT_CONTROLLER_DRIVER_TYPE) == 0);
    522             free(deviceType);
    523             */
     515        uint16 pciBaseClass, pciSubType;
     516        if (deviceManager->get_attr_uint16(node, B_DEVICE_TYPE,
     517                &pciBaseClass, false) == B_OK &&
     518            deviceManager->get_attr_uint16(node, B_DEVICE_SUB_TYPE,
     519                &pciSubType, false) == B_OK) {
     520            bool isPIC = (pciBaseClass == PCI_base_peripheral)
     521                && (pciSubType == PCI_pic);
    524522
    525523            if (isPIC) {
    526524                driver_module_info *driver;