PG&E Corp. expects its looming bankruptcy to take about two years to resolve and has arranged $5.5 billion to fund its operations during the process. Its shares and bonds both gained.

Four banks agreed to provide debtor-in-possession funding including a $3.5 billion revolving credit facility, the embattled California utility said in a filing.

“It’s a pretty substantial amount of cash so it does look like they expect to stay in bankruptcy for some stretch,’’ said Kit Konolige, a senior analyst with Bloomberg Intelligence.

California’s largest utility owner faces $30 billion in potential wildfire liabilities, and its bankruptcy plan has reverberated across the power industry. The state’s big utilities have seen their shares plunge since November’s deadly Camp Fire, and PG&E’s debt rating has been cut to junk status. The company’s electricity suppliers are getting downgraded amid concern that the utility may seek to renegotiate contracts, and five banks may be on the hook because they’re the buyers of last resort for more than $760 million of bonds.

The banks in the agreement are JPMorgan Chase & Co., Bank of America Corp., Barclays Plc and Citigroup Inc.

PG&E previously sought protection from creditors in 2001 in a process that took about three years, after its Pacific Gas & Electric utility unit filed for bankruptcy. That came amid an electricity crisis in the state that led to severe price spikes and rolling power outages.

Now, the utility must find a way sustain its operations and maintain a power grid that serves 16 million customers, while shielding itself from liabilities after fires devastated the state in 2017 and 2018, killing more than 100 people.

PG&E said the DIP financing would provide liquidity to fund its operations during a Chapter 11 process that it expects to take “approximately two years,” according to the filing.

Shares of PG&E rose 10 percent to $7.97 at 11:42 a.m. in New York. The stock is down more than 80 percent since the Camp fire broke out in November.

Pacific Gas & Electric’s 5.125 percent bonds due 2043 rose about 1 cent on the dollar to 80 cents Tuesday morning, yielding nearly 7 percent. Its 6.25 percent notes maturing in 2039 gained about 1 cent to 84 cents on the dollar to yield 8.1 percent, according to data compiled by Bloomberg.

Why a PG&E Bankruptcy Could Change Climate Calculus: QuickTake

Investigators are probing whether PG&E’s equipment ignited the Camp Fire, the deadliest and most destructive in California history, which killed 86 people. Lawmakers including newly installed Governor Gavin Newsom have made it clear they have little appetite to intervene with a bailout for the company, at least not until it actually has gone bankrupt. Newsom’s office didn’t immediately respond to request for comment Tuesday.

