OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Jun 28, 2017 9:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PCI in RONIXOS not working
PostPosted: Thu Feb 16, 2017 12:52 am 
Offline

Joined: Thu Feb 16, 2017 12:43 am
Posts: 3
Hey, I'm developing this OS called RONIXOS or RONIX for short. The system is a multitasking, multiarchitecture system that allows PCI . Recently in version 0.0.11 Pre-Alpha it includes BGA (Simple Implementation), VGA (Text), PCI, CMOS (RTC), Serial (COM1-4) and Multitasking. However, I've run into a problem where all of my PCI Devices that I'm trying to read would return me 0x10 then the next one would equal to 0, this would repeat throughout the reading of the device. My code is located on GitHub at https://github.com/SpaceboyRoss01/ronix-core, look inside of src/Kernel/sys/hardware/x86 and look at the PCI C++ file. If anyone knows how to fix this glitch, please tell me. I thought of the name by combining my last name, Ross, with nix. I started RONIX in the beginning of 2016.


This is how I feel from the glitch: :evil: :evil: :evil:

Edit: I've updated the driver, someone please test it and reply back if it works.
New Edit: 0.0.12 Pre-Alpha Released


Last edited by SpaceboyRoss01 on Fri Feb 17, 2017 3:41 pm, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: PCI in RONIXOS not working
PostPosted: Thu Feb 16, 2017 11:29 am 
Offline

Joined: Wed Jan 25, 2017 5:31 pm
Posts: 24
Hey, I already used the name Ronix

http://github.com/ronsoros/ronix4

and I'm going to release a 5.x version too.


Top
 Profile  
 
 Post subject: Re: PCI in RONIXOS not working
PostPosted: Thu Feb 16, 2017 12:34 pm 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 75
Location: Netherlands
Code:
uint8_t PCI::read_byte(uint8_t bus,uint8_t slot,uint8_t func,uint8_t offset) {
   write_addr(bus,slot,func,offset);
   using namespace io;
   return (uint8_t)((Ports::read_long(0xCFC) >> ((offset & 3) * 8)) & 0xFF);
   using namespace hardware;
}

void PCI::write_addr(uint8_t bus,uint8_t slot,uint8_t fn,uint8_t offset) {
   using namespace io;
   uint32_t addr = (uint32_t)((uint32_t)0x80000000 | (uint32_t)bus << 16 | (uint32_t)slot << 11 | (uint32_t)fn << 8 | (uint32_t)offset);
   Ports::write_long(0xCF8,addr);
   using namespace hardware;
}

...

void Ports::write_long(uint16_t port,uint16_t value) {
   asm volatile ("outw %w0,%w1" :: "a"(value),"d"(port));
}

uint16_t Ports::read_long(uint16_t port) {
   uint16_t value;
   asm volatile ("inw %w1,%w0" : "=a"(value) : "d"(port));
   return value;
}

You are confusing 32 bit longs / dwords with 16 bit words all over the place.
Your Ports::write_long() function is called with a 32 bit value, but only takes 16 bit values.
Similarly, your Ports::read_long() function is used to read 32 bit values, but only returns 16 bit values.
One of the many problems that are caused by this that PCI::write_addr() isn't actually able to send the enable bit to the address port, which means that PCI::read_whatever() doesn't actually read anything at all, not even the wrong address.

_________________
Lithik


Top
 Profile  
 
 Post subject: Re: PCI in RONIXOS not working
PostPosted: Thu Feb 16, 2017 1:01 pm 
Offline
Member
Member

Joined: Wed Oct 12, 2016 11:32 am
Posts: 34
Location: At my PC
ronsor wrote:
Hey, I already used the name Ronix

http://github.com/ronsoros/ronix4

and I'm going to release a 5.x version too.

Somehow, I doubt you've trademarked the name Ronix.


Top
 Profile  
 
 Post subject: Re: PCI in RONIXOS not working
PostPosted: Thu Feb 16, 2017 6:58 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 228
LOL, he just updated his README...

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: PCI in RONIXOS not working
PostPosted: Fri Feb 17, 2017 7:09 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 281
Location: East Riding of Yorkshire, UK
kzinti wrote:
LOL, he just updated his README...
I'm not sure where Ronsor is from, but in the UK Ronix is already trademarked and it covers class 9 (software). https://www.ipo.gov.uk/tmcase/Results/2/WO0000001273133
Anyway, this is a bit off topic.

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: YaCy [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group