Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCI #23

Closed
wants to merge 3 commits into from
Closed

PCI #23

wants to merge 3 commits into from

Conversation

RossComputerGuy
Copy link

Adding PCI, currently it doesn't do much but I plan to add more code I just need to know how the devs want it to work.

@RossComputerGuy RossComputerGuy mentioned this pull request Mar 14, 2019
@sleepy-monax
Copy link
Member

I think while enumerating, PCI device should be placed in /dev/pci. And userspace interacte with then through ioctl but I still need to read more about PCI to see if this a good idea

typedef struct {
} pci_dev_t;

// vim:set ts=4 sw=4 et:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include your text editor configuration in the source file 😅

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it is common for people to do this when they use VIM.

u32 lfunc = (u32)func;
u16 tmp = 0;
address = (u32)((lbus << 16) | (lslot << 11) | (lfunc << 8) | (offset & 0xfc) | ((u32)0x80000000));
outw(0xCF8, address);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xCF8 don't use magic value

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is based on the snippet function on the osdev wiki.

}

void pci_setup() {
// TODO: cache devices (probably should be done on a thread for speed improvement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use FILESYSTEM_MKDEV(device_name, device_object) to mount a device to /dev like /dev/zero 😉

@RossComputerGuy
Copy link
Author

Currently errors

packages/skift.hjert.kernel/sources/dev/pci.c: In function 'pci_setup':
packages/skift.hjert.kernel/sources/dev/pci.c:27:5: error: implicit declaration of function 'FILESYSTEM_MKDEV' [-Werror=implicit-function-declaration]
     FILESYSTEM_MKDEV("pci", pci_device);

@sleepy-monax
Copy link
Member

This because you are working on the master branch, juste checkout the develop branch and it should compile 😉

@sleepy-monax
Copy link
Member

sleepy-monax commented Mar 16, 2019

Maybe useful or not, but I wrote a pci driver well before skiftOS, which you might want to check. 😉 https://github.com/maker-dev/core-one/commit/319c1eace4405eab813237911990f5edf13800d2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants