Files
hpr-knowledge-base/hpr_transcripts/hpr0036.txt

373 lines
22 KiB
Plaintext
Raw Normal View History

Episode: 36
Title: HPR0036: LPI Certifications Part 2
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0036/hpr0036.mp3
Transcribed: 2025-10-07 10:35:57
---
Hello, welcome to Acupuncturistic Radio, my name is Kent Fowell, and this is the second
business series of LPIC.
Today we're going to be talking about IRQ, DMA, ports, and first of all, Balsist.
Balsists are a way to connect different components to your computer.
The advantage of a Balsist is that it makes parts more interchangeable.
So for example, you want to replace your graphical card, you simply take it out,
open up your computer, take out the graphics card from its slot,
and you put it in a new one.
Or if your computer doesn't come with a Firewire port, you might buy a PCI card,
supporting Firewire controller, and you put it into your free PCI slot.
Now, a typical computer has several different Balsists.
So connected to your CPU, you have a backside Bals, and then a frontside Bals.
A backside Balsist is connected to level 2 cache, and then that intern is connected
to the memory controller, which is connected to the RAM.
So when the CPU wants to talk to RAM, it will first go along the backside Bals.
If it's in level 2 cache, it comes back very fast to the CPU.
If it doesn't, it'll go to the memory controller, and then out to RAM,
and come back relatively fast.
Now, the advantage of this system is that the CPU and the backside Balsist typically run
at the same speed, so you have very fast access times.
And it means your memory can be very, access to your memory can be very fast.
Now, the other Balsist that's connected to the CPU typically,
and this typically depends on the architecture of the computer you're talking about,
is a frontside or a system Bals.
And that operates at a slower speed than the backside Balsist,
but quite fast nonetheless.
Off the frontside Balsist, it has a connection, okay, it has a connection to the CPU,
it also has a connection to the memory controller, it also has a connection to an ADP chipset,
and it also has a connection to what's called a Bruce Bridge,
which I believe is the North Bridge.
Now, this frontside Balsist will allow the very fast communication to between the CPU and the graphics card.
It won't be as fast as going over to the level 2 cache on the backside Balsist,
but it's still quite fast, and it'll allow fast access to the RAM.
Now, the point of the Balsist Bridge is so that slower components Balsist can be connected to the frontside Balsist,
and that an example of a Balsist that would be connected to the North Bridge would be the PCI Balsist,
for instance, and here you can put in your PCI devices.
So they then would communicate at a slower speed to the Balsist Bridge,
which would communicate at a faster speed to the frontside system Balsist,
which would communicate with the CPU.
They connected on to the PCI Balsist is the South Balsist Bridge,
which would then connect to ISA devices like hard disks and whatever, or CD-ROM devices,
which are typically a lot slower in relative terms.
So you want to access something from CD,
you'll come into the ISA device in via the South Bridge,
along the PCI Balsist and the North Bridge, into the frontside system Balsist, into the CPU,
and then go maybe out the backside Balsist through level 2 cache,
into the memory controller and not to run.
It makes a lot more sense if you see it in a diagram,
and hopefully they'll put a link to the in the show notes to this diagram,
which I'm actually taking from.
They're really excellent how stuff works guide on introduction
onto how to PCI works.
Thanks for watching.
Thanks for watching.
In the IBM documentation,
they refer to the PCI Bals and the ISA Balsist, as well as AGP to a lesser extent.
So let's have a look at comparison between the ISA Bals and PCI Balsist.
So the ISA Balsist is 16 bits wide, operates at a speed of 8 megahertz,
and that translates to 16 mega bits per second data transfer.
If you think of Balsist, there were 16 bits.
If you think of that as 16 lanes along the motorway,
and if you think of Balsist, there's the speed limit that data can transfer down that line.
If you compare that to that 16 bits to the PCI Bals,
so instead of 16 lanes of traffic, we now have 32 bits,
32 lanes of traffic going along, and the original specification
was a Balsist speed increase in megahertz from 8 up to 33 megahertz,
as is a grand total of, instead of 16 mega bits per second, up to 132 mega bits per second.
Now there's since being revisions of that where it's gone from a 32-bit Balsist
with double that up to 64 bits, and they've gone from 33 up to 133 megahertz.
So now the PCI X standard 64 bits, 133 megahertz,
and it provides data transfer rates of 1 gigabit per second.
Now at the time of the ISA standard was coming out,
and the PCI standard was out 132 mega bits per second,
wasn't fast enough for very demanding 3D graphic work,
like video games or commuterated design 3D rendering, and that sort of thing.
So a separate bus was developed called ADP,
which is acceleration graphics port, and this was developed by Intel,
and that following on from our diary, the mirror on,
that connected directly into the front side system bus.
Now I don't know about harder, but I believe that the new PCI express bus
that's coming out just fast enough, so that it'll take over from AGP.
All these things are in a state of change, so if you just get the concept of what a bus is,
I think you're sucking diesel.
Now finally, Linux provides a command that will allow you to
identify the PCI devices that are in your computer.
That command is called LSPCI.
You know, if you go to a console on your PC,
you should type in following command,
man space LSPCI.
Now the first part of that command is man, which means,
which is manual command, which is, give me help on this,
or show me the manual for the following command,
and the command itself is LSPCI.
So when you do that, you'll get, and this is typical from a man command,
you'll get the name section, you'll get LSPCI,
list all PCI devices, synopsis, LSPCI options to worry about that,
and then this is the juicy part, the description.
LSPCI is the utility for displaying information about all PCI buses
in the system, and all devices connected to them.
By default, it shows a brief list of devices,
use the options to describe blah, blah, blah, blah.
Okay, and it describes additional options,
but this is your first use of the man command,
just pick out that much, and you do very well.
To exit the man command, you typically type the Q key on your keyboard.
Now, the next command that you're going to type at the console is LSPCI,
and then press the enter key, and here we'll see things,
and this is going to vary from PC to PC,
but I see stuff like host bridge, PCI bridge, USB controller,
ISA bridge, IDE interface, multimedia audio controller,
modem, VGA, ethernet controller,
that's my network card, firewire.
Yeah, yeah, yeah.
Typically, when you're troubleshooting a problem,
this is a very good tool, because it says,
okay, PC, what's connected?
Okay, moving back to our textbook again,
page 8, IO ports.
When the CPU needs to communicate with peripheral device,
it does so through an IO port, or sometimes just simply a port.
When the CPU wants to send data or control information to the peripheral,
it writes to a port.
When the device has data or status ready for the CPU,
the CPU reads the data or status from the port.
Most devices have more than one port associated with them,
typically a small power of two, such as 8, 16, or 32.
Data transfer is usually done a byte or two at a time.
Devices cannot share ports, so if you have an ISA card,
you must ensure that each device has its own port or ports assigned.
Originally, this was done using switches or jumpers on the card.
Sometimes later, ISA cards use something called plug and play,
and this is discussed in the later section.
If you want to see what IO ports are news on our Linux system,
we can do so by looking at the contents of a file
in a special directory on your computer called the PROC directory.
That's at the very root of your directory.
You'll have slash p or oc slash.
Now, if you do an LS,
and first of all, we'll do a man of LS,
and we'll see that LS lists directory contents.
And the description is list information above files,
which is enough to know what LS does.
We'll quit now.
We'll do an LS, space, forward slash p or oc, forward slash,
and then press enter.
And then there we see a load of numbers,
and then we see things like CPU info, crypto, IOMM,
interrupts, and IO ports, along with various other things.
And the PROC system is called a pseudo.
The PROC directory is called a pseudo file system.
So it's not actually a file system,
but it's just a way you get useful information from the processor.
Unix has this philosophy that everything is a file.
So this is a nice place to read these files.
You will get information.
So what we're going to do is we're going to use the cache command,
and we'll again do the man, space, CAT.
And we'll see the cache, kind of catenates files,
and prints on the standard input.
We'll press Q to get out of the man program.
And what that means is it's just a way to display text files
is the simplest one.
It also does other things, which may or may not be just
a little later on in the series.
So we'll type CAT, space, forward slash PROC,
forward slash IO ports, and then press Enter.
Now a lot of stuff goes past.
A lot of numbers, a lot of, so we have memory addresses,
then what I call on, and then two columns, memory addresses,
columnless column separator, and then on the right-hand side
we have what those are.
So for example, if we look at memory address 0060-006F
is the keyboard, and that is actually good,
because it's what it should be.
So that's where you get information about the IO ports and use.
So another thing we're going to need to know about is interrupts,
and we're going to page 10 of from our textbook interrupts.
So how does a CPU know when the last output has finished
or when data is waiting to be read?
Usually this information is available as a status register,
which may be accessible by reading one or more of the IO ports
associated with the devices.
Two obvious problems arise with this scenario.
Firstly, the CPU has to spend time checking the status,
and secondly, if the device has data coming from somewhere
such as an attached modem, the data must be read by the CPU
in a timely fashion, otherwise it might be overwritten
by the next available data byte.
The dual problem of not wasting unnecessary CPU cycles
and ensuring data is read or written in a timely fashion
or are addressed by the concept of interrupts.
Interrupts are also called interrupt requests or IRQs.
When something happens in a device that the CPU needs to know about,
the device raises an interrupt and the CPU temporary stops
whatever it's doing to deal with the situation.
If you want to think of an analogy for this,
I believe in the rural parts of the states
where the postbox is at the end of the road,
that if you want to send some outgoing post or mail,
you put your letters into the postbox
and you raise the flag at the postbox.
I'm not American, so I don't know if it's true,
but I've seen it in movies, so correct me from wrong.
Anyway, if it doesn't work like that pretend it does.
So then your post office dude drives along his or her van
and writes the Joneses they don't have the flag up,
so I don't need to worry about them.
The Smiths don't have their flag up, I don't need to worry about them.
But yeah, job blogs do, so they have the flag up,
so I need to go and deal with whatever it is over there.
And this essentially saved the CPU having to go
to the various different devices, so thinking in terms of the computer,
it's going in the original designs and we'll go keyboard.
Do you have anything for me? No.
Mouse, do you have anything for me? No printer?
Do you have anything for me? No.
District, do you have anything for me? No.
Going from that to a system where they don't,
or there's a flag up there on the hard disk,
so I'll go and deal with that.
So essentially that's what an interrupt is.
The funny thing about interrupts though,
is that you're only allowed to have 16 of them.
And that's going from 0 to 15.
And the funny thing about it is that interrupt 5 is shared
between either the sound card or the second parallel port.
Now the reason you're only allowed to have 16 is because,
yeah, who would need more than 16.
But if you're thinking about it well,
okay, my PC has a lot more than 16 devices on a mice keyboard,
printers, modems, external disks, blood, a bit of that.
Okay, so we now have 16 interrupts.
So you're thinking, well, I can attach 16 devices to my computer.
Well, yes and no, some of them are reserved.
So if we go through the list, 0 is the system timer.
1 is the keyboard. 2 and 9 shared are the video card.
3 is come 2 and I want to come 4.
Interrupt 4 is come 1 and come 3.
Interrupt 5 is LPD2 or the sound card.
RQ6 is the floppy disk controller.
RQ7 is the parallel port 1.
RQ8 is the real time clock.
RQ9 is redirected to RQ2, so you actually don't have 15.
RQ10 is available.
RQ11 is available.
RQ12 is a PS2 mouse.
RQ13 is the mathematical processor.
RQ14 is the hard disk controller and RQ15 is available.
So we're looking at a total of 1, 2, 3, 4.
RQ ports that were available.
Okay, it's all very well.
We now have the concept of an interrupt.
We've also got the concept of iable port.
Now, just to explain what these are, why they're used.
So say I have a brand new expansion card.
It doesn't matter whether it's a PCI or an ISA or whatever card.
I don't want to put it into my computer.
So I've got my acne corporation ISA card.
I need the CPU to be able to talk to that.
So first of all, I'm going to need a free interrupt in order to get the CPU's attention.
And then I'm going to need at a minimum to define a range of ports so that I can send data to and from the CPU.
Now what a port is commonly used in France as a term for a door.
So if you think of it as a block of apartments, so everybody, all the apartments I've got won't address.
So it's number one main street.
And then under that, under you go to number one main street.
There you are.
Big block of apartments.
And you go to port, FFFF.
High, zero to zero across.
And there's a door and you go in and you pass your package in and you get a delivery receipt out.
And then you go in your merry way.
So that's a port.
And if you think of an interrupt as the example of flagging the land, I may have a woman as a case maybe.
Okay, those are two things.
Now we already explained about the speed difference between an ISA bus type and a PCI bus type.
Now the maximum speed on an ISA bus type is 16 megabits per second and for technical reasons.
It would be nine megabits per second.
But yeah, you know, if you send another print job, that's fast enough.
So why is ISA?
Why has that more or less been replaced by PCI devices?
And the reason for that is because these settings needed to be configured manually.
And by manually, I don't mean yes.
Later on, there were programs that will come with the network card that would allow you to run a special program
that would allow you to set these interrupts, for instance.
The ports were too bad because you had a selection from where you could generally select a free port easily,
easy enough without having conflicts.
Very important point to remember is ports cannot be shared between two devices.
Each device must have its own port.
This applies to DMA channels later, which we talked about later.
And ISA devices cannot share interrupts either.
So if you have an ISA device, you would actually go along with a little jumper,
which is on the board itself, there was two pins sticking out and you would take a little jumper
and you would put it over that and short the two pins creating a circuit,
telling it that's interrupt, whatever the interrupt was.
The problem is we had 16 interrupts as you saw earlier on.
But only a few of them were available, a few of them were shared with the sound card.
So for example, interrupt 5, if you had a second LP line print report,
which was common in the days, or if you had a sound card, you could use interrupt 5.
You might be able to get away with interrupt 15, you might be able to get away with 10 or 11.
But it was basically hell setting up those things.
I remember going, spending a weekend with a mid-mind and work,
going around resetting all the natural cards to IRQ 15 from 5,
because it was the only common denominator in all the natural cards that we had.
Because of course some of the devices would come and they would only allow you to set IRQ 5 or IRQ 15.
So you didn't even have the choice of the additional other ones.
Now that was a pain in the wherever.
So when PCI devices came along, they had a major advantage for me personally in that they had a thing called an interrupt handler.
And that was a lot of the PCI buses shared one IRQ.
So the CPU knew that the PCI devices, one of the PCI devices had a wanted its attention.
So it would go over there.
The interrupt handler would see, it's not the first one, it's not the second one, it's not the third one,
but it is the fourth one.
And then the fourth device would communicate over IRQ 5.
Then on the next occasion, when IRQ 5 goes up, it might actually be the first device that communicates.
So that was a major relief.
There was a trouble period where some of the motherboards were coming with PCI devices and ISA devices.
So you still needed to make sure that the ISA devices had their own IRQ set and ports obviously.
And that the PCI device didn't devices altogether didn't conflict with that chosen interrupt.
It's a general tip.
If you have a computer now that has an ISA device, please don't use it.
Keep it if you want a piece of history or whatever, but you're far better off getting a router like a WRT54G.
It'll be faster and run silently.
It's more energy efficient and all of that good stuff and more power and it'll be more standard and more modern.
And you can pick them up relatively cheap.
So now we've covered interrupts, we've covered ports.
But there's another thing that we should discuss on page 11, and that is DMA.
We mentioned earlier that communication with peripheral devices through IO ports occurs by your two at a time.
For fast devices, service interrupts could use a lot of CPU capacity.
A faster method is to use direct memory access or DMA, in which a few IO instructions tell the device where in RAM to read or write data.
And then the DMA controller provides hardware management of the actual transfer of data between RAM and the peripheral device.
So what this means is you've got a slow modem coming in with some data.
And it's operating hyperfast, like a rocket speed, and you've essentially got data coming in on a modem at the speed of some dude taking a leisurely stroll down the park.
So you don't want the CPU to be stopping from the slighting fast speed to take in these messages from the strolling dude.
Here's part of the message, wait for the go home, get the next one, I'll come back in and give you the next one.
So what it does is what the DMA allows you to do is tell that dude, go write directly here into this part of memory.
So get your message, put it all into memory, over there, stack it up in a row, and then we'll flag it and drop it, and then we'll tell the CPU,
OK, CPU, there's a whole goal of that over here, CPU goes over, read all of that at once, that at least is how I think it works.
OK, moving on to plug and play.
Plug and play means that you can connect the device or insert a card into your computer, and it is automatically recognized and configured to work with your system.
To be fully implemented, plug and play requires three things, a bias that supports it.
The core utility that enables PMP and detects the PMP devices device also reads the ESCD for configuration information on existing plug and play devices,
and the ESCD stands for extended system configuration data, and this is a file that contains information about the installed plug and play devices.
You also need an operating system to complete the configuration process started by the bias.
The plug and play automate several key tasks that were typically done either manually or with an installation utility, and those tasks are setting an interrupt,
and signing direct memory access, signing memory addresses if the card needs additional memory.
So for example, sometimes you can, especially on laptops, have the video card uses some system memory instead of having its own onboard memory,
and then that will be assigned and reserved for that.
Then we also have the input output configuration, and these settings define the ports used by the device for receiving and sending information.
Now Linux provides some tools that will allow us to see what's going on here.
And in the textbook on page 13, he makes reference to ISA PMP tools, which on my Ubuntu Gusti, Ubuntu installation is unavailable.
Now there is ISA PMP, neither is PMP dump, but LS PMP is available in the package PMP utils and one aptitude installed PMP utils later.
If you run the command, you'll guess three columns, 00, columns, 00, up to 00, columns, 0d, and then an identifier PMP, 001, and then a brief description of what they are.
So I've got system board, PCI both, system board, system board, PS2 port, IBM enhanced keyboard, essentially.
Everything is a plug and play device on the laptop, even though it's soldered on.
So that is possibly a useful tool for you.
And that's the end of this episode in the mini series on LPI certification for hacker public radio.
For feedback, corrections, or contributions on the series, please email me at ken.valon asgmail.com.
For general feedback on hacker public radio, you can email feedback at hackerpublicradio.org.
Remember, hacker public radio is for the community and by the community.
So if you'd like to do a show, a series of show rules, or provide some other assistance, please email admin at hackerpublicradio.org.
With that, I'd like to thank you for listening. I wish you a very good day.
Thank you for listening to hacker public radio.
Thanks for watching.
Thank you.