Re: Acpi experimental

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.bugs
Organization I am not organized
Message-ID <afu2sd0PHmMluNja@end>
Hello,

ifuckprotonineedgnuemail, le mer. 06 mai 2026 16:37:02 +0000, a ecrit:
> void *
> acpi_os_map_memory(uintptr_t phys, size_t size)
> {
>     int fd = open("/dev/mem", O_RDONLY);
>     if (fd < 0) return MAP_FAILED;
>     
>     uintptr_t page_base = phys & ~((uintptr_t)4095);
>     uintptr_t offset = phys - page_base;
>     
>     void *mapped = mmap(NULL, size + offset, PROT_READ, MAP_SHARED, fd, page_base);
>     close(fd);
>     
>     if (mapped == MAP_FAILED) return MAP_FAILED;
>     return (void *)((uintptr_t)mapped + offset);
> }
> 
> void
> acpi_os_unmap_memory(void *virt, size_t size)
> {
>     if (virt && virt != MAP_FAILED) {
>         uintptr_t page_base = (uintptr_t)virt & ~((uintptr_t)4095);
>         uintptr_t offset = (uintptr_t)virt - page_base;
>         munmap((void *)page_base, size + offset);
>     }
> }

Why reimplementing these? They are already available in libacpica.

> int
> acpi_get_thermal_data(struct acpi_thermal_zone *zone)
> {
>   struct acpi_table *tables = NULL;
>   size_t ntables = 0;
>   int err;
> 
>   err = acpi_get_num_tables(&ntables);
>   if (err || ntables == 0) return err ? err : ENODEV;
> 
>   err = acpi_get_tables(&tables);
>   if (err) return err;
> 
>   int found = 0;
>   for (size_t i = 0; i < ntables; i++)
>     {
>       if (memcmp(tables[i].h.signature, "DSDT", 4) == 0)
>         {
>           strncpy(zone->name, "TZ01", 5);
>          /* Return the temperature in deci-Kelvin (1/10th of a Kelvin),
>    as defined by the ACPI specification for thermal zones. */
>           zone->temperature = 3000; 
>                 found = 1;
>                 break; 
>         }
>     }
> 
>   for (size_t i = 0; i < ntables; i++)
>     free(tables[i].data);
>   free(tables);
> 
>   return found ? 0 : ENODEV;
> }

So that's the real new code. But I don't understand what it is doing?

Isn't the temperature rather provided by the machine's acpi, and not
fabricated by the acpi software layer? And is the information not
already available somewhere in /servers/acpi/tables for procfs to pick
it up?

Samuel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.