We have an internal system for allocating hardware to developers on a short term basis. While the software does have a web API, it is not enabled by default, nor in our deployment. Thus, we end up caching a local copy of the data about the machine. The machine names are a glom of architecture, and location. So I make a file with the name of the machine, and a symlink to the one I am currently using.
Continue readingCategory Archives: Software
Running a UEFI program upon reboot
Linux is only one of the Operating Systems that our chips need to support. While some features need a complete OS for testing, we want to make sure that features are as tested as possible before we try to debug them through Linux.
Continue readingHow Did I break my Code
Something I did in a commit broke my code. I have a git bisect that shows me the last good commit and the first bad one.
Continue readingrecvfrom system call in python
With a socket created, and a message sent, the next step in our networking journey is to receive data.
Continue readingsendto system call from python
Once we open a socket, we probably want to send and receive data across it.Here is the system call we need to make in order to send data as I wrote about in my last post:
c = sendto(sd, buf, sizeof(buf), 0,
(struct sockaddr *)&addr, sizeof(addr));
Continue reading Updated MCTP send code
While the existing documentation is good, there are a couple things that have changed since it was originally written, and I had to make a couple minor adjustments to get it to work. Here’s the code to send a message. The receive part should work as originally published; what is important is the set of headers. I built and ran this on an AARCH64 platform running Fedora 38.
Continue readingsocket system call from python
While the Python socket API is mature, it does not yet support MCTP. I thought I would thus try to make a call from python into native code. The first step is to create a socket. Here is my code to do that.
Note that this is not the entire C code needed to make network call, just the very first step.I did include the code to read errno if the call fails.
#!/usr/bin/python3
from ctypes import *
libc = CDLL("/lib64/libc.so.6")
AF_MCTP = 45
SOCK_DGRAM = 2
rc = libc.socket (AF_MCTP, SOCK_DGRAM, 0)
#print("rc = %d " % rc)
get_errno_loc = libc.__errno_location
get_errno_loc.restype = POINTER(c_int)
errno = get_errno_loc()[0]
print("rc = %d errno = %d" % (rc, errno) )
print("OK")
Running this code on my machine shows success
# ./spdm.py
rc = 3 errno = 0
OK
Refactoring in C: Introduce Dispatch Map
There is a pretty common pattern in C coding that uses a Key, often an integer, to select a function to call. However, code may not start there, and there is a pretty common set of interim steps you might go to get there.
The growth is often like this:
Continue readingRound Trip with MCTP over PCC
The future Ampere System-on-a-chip that is the basis for my work has a couple of processors that are for providing system wide services, not for end users to run things on directly. One of these is called the Management Processor, or Mpro. We have to talk to one of these services from the operating system using the Management Control Transport Protocol, or MCTP, over a Platform Communication Channel (PCC).
I just sent ran a user-land program that sends a message via a socket into the operating system, via PCC, to the MPro, and got a response back.
It took a while for it to sink in. And then I raised my hands in the air and proclaimed in my Best Dr. Frankenstein voice,
“It’s Alive!”
No Negative Access Rules
If you don’t want someone to be able to delete the database, do not give them authority to delete the database.
Continue reading