#Nyaux
1 messages ยท Page 42 of 1
okay its the first statement
And I have a linux PC which is always on for tftp server
print what you're giving it?
@surreal path
thats right right?
how do i get uacpi to print all methods of a node
i will also strlen
uacpi_namespace_for_each_child with depth 1 (and type mask of UACPI_OBJECT_METHOD_BIT if you want only actual methods ig, or just UACPI_OBJECT_ANY_BIT if you want all child regardless if its a property or a method)
#1236769772805554206 message
I guess
iVentoy is a new netboot solution.
It's UB if you don't return anything from a function
yea i will
still tho
uacpi_namespace_node_name
why is it a incomplete type chat
there are accessor functions you are supposed to use
oohhhh
Generate_absolute_path
Yes
that's a leak of the string returned from generate path
but ig it doesn't matter as its not permanent (hopefully)
wait what
how do i fix that
wdym leak of the string
uacpi_free_absolute_path
its a string allocated in the heap by uacpi, the full path isn't stored within the node
yeah
not that it matters for this temporary code tho
yes but might as well use the function made specifically for paths
@flat nymph this iso
taking a nap I see
I'm reading about iPXE
And how can I make it boot ISOs from a dir on my server
But I think I'll need to write a custom script or something for it to do that
I'm tired of having to rewrite my USB drive
I haven't bothered booting isos with pxe, I just put the raw files to a folder and as basically all of them use limine I just have a limine conf and some folders with files for different os's
is there no methods on ec node??
My build script generates ISO
Maybe I flashed the wrong file
you pass 0 to type_mask
which means it probably doesn't match anything
Since I'm also passing a bunch of modules
To load userspace
servers
did you change the type mask
People on random reddit post say this is doable
yes which means it doesn't match anything lol
you have to pass it what UACPI_OBJECT_*_BIT you want
there is one for actual methods for an example
or you can just pass UACPI_OBJECT_ANY_BIT to get everything
okay
which is what the ec told me to execute
Maybe I should hold the development of my AHCI driver, and instead implement the network subsystem and iSCSI or something 
Which implies USB
usb networking is piss easy
the arguably hard part here would be the network stack
and that probably isnt ev entoo hard
but it='s literally yeeting ethernet frames over a usb endpoint
so as i said it's REALLY easy
Is it universal?
and xhcci is like 500 lines of code on its own
yeah pretty much
as long as your usb nic is somewhat standard
Because why do Android boxes only support some of the nics
aka works under linux without any special setup
except with rndis you have additional headers but its still pretty easy
Like I have two USB NICs, one works on Nintendo Switch but doesn't on Xiaomi Android box, and another one is the opposite
I don't think it's just Linux stupidity
https://www.olimex.com/Products/USB-Modules/USB-GIGABIT/resources/rtl8153.pdf
The RTL8153 supports two networking configurations; ECM (Ethernet Control Model) configuration and
in-house configuration. The ECM configuration complies with CDC-ECM, and is a general Ethernet
networking model that enables network communication without installing additional vendor specific
drivers. The in-house configuration requires a vendor specific driver to support enhanced features and
optimized performance.
Nice
So I just implement USB CDC and automatically support all USB NICs?
well there is rndis which for an example a lot of slightly older phones use for usb tethering (which is basically cdc with extra headers on top)
Wait, XHCI is both USB 2.0 and 3.0? (according to chatgpt)
eee
yes xhci handles all usb
It printed a bunch of text
Your terminal is not fullscreen
well, excluding usb 4 ig but that's thunderbolt in disguise 
My laptop has that 
And I have a thunderbolt 3 laptop from 2017
for usb 4 ig the usb3 part of it is wired to xhci and the pcie part goes somewhere else?
And a thunderbolt 2 laptop
Not for public release = it gets downloaded and stashed into my osdev PDFs folder 
Give it more ram
that is the easy one
cdc ncm is easy too
what
I guess I'll just support that then
I assume you're not giving flanterm malloc
you're really going to ignore johnrussell on that? 
lol
Idk, disassemble the dump maybe its there, or maybe its your skill issue
I dont have my pc rn
yea im not
inb4 its missing because some kernel api is unimplemented
bump allocator
nooo not rlly, only functions im missing are things related to scheduling
and the evaluation for it's definition fails
can u give the dump @flat nymph
It has my Windows key
Which was expensive
bru
๐
im not gonna touch ur windows key
i jsut want the fuckin
dump about the ec
imagine buying windows keys
just transfer it from some garbage laptop
mr @kind root can u ask him very nicely for the dump
You can ask him nicely to just strip the msdm table
I had to because I wanted touchscreen
yea mishkavo do that
Idk how
Its an ASCII dump, so u can open it in e.g. Visual code and remove it
Only that?
and maybe its not even there to begin with if you bought it separately
Ye
Yeah only if it was OEM
inb4 @tawdry mirage i am a cookie
No, I had to buy laptop with OS for it to have touchscreen
Like you can't have it and no OS
(real)
ah
/j
where
In uacpi
okok
How is EC stuff going
we are getting closer
Have you managed to get events yet
yes
You can also try this
which table file can i find the ec methods
Well the handler gets called but he gets a bogus event number or something
I mean _Q09 is plausible
which one chat
dsdt
kk
use grep
Yeah
not on linux
Use WSL
doesnt exist
๐
very interesting i see
"pmOS works fine on my laptop"
is there multiple dsdts?
Dsdt is always one
nope
There are multiple ssdts tho
oh
U can look at those
I know my laptop has 12 AML blobs
Check sstds
kkk
No one knows
even if it supposed to be, doesn't mean the firmware dev put it there
@plush hearth if you're in mood for testing stuff, could you also try pmOS?
sure
Can you send an ISO
oh nvm
Yeah bogus number then
lets just have frosty test it
if its also bogus
problem with my code
if not
thats an issue to investigate
a lot happens on a lid event
ending with a panic
"failed to evaulate aml because of not found" (that is not how you spell evaluate)
๐
A lot got printed, but the last was \_SB_.PCI0.LPCB.EC0_.HWNP
no i mean
panic doesn't say
maybe if you disable the printing of node found in ec_node, name is ...
then I should be able to see it
i js did
ok
got ec event
in eccoolnes: ec status reg: 101000
in ec_querytime: ec status reg: 11000
attempting to handle ec eml
method im trying to give bro: _Q25, length is 4
failed to evaulate aml because of not found
NYAUX Panic! Reason: failed
i see
Nyaux always gets non existent numbers ๐
oh, there was some unimplemented errors from uacpi
๐ญ
show
uacpi called kernel schedule work
uacpi: unable to schedule GPE(0F) for execution: unimplemented
Thats a different type of event
attempting to execute uacpi irq method
Exactly why u should implement it
Yeah
Does pmOS work? 
haven't tried it yet
run this after pmos
I told you I'd send you an obos iso 15 hours ago, here it is:
thanks
it's 9M now because it has mlibc ๐
it just appears to freeze without printing to the screen
try power button
nice
in pmos
power button causes the laptop to turn off instantly, which means that it is not in acpi mode
Yeah
he said that "there should be a three second timeout then it shuts down"
How is pmos so skill issued with framebuffers
for every hobby os, there is a curse
my laptop is weird with its framebuffer
Nah its a theme with pmos
^
It has been broken on 3 or 4 laptops
All of which are not mine
I'm hoping it will get fixed when uDRM drops
OBOS gets stuck after printing about running as uniprocessor
shit
Intel UHD something from 2017
does print the correct CPU model name though
My intel UHD laptop died ๐ฆ
that's done through cpuid
Can you try this?
sure
when ur able to run this
For some reason, my fork isn't working on RISC-V with recent commits, because the stuff is calling exit with random error codes
Maybe it's the same problem
freezes after printing that TSC invariant bit is set
Does you PC have PIC?
idk
I'm just assuming it
??

I'll do that now
It probably doesn't
That's fun
Time has come to implement other calibration mechanisms
do you mean PIT?
because I think it doesn't
not properly anyway
maybe use HPET
or invariant TSC
I'm only using it for LAPIC calibration
didn't even close the lid, and it got an event
It's something that I wrote two years ago and didn't touch since then
probably battery related
did it panic
yes
same as before, except no uacpi complaints
Since it's a newer laptop, I think I can use LAPIC frequency MSR...
okok thats better
ill try mishkavos way of extracting the query method
Just stolen from managram 

Though it should be the same as sprintf
you completely misspelt his name...
Unless the implementation is broken
same result
damn
How do I calibrate against TSC?
here is the ACPI dump if it helps (already removed MSDM table):
same
it prints _Q25, which I have confirmed is not in the dsdt or ssdts
what's the current iso
.
need a little break from procrastinating on writing php
fair
so i'll test nyaux
๐ญ
idx 37, method num 36 from ec
interesting
Bruh Linux TSC calibration stuff is horrible
37 is 0x25, so that makes sense
seems like something happened
between that
will add another print
let me know of that log
_Q03 does not exist on my laptop
0 in eccoolness, 83 from ec, idx 37
yep
i just realized why
I PUT THE FUCKING GPE IDX
IN THE EVULATE METHOD

try now should work
that is expected, his code is failing to encode the method name
But linux only does this on atoms
_Q33 is a thing though, and it does some rtc stuff
good thing it was a simple mistake
36 from ec, idx 36, _Q24, but still fails to evaluate aml
seems to work, i pressed the brightness up key combo and it triggered the notification for it
but it works only once, no notifies happen after that
okay thats cool
i see.

should i do a renable after i handle a ec event
i think i need to
yea that makes sense
try this qookie
still stuck after one query

no
why?
lets see what is _Q8A
it's handled automatically
oh
brightness button results in a notify
oh
thats good
but its stuck after one query right
yeah
Do I trust Linux?
wait ur supposed to send an eoi to the ec???
no
but if you don't send it to the lapic
you won't get interrupts after that one
(you knew that, right?)
oh yeha
Oh god, C++
i forgot i was routing this through the ioapic into my lapic
okay _Q8A is some lid event, and it happened when i closed the lid
๐
but for some reason it did not fire the notification
try the iso\
it is weird now
it SHOULD fire now
wdym
I'll try take a photo
btw @kind root you were wondering what Notify(\_TZ_.THRM, 0x80) was, and apparently it's the temperature change notification for thermal zones
all at the same time
@tawdry mirage btw do you mind testing my kernel at some point too?
mostly to just see if the ec + power button works on qacpi, didn't it have some issues on uacpi or am I misremembering infy saying something about that?
Thermal zone-wide temperature sensor hardware that supports asynchronous temperature change notifications does so using an SCI. The AML code that responds to this SCI must execute a
Notify(thermal_zone, 0x80)statement to inform OSPM that a meaningful change in temperature has occurred. Alternatively, devices with embedded temperature sensors may signal their associated device drivers and the drivers may use an OS-specific interface to signal OSPMโs thermal policy driver. A device driver may also invoke a device specific control method that executes aNotify(thermal_zone, 0x80)statement.
power button wont work unless you wrote a driver for the amd gpio controller
test first
ah, that's kinda cursed

same thing on @flat nymph s laptop
he has a driver for it in pmos
CHAT DID I DISAPPEAR?
i'd guess its the same on most new amd laptops?
can u test ur laptop qookie
no more events show up after that mess
Idk I only have one
I think they do that because the GPIO controller can do debouncing
@kind root how can i disappear
how did i ghost the EC
left the EC on read

qacpi?
my aml interpreter written in c++
somehow nyaux gets further than obos and pmOS on my laptop
Wow, that's cool I guess
I just need to fix timer calibration shenanigans
multiple events work now, but it's still getting stuck in the lid event handler
i'd guess on a write to ec ram
explain
whats exactly happening
I think it might have got a brightness and a battery event at a similar time
But yeah nyaux is becoming stable
your code prints that it's invoking _Q8A but the notification that the aml method does never happens, and the aml looks like this ```
OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
Field (ERAM, ByteAcc, Lock, Preserve)
{
...
Offset (0x4E),
LIDE, 1,
Offset (0x52),
LIDS, 1,
...
}
...
Method (_Q8A, 0, NotSerialized) // _Qxx: EC Query, xx=0x00-0xFF
{
LIDE = Zero
Notify (LID, 0x80) // Status Change
}
so i am assuming it's stuck on LIDE = Zero
so on an ec write (or read)
the notification never happens and no events happen after it
Do you not support LAPIC timer?
haven't needed it yet
I'll write that single function whenever I get around to making a scheduler
What do you do in QEMU with no tsc invariant bit?
just no tsc
kvm timer, hpet or pit
or acpi pmtimer
But what do you use for scheduling?
I don't have a scheduler in this rewrite
Oh
why is it stuck on LIDE = zero
???
can't read/write to EC
im trying my best to make nyaux stable
what, wdym
ive installed the address space handler
is lapic timer frequency the same as invariant tsc one
it should be able
idk
I think it's not
maybe
could be tbh
At least in QEMU
it could be, but might be something else
does anyone have the slightest idea why its stuck at lide 0
put printfs at read
@tawdry mirage after it gets "stuck" with the lid close event, does it still print birghtness change events
and write
kk
it doesn't
deadlock?
it only prints your message, nothing from uacpi
are you asking me?
no i mean it could be possible
hold on ill put prints
try this
SORRY QWINCI ACCIDENTAL PING
@tawdry mirage
Makes sense
Very old uACPI bug which has been long fixed
im on the latest uacpi tho
??
I guess u aren't
no?
lol
Show your submodule git log
CD there and type git log or show
deadlock it seems
Dec 22 is far from latest
whats the latest
Git pull
I mean I would expect it to die tbh, because he evaluates callbacks right away in an irq handler without scheduling them
If they do anything non trivial he will go up in flames
what do u want me to use my scheduler or smt

What does git log say now
bru
interesting that the non-trivial thing that took it down was a write to a field in an ec opregion
make clean solves nothing
oh yeah i should update uacpi in managarm
He gets it from another irq handler then tries to go into ec code again and lock it again
So it hangs obviously
no shit read the error bruh
lol
reading with comprehension left the chat
i more meant that it's surprising that other events dont do anything non-trivial enough to hang
hold on im playing roblox
like brightness up/down
Yeah I guess firmware devs decided to go easy on nyaux
hm now i wonder if LIDE = Zero is what turns off the backlight or something
Nah I think this just updates the status so that when ospm re reads it, it will report closed lid
Just a guess
LIDE is a register in the ec ram
Interesting
LIDS is also from ec ram and is never written to in aml
Yeah who knows what that black box does lmao
Is your ecam ram literal bit values?
Usually they do bytes
there are a lot of fields with , 1,
Never seen that, cool
Is it preserve id hope?
yeah the ec ram field is Preserve
Makes sense
SMD0
System management data?
lets see where it is accessed
SMRD and SMWR methods
SMRD is called from ```
Method (GBIF, 1, NotSerialized)
{
Debug = "HP WMI Command 0x7 (BIOS Read)"
SMWR is never called
Oh yeah looks like its indeed system management stuff
Implement kernel threads, it should be <100 LoC
What else would bios read mean
i already have kernel threads
but i mean
thread blocking
how
do i need it
for uacp
upaci
uacpi*
Either system management or shadow memory
hm SMRD is also called from a method that's called from _BIX
which is battery information extended
Ye
It's very easy to do
Interesting
and if it doesn't go into the method that talks to the EC it returns static data instead: ```
Method (IVBX, 0, NotSerialized)
{
PBIX [0x02] = Ones
PBIX [0x03] = Ones
PBIX [0x05] = Ones
PBIX [0x06] = 0x19B4
PBIX [0x07] = 0x1086
PBIX [0x08] = 0x01A7
PBIX [0x09] = 0x75
PBIX [0x0A] = Ones
PBIX [0x0C] = Ones
PBIX [0x0D] = Ones
PBIX [0x10] = "Bad"
PBIX [0x11] = " "
PBIX [0x12] = "Bad"
PBIX [0x13] = "Bad"
}
do i need to cast device
or what
i have a queue
Slap a spinlock on it
yeah it calls SMRD then based on the data from that it fills in the fields
Bad bad bad bad
Thanks firmware devs
(if you're feeling adventurous, you can do lock-free stuff, but this will do)
Yes
like
That is your mutex
Yes
u mean a spinlock
hmm i still have all the crap the bios updater dumped in the efi system partition
A number protected by spinlock
okay
Does it perhaps ask the firmware to memcpy from shadow memory into that ec ram or something idk
If number++ == 0 you take the lock
If it's not, you push the thread onto the lock and schedule another one
the bios updater is pretty nice too, don't need windows to actually update, the windows program just dumps shit on the ESP and reboots into it
Nice
wdym push thread onto lock
With what you do in your timer function
Have a scheduling queue in pthread_mutex
i dont have pthread_mutex
unfortunately it's all signed so i can't just flash custom bios images
what is that
???
like what is device
why is it a handle now
its a handle
you decide what it is
in my impl for pci open I literally just malloc some memory and memcpy the address there (too lazy to do anything else)
so now i cant even get the bus device or function
I haven't gotten to implementing futexes in my kernel, but it should be something like this
pci open function has the address
oh
If you're going to RISC-V, then you have to support ecam
It's the same as on x86
Like exactly
please dont through things on me i dont understand yet
and are far off
im just trying to get by with fixing this ec driver already
๐ญ
Alternatively, call sched yield in your spinlocks
Like idk have kernel threads that run kernel code instead of user code
i already have that
ill ask about how to impl blocking in #schedulers later
Then use that to service interrupts?
This?
lets see if i can easily find the ec blob here 
struct mutex {
spinlock_t lock;
bool is_locked;
struct thread_t* blocked_queue;
};
probably something like this
Is this your firmware?
yes
Nice
(my impl is lock-free but dw about it I guess)
Steam deck has an open source ec controller but I tried reading the source and understood absolutely nothing
Where can I find it? 
Hmm it may be a fork on valves github
did you return something bad
that is lit what i do
did bro not implement pci_open_device โ ๏ธ
owrks now
bro was sad all day ๐ like me too so
this isnt even a comeback
i was also sad all day
lol
show open_device
also this image has 2 copies of everything apart from nvram
A/B partitioning but for bios updates?
how is that supposed to work
wdym
What the fucj
๐ญ
Bro like
The address variable
uacpi asks u to open...
Is given to you for a reason
guys why my ec driver no work
okay chill chill
sorry
ill try to complain less about smal lthings
i didnt notice
How do u write code that u miss stuff like that ๐
okay
Enable unused parameter warnings at least
Make warnings generate errors
-Werror
-Werror right?
Yeah
Not having gotten quite to this point yet myself, I assume this is supposed to be something along the lines of getting a handle to the PCI configuration space?
because i am sorry
Host specific handle that the host can then use to access the devices config space when asked
like i feel yall are mad at me yk
fun? wdym
Nah why would I be mad lmao
okay
I thought as much
okay this makes sense
I don't know what the segment number in the PCI address is supposed to be though.
U cant be serious
it's the pci segment number
literally
wait
it's how you address pci devices
Pci express introduced one more element to the bdf hierarchy called a segment
i just realized what i did wrong
Wait is segment number something that doesn't apply to PCIe?
ran it through strings just to see, i wonder what this is
```
Widevine - Device unique - ECDSA Key
oh NO
It does
Its part of the pcie spec
ye that's better
Thank you
thanks
no problem
fent
the ec will now personally thank you
real
I'm going to have to look up what the segment number is, then.
lmao ```
system cannot recover from this point, brick it
ran fine
?>?????
what exactly is the point of this
Yet another level to the pci address space, almost always 0 in practice
just to see if everything looks fine
you need to use ecam to address segment != 0 tho, right
pls check for an allocation failure
whats ecam
According to StackOverflow it's supposed to distinguish between PCIe controllers?
no way to address it using the funny 0xcf? io ports
EC? Used for event routing on modern hw, reading fan/battery state on older hw
A memory-mapped configuration space for PCIe
enhanced configuration access mechanism
That could be a reason to use segments, yes
how do i enable this
no i mean allocating memory to store the pci address
you get this shit from the madt
you dont enable it
it's pci config space but memory mapped
this is one of those moments where I mute the thread
Ah okay. BadgerOS doesn't support multiple PCIe segments for the time being then 
until he fixes the bug
Nah nyaux won't figure out how to store that stuff in a pointer

mcfg not madt
nonono ill make suer
yeha probably
dw
my bad
madt is APIC stuff
theres no bug lol
is that better to use than getting it from the mcfg?
A lot of kernels dont, but its not exactly hard to support
also what is that aml method located on
I'll just put it on the ever-growing TODO list :P
Tbh I don't have the quirk table from Linux to tell u, id bet some hw incorrectly reports in mcfg and other in aml
Pci bus id guess
fair
ig if you're finding root buses via aml you might as well run _CBA on it
yeah
AML only reports the root busses, which is basically the same thing as a separate controller
or you could just say you CBA to do it
once I get around to doing my device stuff I will just enumerate everything from acpi downwards
lmao
good idea
i wanna do that but
Id be interested to see which one is preferred by Linux
kernel not advanced enough
people wouldn't be helping you
understandable
this thread has ~41800 messages
sad, no one took note of the can't be arsed joke
@plush hearth
Id trust CBA more because itโs more likely to be retrieved dynamically whereas mcfg is a hardcoded table
i did
i need u to test this iso
alright
oh
troll face emoji
Where
u replied to it
.
lmao
Fair
But you need ecam for RISC-V anyway (?)
At least I had to implement it
It will still be segment 0 so
ECAM is not a RISC-V specific thing.
It's a PCIe thing.
pressing brightness button results in a notify, but then a ec event appears imediately after, and can't be handled
BadgerOS will boot fine without PCIe but it won't be able to detect any PCIe devices
.
wdym cant be handled
I'll take a photo
ECAM is just a way to access the PCI configuration space
apparently present on other platforms than x86
Yeah I dont think its even pcie specific
Yes, but if you're supporting it then adding multiple segments should be very easy anyway
i guess you've got the system io thing and ECAM on x86
Yeah it works the same on RISC-V
that's nice
And RISC-V doesn't have system IO and you've got to use ECAM
i wonder what you need to do on aarch64
@kind root do i run uacpi under a seperate thread?
And aarch64 has some cursed thing?
if you know what you're doing
(don't)
I know but there's more important things to add to the kernel than multiple segments. Like a SATA driver. Or TTYs and pipes. Or displays. Or USB and USB device drivers.
oh do i run it in kentry
Only the work queues
hold on
okay
Is that spectre x360?
no
Doesn't matter
wdym doesnt matter
Depends on the controller, some do ecam, some do other mmio mechanisms
because system io works just fine
so i dont need to do ecam for the moment at least? \
U dont need it at all
If what you have works no
hp pavilion x360 convertible 14 inch
then you will need to add it
yea
Or port to other architectures
So almost the same thing
but i like having ecam support just because it's mmio
I had spectre x360 but it died ๐ฆ
In a beautiful black/gold color
Head turning
After 6 years
aarch64 has either just ecam, or some custom method depending on the pcie controller driver, or some firmware interface similar to psci where you just give it the pci device address and register and it does the io for you
and the touchscreen is being weird a lot
I replaced mine, and I think it killed the charger controller
I'll need to replace mine sometime in the new year
With "hp original battery" from ebay, which was definetely not original
Sad
It was a nice laptop
What are your thoughts on psci
ah so either ecam or some proprietary shit you need to write drivers for, nice
it's nice
Thats aarch64 for u
okay then so first lets bring uacpi into the kentry kthread
Its skewed towards the latter tho
unlucky
depends on the class of hardware you look at ig
Are you supposed to run interrupts in irq threads?
I don't know how monolithic kernels do that typically
higher end workstation/server stuff has mostly compliant stuff (mainly ig because they want to support windows), but the sbcs are kinda cancerous
not all but some at least
They either do DPCs or bottom halves
No one runs any work in the actual handler
I think theres a kernel that does a lot of irq thread stuff
Thank god windows refuses to support crappy hardware without acpi or compliant stuff
SiFive, in their inifinite wisdom, has opted to use a proprietary PCIe controller for their unmatched board, which means that I have to have a whole second driver that does nothing other than parse the DTB slightly differently 
technically you can hack around the nonstandard pcie controllers with acpi to make it work with mcfg
Dtb is stored in pcie somehow?
No
The DTB is differently formatted
Because there is more nonstandard extra shit in it
Why did they do that
Good question
Like

