pmac icon indicating copy to clipboard operation
pmac copied to clipboard

PowerPMAC driver suggested improvements

Open ajgdls opened this issue 2 years ago • 2 comments

This PR is suggested updates to the PowerPMAC driver to remove magic numbers, and to improve the memory allocation for the large character arrays. The arrays have been assigned memory via malloc rather than allocated on the stack, to allow larger arrays, and to avoid the constant reallocation of the same arrays every time a write/read is called. The low level driver is already NOT thread safe and so allocating the memory in this way does not alter this, but the mechanism can be discussed.

I recommend testing these changes extensively (with the largest use case we have) to ensure robustness.

ajgdls avatar Oct 11 '23 14:10 ajgdls

To keep track of discussion made via email, regarding PPMAC_MAX_CHAR_LENGTH

On the PowerBrick (firmware 2.7.1), I have made a quick test doing an ssh and trying to send as many characters as possible into P-variables.

Something like: P(0)=1000000000,1000000001,1000000002...100000000323,... and so on

When I checked the P(323), I only got P323=1 instead of P323=100000000323

From the P324, all have the value 0.

Therefore the number of characters properly assigned was 4095 and no error was raised, different from what the release notes specify. It was a very simple test, so I wouldn't be too confident about its result, but it might give us some idea about the limitation.

LeandroMartinsdS avatar Aug 07 '24 15:08 LeandroMartinsdS

@huw-dls, have you ever had the chance of testing these changes?

LeandroMartinsdS avatar Aug 12 '25 08:08 LeandroMartinsdS