Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #include <ddk.h>
  3. #include <syscall.h>
  4. #include "acpi.h"
  5.  
  6. acpi_rsdp_t* acpi_locate();
  7.  
  8. acpi_rsdp_t* acpi_rsdp;
  9. acpi_rsdt_t* acpi_rsdt;
  10. acpi_madt_t* acpi_madt;
  11.  
  12. addr_t acpi_rsdt_base;
  13. addr_t acpi_madt_base;
  14. addr_t acpi_lapic_base;
  15. addr_t acpi_ioapic_base;
  16.  
  17. addr_t __fastcall rsdt_find(acpi_rsdt_t *rsdt, u32_t sig);
  18.  
  19. u32_t drvEntry(int action, char *cmdline)
  20. {
  21.     u32_t ret;
  22.  
  23.     if(action != 1)
  24.         return 0;
  25.  
  26.     if( !dbg_open("/rd/1/drivers/acpi.log") )
  27.     {
  28.         printf("Can't open /rd/1/drivers/acpi.log\nExit\n");
  29.         return 0;
  30.     }
  31.  
  32.     acpi_rsdp = acpi_locate();
  33.  
  34.     if (unlikely(acpi_rsdp == NULL))
  35.     {
  36.         dbgprintf("No ACPI RSD table\n");
  37.         return 0;
  38.     };
  39.  
  40.     dbgprintf("rsd base address %x\n", acpi_rsdp);
  41.  
  42.     acpi_rsdt_base = acpi_rsdp->rsdt_ptr;
  43.     acpi_rsdt = (acpi_rsdt_t*)(MapIoMem(acpi_rsdt_base,0x10000,5));
  44.  
  45.     dbgprintf("rsdt base 0x%x, kernel 0x%x\n", acpi_rsdt_base, acpi_rsdt);
  46.  
  47.     if (unlikely(acpi_rsdt == NULL))
  48.     {
  49.         dbgprintf("Invalid ACPI RSD table\n");
  50.         return 0;
  51.     };
  52.  
  53. //    print_rsdt(acpi_rsdt);
  54.  
  55.     acpi_madt_base = rsdt_find(acpi_rsdt, ACPI_MADT_SIGN);
  56.  
  57.     if( unlikely(acpi_madt_base == 0) )
  58.     {
  59.         dbgprintf("No ACPI MAD Table\n");
  60.         return 0;
  61.     };
  62.  
  63.     acpi_madt =(acpi_madt_t*)acpi_remap_table(acpi_madt_base);
  64.  
  65.     dbgprintf("madt base 0x%x, kernel 0x%x\n", acpi_madt_base, acpi_madt);
  66.  
  67. //    print_madt(acpi_madt);
  68.  
  69.     return 0;
  70. };
  71.  
  72.