Subversion Repositories Kolibri OS

Rev

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

Rev 1867 Rev 2187
Line 88... Line 88...
88
static void create_dm_list();
88
static void create_dm_list();
Line 89... Line 89...
89
 
89
 
Line -... Line 90...
-
 
90
static void print_dm_list();
-
 
91
 
Line 90... Line 92...
90
static void print_dm_list();
92
int write_device_dat(char *path);
91
 
93
 
92
 
94
 
93
static void set_pic_mode(enum pic_mode mode)
95
static void set_pic_mode(enum pic_mode mode)
Line 111... Line 113...
111
}
113
}
112
 
114
 
Line 113... Line -...
113
 
-
 
114
 
-
 
115
 
-
 
116
 
-
 
117
 
115
 
Line 118... Line 116...
118
 
116
 
Line 261... Line 259...
261
    struct resource *res;
259
    struct resource *res;
262
    struct acpi_resource_address64 addr;
260
    struct acpi_resource_address64 addr;
263
    ACPI_STATUS status;
261
    ACPI_STATUS status;
264
    unsigned long flags;
262
    unsigned long flags;
265
    struct resource *root, *conflict;
263
    u64 start, end;
266
    u64 start, end;
-
 
267
 
264
 
Line 268... Line 265...
268
    status = resource_to_addr(acpi_res, &addr);
265
    status = resource_to_addr(acpi_res, &addr);
269
    if (!ACPI_SUCCESS(status))
266
    if (!ACPI_SUCCESS(status))
270
        return AE_OK;
267
        return AE_OK;
Line 271... Line 268...
271
 
268
 
272
    if (addr.ResourceType == ACPI_MEMORY_RANGE)
269
    if (addr.ResourceType == ACPI_MEMORY_RANGE)
273
    {
-
 
274
        root = &iomem_resource;
270
    {
275
        flags = IORESOURCE_MEM;
271
        flags = IORESOURCE_MEM;
276
        if (addr.Info.Mem.Caching == ACPI_PREFETCHABLE_MEMORY)
272
        if (addr.Info.Mem.Caching == ACPI_PREFETCHABLE_MEMORY)
277
            flags |= IORESOURCE_PREFETCH;
273
            flags |= IORESOURCE_PREFETCH;
278
    }
274
    }
279
    else if (addr.ResourceType == ACPI_IO_RANGE)
275
    else if (addr.ResourceType == ACPI_IO_RANGE)
280
    {
-
 
281
        root = &ioport_resource;
276
    {
282
        flags = IORESOURCE_IO;
277
        flags = IORESOURCE_IO;
283
    } else
278
    } else
Line 284... Line 279...
284
        return AE_OK;
279
        return AE_OK;
Line 297... Line 292...
297
        printk("host bridge window %pR (ignored)\n", res);
292
        printk("host bridge window %pR (ignored)\n", res);
298
        return AE_OK;
293
        return AE_OK;
299
    }
294
    }
300
 
295
 
Line 301... Line -...
301
#if 0
-
 
302
    conflict = insert_resource_conflict(root, res);
-
 
303
    if (conflict) {
-
 
304
        dev_err(&info->bridge->dev,
-
 
305
            "address space collision: host bridge window %pR "
-
 
306
            "conflicts with %s %pR\n",
-
 
307
            res, conflict->name, conflict);
-
 
308
    } else {
-
 
309
        pci_bus_add_resource(info->bus, res, 0);
-
 
310
        info->res_num++;
296
    info->res_num++;
311
        if (addr.translation_offset)
297
    if (addr.TranslationOffset)
312
            dev_info(&info->bridge->dev, "host bridge window %pR "
298
        dev_info(NULL, "host bridge window %pR "
313
                 "(PCI address [%#llx-%#llx])\n",
299
             "(PCI address [%#llx-%#llx])\n",
314
                 res, res->start - addr.translation_offset,
300
             res, res->start - addr.TranslationOffset,
315
                 res->end - addr.translation_offset);
301
             res->end - addr.TranslationOffset);
316
        else
302
    else
317
            dev_info(&info->bridge->dev,
303
        dev_info(NULL,
318
                 "host bridge window %pR\n", res);
304
             "host bridge window %pR\n", res);
319
    }
305
 
320
    return AE_OK;
306
    return AE_OK;
321
#endif
-
 
322
}
307
}
Line 323... Line 308...
323
 
308
 
Line 366... Line 351...
366
    return;
351
    return;
367
}
352
}
368
 
353
 
Line 369... Line -...
369
 
-
 
370
 
-
 
371
 
354
 
372
struct pci_ops pci_root_ops = {
355
struct pci_ops pci_root_ops = {
373
    .read = NULL,
356
    .read = NULL,
374
    .write = NULL,
357
    .write = NULL,
Line 390... Line 373...
390
               domain, busnum);
373
               domain, busnum);
391
        return NULL;
374
        return NULL;
392
    }
375
    }
393
 
376
 
Line -... Line 377...
-
 
377
	node = -1;
394
    /* Allocate per-root-bus (not per bus) arch-specific data.
378
    /* Allocate per-root-bus (not per bus) arch-specific data.
395
     * TODO: leak; this memory is never freed.
379
     * TODO: leak; this memory is never freed.
396
     * It's arguable whether it's worth the trouble to care.
380
     * It's arguable whether it's worth the trouble to care.
397
     */
381
     */
398
    sd = kzalloc(sizeof(*sd), GFP_KERNEL);
382
    sd = kzalloc(sizeof(*sd), GFP_KERNEL);
Line 630... Line 614...
630
    }
614
    }
631
 
615
 
Line 632... Line 616...
632
//    u32_t mode = ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE;
616
//    u32_t mode = ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE;
Line 633... Line 617...
633
 
617
 
634
    status = AcpiEnableSubsystem(0);
618
    status = AcpiEnableSubsystem(ACPI_NO_HANDLER_INIT | ACPI_NO_HARDWARE_INIT);
635
    if (status != AE_OK) {
619
    if (status != AE_OK) {
636
        dbgprintf("AcpiEnableSubsystem failed (%s)\n",
620
        dbgprintf("AcpiEnableSubsystem failed (%s)\n",
637
            AcpiFormatException(status));
621
            AcpiFormatException(status));
638
        goto err;
622
        goto err;
Line 639... Line 623...
639
    }
623
    }
640
 
624
 
641
    status = AcpiInitializeObjects (0);
625
    status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION);
642
    if (ACPI_FAILURE (status))
626
    if (ACPI_FAILURE (status))
643
    {
627
    {
644
        dbgprintf("AcpiInitializeObjects failed (%s)\n",
628
        dbgprintf("AcpiInitializeObjects failed (%s)\n",
Line 658... Line 642...
658
    create_dm_list();
642
    create_dm_list();
Line 659... Line 643...
659
 
643
 
Line -... Line 644...
-
 
644
    print_dm_list();
-
 
645
 
660
    print_dm_list();
646
    write_device_dat("/RD/1/DRIVERS/DEVICES.DAT");
Line 661... Line 647...
661
 
647
 
Line 662... Line 648...
662
err:
648
err:
Line 919... Line 905...
919
    };
905
    };
920
};
906
};
921
907
 
Line -... Line 908...
-
 
908
 
-
 
909
typedef struct
-
 
910
{
-
 
911
    uint32_t  busaddr;
-
 
912
    uint32_t  devid;
-
 
913
    uint32_t  irq;
-
 
914
    uint32_t  unused;
-
 
915
}devinfo_t;
-
 
916
 
-
 
917
#pragma pack(push, 1)
-
 
918
typedef struct
-
 
919
{
-
 
920
  char sec;
-
 
921
  char min;
-
 
922
  char hour;
-
 
923
  char rsv;
-
 
924
}detime_t;
-
 
925
 
-
 
926
typedef struct
-
 
927
{
-
 
928
  char  day;
-
 
929
  char  month;
-
 
930
  short year;
-
 
931
}dedate_t;
-
 
932
 
-
 
933
typedef struct
-
 
934
{
-
 
935
  unsigned    attr;
-
 
936
  unsigned    flags;
-
 
937
  union
-
 
938
  {
-
 
939
     detime_t  ctime;
-
 
940
     unsigned  cr_time;
-
 
941
  };
-
 
942
  union
-
 
943
  {
-
 
944
     dedate_t  cdate;
-
 
945
     unsigned  cr_date;
-
 
946
  };
-
 
947
  union
-
 
948
  {
-
 
949
     detime_t  atime;
-
 
950
     unsigned  acc_time;
-
 
951
  };
-
 
952
  union
-
 
953
  {
-
 
954
     dedate_t  adate;
-
 
955
     unsigned  acc_date;
-
 
956
  };
-
 
957
  union
-
 
958
  {
-
 
959
     detime_t  mtime;
-
 
960
     unsigned  mod_time;
-
 
961
  };
-
 
962
  union
-
 
963
  {
-
 
964
     dedate_t  mdate;
-
 
965
     unsigned  mod_date;
-
 
966
  };
-
 
967
  unsigned    size;
-
 
968
  unsigned    size_high;
-
 
969
} FILEINFO;
-
 
970
 
-
 
971
#pragma pack(pop)
-
 
972
 
-
 
973
 
-
 
974
int write_device_dat(char *path)
-
 
975
{
-
 
976
    struct pci_dev   *pcidev;
-
 
977
    dmdev_t          *dmdev;
-
 
978
    devinfo_t        *data;
-
 
979
    int               writes;
-
 
980
    int               len;
-
 
981
    int i = 0;
-
 
982
 
-
 
983
    list_for_each_entry(dmdev, &dmdev_tree, list)
-
 
984
    {
-
 
985
        if(dmdev->type ==1)
-
 
986
        {
-
 
987
            if(dmdev->pci_dev != NULL)
-
 
988
            {
-
 
989
                pcidev = dmdev->pci_dev;
-
 
990
                if(pcidev->pin)
-
 
991
                    i++;
-
 
992
            };
-
 
993
        };
-
 
994
    };
-
 
995
 
-
 
996
    len = sizeof(devinfo_t)*i + 4;
-
 
997
    data = (devinfo_t*)malloc(len);
-
 
998
 
-
 
999
    i = 0;
-
 
1000
 
-
 
1001
    list_for_each_entry(dmdev, &dmdev_tree, list)
-
 
1002
    {
-
 
1003
        if(dmdev->type == 1)
-
 
1004
        {
-
 
1005
 
-
 
1006
            if(dmdev->pci_dev != NULL)
-
 
1007
            {
-
 
1008
                pcidev = dmdev->pci_dev;
-
 
1009
                if(pcidev->pin && (acpi_get_irq(pcidev) != -1) )
-
 
1010
                {
-
 
1011
                    data[i].busaddr = (pcidev->busnr<<8)|pcidev->devfn;
-
 
1012
                    data[i].devid   = ((uint32_t)pcidev->device<<16) |
-
 
1013
                                       pcidev->vendor;
-
 
1014
                    data[i].irq     =  acpi_get_irq(pcidev);
-
 
1015
                    data[i].unused  =  0;
-
 
1016
                    i++;
-
 
1017
                }
-
 
1018
            };
-
 
1019
        };
-
 
1020
    };
-
 
1021
 
-
 
1022
    data[i].busaddr = -1;
-
 
1023
 
-
 
1024
    FILEINFO info;
-
 
1025
 
-
 
1026
    int offset = 0;
-
 
1027
 
-
 
1028
    if(get_fileinfo(path,&info))
-
 
1029
    {
-
 
1030
        if( create_file(path))
-
 
1031
        {
-
 
1032
            free(data);
-
 
1033
            return false;
-
 
1034
        }
-
 
1035
    }
-
 
1036
    else
-
 
1037
        set_file_size(path, 0);
-
 
1038
 
-
 
1039
    write_file(path, data, 0, len, &writes);
-
 
1040
 
-
 
1041
    return true;