Subversion Repositories Kolibri OS

Rev

Rev 1627 | Rev 1633 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1627 Rev 1628
Line 108... Line 108...
108
    };
108
    };
109
};
109
};
110
 
110
 
Line 111... Line -...
111
 
-
 
112
/*
-
 
113
int acpi_pci_bind_root(struct acpi_device *device)
-
 
114
{
-
 
115
    device->ops.bind = acpi_pci_bind;
-
 
Line 116... Line -...
116
    device->ops.unbind = acpi_pci_unbind;
-
 
117
 
-
 
118
    return 0;
-
 
Line 119... Line 111...
119
}
111
 
Line 120... Line 112...
120
*/
112
 
Line 121... Line -...
121
 
-
 
122
static bool pci_use_crs = false;
-
 
123
 
-
 
124
#define IORESOURCE_BUS      0x00001000
-
 
125
 
-
 
126
struct acpi_pci_root {
-
 
127
    struct list_head node;
-
 
128
    struct acpi_device * device;
-
 
129
    struct acpi_pci_id id;
-
 
Line 130... Line 113...
130
    struct pci_bus *bus;
113
 
Line 131... Line 114...
131
    u16 segment;
114
static bool pci_use_crs = false;
132
    struct resource secondary;      /* downstream bus range */
115
 
Line 177... Line 160...
177
    return AE_OK;
160
    return AE_OK;
178
}
161
}
179
 
162
 
Line -... Line 163...
-
 
163
 
-
 
164
static void acpi_pci_bridge_scan(struct acpi_device *device)
-
 
165
{
-
 
166
    int status;
-
 
167
    struct acpi_device *child = NULL;
-
 
168
 
-
 
169
    if (device->flags.bus_address)
-
 
170
        if (device->parent && device->parent->ops.bind) {
-
 
171
            status = device->parent->ops.bind(device);
-
 
172
            if (!status) {
-
 
173
                list_for_each_entry(child, &device->children, node)
-
 
174
                    acpi_pci_bridge_scan(child);
-
 
175
            }
-
 
176
        }
-
 
177
}
-
 
178
 
-
 
179
 
180
 
180
 
181
struct pci_root_info
181
struct pci_root_info
182
{
182
{
183
    struct acpi_device *bridge;
183
    struct acpi_device *bridge;
184
    char *name;
184
    char *name;
Line 414... Line 414...
414
    } else {
414
    } else {
415
        bus = pci_create_bus(busnum, &pci_root_ops, sd);
415
        bus = pci_create_bus(busnum, &pci_root_ops, sd);
416
        if (bus) {
416
        if (bus) {
417
            get_current_resources(device, busnum, domain, bus);
417
            get_current_resources(device, busnum, domain, bus);
418
//            bus->subordinate = pci_scan_child_bus(bus);
418
            bus->subordinate = pci_scan_child_bus(bus);
419
        }
419
        }
420
    }
420
    }
421
 
421
 
Line 422... Line 422...
422
    if (!bus)
422
    if (!bus)
423
        kfree(sd);
423
        kfree(sd);
Line 526... Line 526...
526
     * Attach ACPI-PCI Context
526
     * Attach ACPI-PCI Context
527
     * -----------------------
527
     * -----------------------
528
     * Thus binding the ACPI and PCI devices.
528
     * Thus binding the ACPI and PCI devices.
529
     */
529
     */
530
//    result = acpi_pci_bind_root(device);
530
    result = acpi_pci_bind_root(device);
531
//    if (result)
531
    if (result)
532
//        goto end;
532
        goto end;
533
 
533
 
Line 534... Line 534...
534
    /*
534
    /*
535
     * PCI Routing Table
535
     * PCI Routing Table
536
     * -----------------
536
     * -----------------
537
     * Evaluate and parse _PRT, if exists.
537
     * Evaluate and parse _PRT, if exists.
Line 542... Line 542...
542
 
542
 
Line 543... Line 543...
543
    /*
543
    /*
544
     * Scan and bind all _ADR-Based Devices
544
     * Scan and bind all _ADR-Based Devices
545
     */
545
     */
546
//    list_for_each_entry(child, &device->children, node)
546
    list_for_each_entry(child, &device->children, node)
547
//        acpi_pci_bridge_scan(child);
547
        acpi_pci_bridge_scan(child);
Line 548... Line 548...
548
 
548
 
Line 549... Line 549...
549
    return 0;
549
    return 0;
550
 
550
 
Line 760... Line 760...
760
 
760
 
Line 761... Line 761...
761
};
761
};
Line 762... Line 762...
762
 
762
 
763
#if 0
-
 
764
    scan_devices();
-
 
765
 
-
 
766
    {
-
 
767
        bool retval = false;
-
 
768
        u32_t bus, last_bus;
-
 
769
 
-
 
770
        if( (last_bus = PciApi(1))==-1)
-
 
771
            return retval;
-
 
772
 
-
 
773
        dbgprintf("last bus %x\n", last_bus);
-
 
774
 
-
 
775
        for(bus=0; bus <= last_bus; bus++)
-
 
776
        {
-
 
777
            u32_t dev;
-
 
778
 
-
 
779
            for(dev = 0; dev < 32; dev++)
-
 
780
            {
-
 
781
                u32_t fn;
-
 
782
 
-
 
783
                for(fn = 0; fn < 8; fn++)
-
 
784
                {
-
 
785
 
-
 
786
                    u32_t id;
-
 
787
                    u32_t irq_bios, irq_acpi;
-
 
788
                    u32_t irq_pin;
-
 
789
                    u16_t pcicmd;
-
 
790
                    u32_t tmp;
-
 
791
 
-
 
792
                    u32_t devfn = (dev<<3 )|fn;
-
 
793
 
-
 
794
                    id = PciRead32(bus,devfn, PCI_VENDOR_ID);
-
 
795
 
-
 
796
    /* some broken boards return 0 or ~0 if a slot is empty: */
-
 
797
                if (id == 0xffffffff || id == 0x00000000 ||
-
 
798
                    id == 0x0000ffff || id == 0xffff0000)
-
 
799
                    continue;
-
 
800
 
-
 
801
                pcicmd = PciRead16(bus,devfn, PCI_COMMAND);
-
 
802
                if (! pcicmd & PCI_COMMAND_IO)
-
 
803
                    continue;
-
 
804
 
-
 
805
                tmp = PciRead32(bus,devfn, 0x3C);
-
 
806
 
-
 
807
                irq_bios = tmp & 0xFF;
-
 
808
                irq_pin  = (tmp >> 8) & 0xFF;
-
 
809
 
-
 
810
                int slot = (fn >> 3) & 0x1f;
-
 
811
 
-
 
812
                irq_acpi = irqtable[ dev * PCI_MAX_PINS +(irq_pin-1) ];
-
 
813
 
-
 
814
                if( irq_acpi < 0)
-
 
815
                    dbgprintf("PCI: no ACPI IRQ routing for "
-
 
816
                    "device %d.%d.%d INT%c\n",bus,dev,fn,'A'+irq_pin-1);
-
 
817
 
-
 
818
                dbgprintf("pci device %x_%x bus %d dev %d fn %d,"
-
 
819
                          "IRQ PIN %d BIOS IRQ %d ACPI IRQ %d\n",
-
 
820
                          id & 0xFFFF, id>>16, bus, dev, fn, irq_pin, irq_bios, irq_acpi);
-
 
821
                };
-
 
822
            }
-
 
823
        };
-
 
824
    };
-
 
825
#endif
-
 
826
 
-
 
827
 
-
 
Line 828... Line 763...
828
#if 0
763
#if 0
829
 
764
 
830
ACPI_STATUS
765
ACPI_STATUS
831
get_device_by_hid_callback(ACPI_HANDLE obj, u32_t depth, void* context,
766
get_device_by_hid_callback(ACPI_HANDLE obj, u32_t depth, void* context,