Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
140 user(s) are online (131 user(s) are browsing Forums)

Members: 0
Guests: 140

more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 30 31 32 (33) 34 35 36 ... 75 »
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
I've also found this which I've started to read:
https://www.filibeto.org/products-n-so ... /docs/pdf/806-1379-10.pdf

That (IMO) seems to do a slightly better job of explaining things.

I have to say though that how you get from this (qemu monitor output)
Bus  0device   2, function 0:
    
VGA controllerPCI device 1002:67df
      PCI subsystem 1da2
:e387
      IRQ 9
pin A
      BAR0
64 bit prefetchable memory at 0xffffffffffffffff [0x1fffffffe].
      
BAR264 bit prefetchable memory at 0xffffffffffffffff [0x001ffffe].
      
BAR4I/O at 0xffffffffffffffff [0x00fe].
      
BAR532 bit memory at 0xffffffffffffffff [0x0003fffe].
      
id ""


To this (OpenFirmware device properties)
reg                   2:0
                      xp2
,0,10,0:200000000
                      xp2
,0,18,0:200000
                      i2
,0,20,0:100
                      m2
,0,24,0:40000
assigned
-addresses    xp2,0,18,84200000:200000
                      i2
,0,20,FE001100:100
                      m2
,0,24,84400000:40000


is still largely a complete mystery. I'm hoping that somewhere in this FCode documentation there will be some clue about decoding those entries.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@MartinW
The info you see in QEMU monitor are the values in the BARs which are encoded as reg properties in OF but the values aren't the same. Also from the output is looks like SmartFirmware allocates addresses for the BARs but does not map them, not sure this is normal and the OS shold map them later or SmartFirmware should take care of that. It does map some devices that it uses and maybe it would map the gfx card it the card rom did not crash? I don't know how this supposed to work.

As for getting the numeric values of the properties that the .properties command does not show because that uses the text representation instead I think the get-my-property word should do that but when I tried it did nothing. I think I now found out why. If you cd /pci/display and then try 'words' it shows nothing (at least with my test) so the device cannot be opened. So I've added an empty open word then got something back from get-my-property:

entering main read/eval loop...
ok " /pci/display" find-device
ok words
ok 
open true ;    if no open shows for words define empty open word for the device
ok 
" /pci/display" open-dev
ok 
.s    \ open-dev returns ihandle
STACK
:    [0x0FC59FF8264609784
ok to my
-self    \ store ihandle to my-self for my-* words
ok 
" assigned-addresses" get-my-property
ok 
.s
STACK
:    [0x000000000
    
[0x0000005080
    
[0x0FC0EBBB264301499

get-my-property is defined as
get-my-property name-str name-len -- true prop-addr prop-len false )

so the 0 on the top of stach is false (that you can test with =0 if) and the other two values are prop-addr and prop-len that should contain the numbers but don't know how to decode them.

However just for testing with one card that you know what should have you could mot care for getting/decoding and changing the values just replace them with the values that should be there and see if that makes any change in AmigaOS.

Edit: The Sun docs are quite good but talk about writing FCode drivers to be put in the card ROM which might work slightly differently as I think there are some restrictions for code compiled to FCode but maybe the parts about what to put in reg and assigned-addresses properties and how to encode them are the same.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@balaton

You look like you've gone down much the same path as me, but as you already have familiarity with the topic, you're managing more, quicker than I am. I arrived at the get-my-property seemingly not doing anything much and decided I needed to work through some Forth tutorials if I was ever going to get anywhere.

Giving my brain a rest now for tonight. If nothing else I'll know some forth at the end of this

Since I'm not entirely sure that playing about with a card that is the most powerful one supported by OS4 is the smartest idea, I did earlier buy an older, less powerful and importantly, silent card. It was only the cost of 2 beers so if I still can't make it work I don't really care.

I nearly bought a Sam460LE board. That would have been an awful lot more !!

PS: I only really looked at the Sun docs because their explanation of the address notation seemed a little less cryptic.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@balaton

Okay I checked and boot loader code gets passed three parameters. This is what amigaboot.of would pass to the loader.of. But likely what's more important is what gets passed to amigaboot.of by the firmware though it shouldn't be too different. I'll need to look again for that. It should match OF binary standards.

int _start(char *OS, struct List *KickList, int (*OFI)(void *))

So OS is a string like "AmigaOS4". KickList is a list of modules. OFI is the OF interface or hook.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Home away from home
Home away from home


See User information
@MartinW

Quote:
Bus  0device   2, function 0:
    
VGA controllerPCI device 1002:67df
      PCI subsystem 1da2
:e387
      IRQ 9
pin A
      BAR0
64 bit prefetchable memory at 0xffffffffffffffff [0x1fffffffe].
      
BAR264 bit prefetchable memory at 0xffffffffffffffff [0x001ffffe].
      
BAR4I/O at 0xffffffffffffffff [0x00fe].
      
BAR532 bit memory at 0xffffffffffffffff [0x0003fffe].
      
id ""

Those addresses are invalid, suggesting that they haven't been set.

Here's what the SM501's details look like (after booting):
Bus  0device   1, function 0:
    
Display controllerPCI device 126f:0501
      PCI subsystem 1af4
:1100
      BAR0
32 bit memory at 0x80000000 [0x83ffffff].
      
BAR132 bit memory at 0x84000000 [0x841fffff].
      
id ""

Notice how the actual address ranges are shown.

It also looks like devices that aren't used by the firmware, are only configured at boot time. Here's what the SM501 looks like before the boot command has been called:
Bus  0device   1, function 0:
    
Display controllerPCI device 126f:0501
      PCI subsystem 1af4
:1100
      BAR0
32 bit memory at 0xffffffffffffffff [0x03fffffe].
      
BAR132 bit memory at 0xffffffffffffffff [0x001ffffe].
      
id ""


This raises the question of who does the configuring?

There's another oddity. AmigaOS 4 shows BARs 0 & 1 configured for the ethernet controller, but this is what qemu's monitor shows:
Bus  0device   3, function 0:
    
Ethernet controllerPCI device 10ec:8139
      PCI subsystem 1af4
:1100
      IRQ 9
pin A
      BAR0
I/O at 0x1100 [0x11ff].
      
BAR132 bit memory at 0xffffffffffffffff [0x000000fe].
      
BAR632 bit memory at 0xffffffffffffffff [0x0003fffe].
      
id ""


It looks like the OS is only using BAR0, because the Mem enable bit isn't set in the command register. Does the monitor only show the BARs correctly for devices that have been enabled?

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Home away from home
Home away from home


See User information
@geennaam

[ScanControllerCannot handle SS == 3


Finally figured out what this is. From here, the PCI bus address configuration read by the OS is in the following format:

npt000ss bbbbbbbb dddddfff rrrrrrrr

Where:
- n NOT relocatable (0 if relocatable, 1 if fixed).
- p prefetchable (cacheable).
- t aliased (Non-Relocatable I/O), below 1 MB (Memory), or below 64 KB (relocatable I/O).
- s 2-bit address space (Configuration [00], I/O [01], 32-bit Memory [10], 64-bit Memory [11]).
- b 8-bit bus number.
- d 5-bit device number.
- f 3-bit function number.
- r 8-bit register number.

Notice the "ss" in the format string. SS = 11b (i.e., 3) means 64-bit memory. This confirms that it's the Pegasos-II AmigaOS 4 kernel that can't handle 64-bit BARs.

Is there a way to tweak the configuration tree? The OS should be able to use the BAR if the ss field was modified to 10b (i.e., 2).

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@Hans

https://wiki.laptop.org/go/Device_Tree_Hacking

Could be useful for a real Pegasos2 as well. Although it will probably not make much sense to run a HD or RX card in one of those.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
That’s what we’ve been trying to do. I’m currently at the “learning enough forth to get by” stage. I think it needs an ‘encode-phys’ in whatever syntax it needs and whatever values.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@MartinW

As far as I can tell, you can simply overwrite the existing property with a new value.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
Yes, but I don't think you can just toggle those two bits. I think you have to read phys.hi, phys.med, phy.lo for the existing value, modify phys.hi to set those two bits to 10, then re-add the 3 32bit integers using encode-phys.

*unless*, you can somehow get the address of the 32bit phys.hi and toggle the bits in-memory directly in Forth. That isn't something I'd considered. Either way, I'm a good few evenings away from having the knowledge to actually do it. Not that there's any rush!

I did mention it before but even then, I need to wait for the Radeon HD card to arrive because I don't have the drivers for the RX. I'll gladly buy them if this can be made to work, but right now I don't have them. Until I can get the 64bit bar resovled, drivers are not a concern anyway.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@MartinW

This is how i understand it as well. You cannot toggle bits but you need to overwrite with a new value.
But since nvram isn't emulated. A script doesn't make sense anyways because it will not be saved. So I was thinking of direct manipulation in this stage.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@Hans

Do you know if the VGA Bios needs to be read and loaded into memory by the Pegasos2 boot process or does OS4 do this independently.

This is another issue with the RX580 on the Pegasos2. Qemu fails to process the BIOS, it causes an error so in order to prevent that error I bypass it with romfile="". If I leave it to read the BIOS then it does display the first page of it in the properties so it's unclear if the error is an issue or not. But it might be another reason to wait for the HD5450 to arrive.

Yes, I know that's a poor card, but it's a test point.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@geennaam
Quote:
A script doesn't make sense anyways because it will not be saved. So I was thinking of direct manipulation in this stage


Well, yes and no. Ideally yes, we'd be able to store it in nvram but I've already tested having the script on the OS4 side on DH0: and you can quite happily execute the script and then at the end of the script kick off the actual boot. Or worst case scenario run two commands instead of one:

boot hd:0 fixup.forth
// If needed followed by...
boot hd:0 amigaboot.of


It's not ideal, but it would work. Script or not, right now I'm just looking at a way to hard code values for `/pci/display@2` which is of course all very specific to my board but it can be expanded from there.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Home away from home
Home away from home


See User information
@geennaam

Quote:
https://wiki.laptop.org/go/Device_Tree_Hacking

Could be useful for a real Pegasos2 as well. Although it will probably not make much sense to run a HD or RX card in one of those.

Looks promising, although some of the commands they list don't work on the Pegasos II (at least, not in qemu). The .properties command also behaves differently. Other systems display the raw hex values, whereas the Pegasos-II firmware displays what looks like a decoded version of it.

Forth scripts look rather cryptic to me, so I hope we have some Forth experts here.

Quote:
Do you know if the VGA Bios needs to be read and loaded into memory by the Pegasos2 boot process or does OS4 do this independently.

The driver can read the ROM directly from the card.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@Hypex
Yes thanks I've also found that and I think now I have everything to load the kickstart modules and start it replacing amigaboot.of. I'm currently writing a simple boot loader to test that with the goal to make it work with QEMU's virtual open firmware so that would:
- avoid needing pegasos2.rom
- avoid having to type boot command
- allow to detect more than 1GB RAM
- maybe boot faster
- and also giva us a place where we could later incorporate things like fixing up device tree, updating BIOS emulator or whatever is needed.
It will take some time to finish this so far I'm at the beginning but maybe by the time QEMU 8.1 comes out I can release something.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@Hans
Quote:
The driver can read the ROM directly from the card.


Thank you - at least that's something I don't need to be too concerned about then.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@MartinW, @geennaam
MartinW already answered that sctipt can be stored on disk so that's not a problem. Later if I finish my boot loader we could add the same there too. One could just replace the properties without reading them but would need to know the numberts to put there. SmartFirmware unhelpfully does not list the numeric values but the string representation. Both of these are documented in the OpenFirmware PCI bindings that I've cited twice above. You could manually decode the string representation shown by .properties and encode them to integers that you add with encode-phys encode-int encode+ however many times those are needed. I think each BAR has multiple numbers accordfing to #address-cells and #size-cells properties of the parent device (in this case /pci) so ot would have 3 numbers for address and 2 for size and each entry might have two addresses and one size for PCI and system address and BAR length. Calculating these numbers by hand would only work for a single card as these may be different for each cards or the values could be different based on what other cards are present and how SmartFirmware allocates BARs. So a generic script would retrieve the values and only change the bits and reencode them.
I've got to the point to retrieve the values with get-my-property as described above. The obstackle was that if there's no open method defined on /pci/display node then we need to add one first so we can open-dev it. Then we get a length and a bunch of encoded numbers so maybe you need to do a loop and run decode-int that many times as the length shows to get the numbers but not sure what's the invers of encode+ which may be needed first to split the encoded value into the encoded ints as we only get a pointer from get-my-property and encode-int would give the numeric value of that and not the numbers encoded within it with encode+. I'd need to look at that more but maybe you can find out without me.

Edit: Looks like encode+ just sticks the number to the end of the array increasing its length so I think you can back the numbers one by one with decode-int (or decide-phys when you know the next n values are a phys address) from the array returned by get-my-property. Since Forth is stack based the results will be on the top so you will need to either bring the array back to the top to get the next value (see stack manipulation in http://firmworks.com/QuickRef.html) or put the decoded ints somewhere like on the return stack (see >r r> words).


Edited by balaton on 2023/7/5 14:14:17
Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Just popping in
Just popping in


See User information
@balaton

About timings of QEMU 8.1 (official release) it's not a very important stuff, we will work on your fork so there's no need ho have any kind of stress.
You should have joined Amigans some time ago, I feel we are taking great steps forwards in few days.
..And any improvement made for QEMU could be useful also for real hardware (i.e. Pegasos 2).

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


See User information
@balaton

there's a lot to take in there. i'll have another read tonight. I didn't appreciate we had to explicitly open the device, I had incorrectly assumed that something like:

s" /pci/device@2" find-device
    
/ Do stuff
device
-end


would suffice.

Go to top
Re: What the fastest possible x64 emulation way of OS4 today ?
Quite a regular
Quite a regular


See User information
@Hans

How to write strings or hex words seems to work according to what's described on that site.

For example:

" geennaam" " name" property


Will update the property "name" with the new string value (geennaam)

ok " geennaam" " name" property
ok 
.properties
vendor
-id             0x126F (4719)
device-id             0x501 (1281)
revision-id           0x0 (0)
class-
code            0x38000 (229376)
subsystem-id          0x1AF4 (6900)
subsystem-vendor-id   0x1100 (4352)
.
vendor-name          "Sil Motion"
.class                "Display Controller"
.subclass             "Other"
devsel-speed          0x0 (0)
min-grant             0x0 (0)
max-latency           0x0 (0)
name                  "geennaam"
reg                   2:0
                      m2
,0,10,0:4000000
                      m2
,0,14,0:200000
assigned
-addresses    m2,0,10,84000000:4000000
                      m2
,0,14,80200000:200000


and writing hexadecimal values van be done like this:

ok h# 1 encode-int " max-latency" property
ok .properties
vendor
-id             0x126F (4719)
device-id             0x501 (1281)
revision-id           0x0 (0)
class-
code            0x38000 (229376)
subsystem-id          0x1AF4 (6900)
subsystem-vendor-id   0x1100 (4352)
.
vendor-name          "Sil Motion"
.class                "Display Controller"
.subclass             "Other"
devsel-speed          0x0 (0)
min-grant             0x0 (0)
max-latency           0x1 (1)
name                  "geennaam"
reg                   2:0
                      m2
,0,10,0:4000000
                      m2
,0,14,0:200000
assigned
-addresses    m2,0,10,84000000:4000000
                      m2
,0,14,80200000:200000


writing multiple 32bits words to a property goes like this:

h# 11111111 encode-int  h# 22222222 encode-int encode+  h# 33333333 encode-int encode+  " name-of-reg" property


What we only need is a raw dump of the "reg" and "assigned-addresses" properties to get their format.


Edited by geennaam on 2023/7/5 21:33:45
Go to top

  Register To Post
« 1 ... 30 31 32 (33) 34 35 36 ... 75 »

 




Currently Active Users Viewing This Thread: 3 ( 0 members and 3 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project